将纬度替换为经度

时间:2017-11-25 14:22:52

标签: leaflet postgis latitude-longitude postgresql-9.4

我将多边形geom作为显示第一个经度,纬度的文本...我正在创建GeoJSON并在传单上绘图...但是传单标准第一个纬度然后是经度。我正在使用PostGIS如何更改多边形...如果我有点几何,我可以很容易地更改st_xst_y以获得点....但是我想要更改为多边形的整体边界,我创建的goem是

[[72.96699,31.96872],[72.9679,31.9669]]

虽然我想转换为

[[31.96872,72.96699],[31.9669,72.9679]]    

整体而言我的查询是

(SELECT row_to_json(fc)
     FROM ( SELECT 'FeatureCollection' As type, array_to_json(array_agg(f)) As features
     FROM (SELECT 'Feature' As type
      , st_asgeojson(lg.geom , 5 ,0)::json As geometry
      , row_to_json((SELECT l FROM (SELECT id, distt_name) As l
        )) As properties
     FROM (SELECT gid as id, distt_name , geom FROM tbl_districts 
      where distt_name like '%') As lg) As f )  
    As fc)

1 个答案:

答案 0 :(得分:1)

您应该使用jsonb_build_objectST_AsGeoJSON生成GeoJSON。