I am getting polygon geom as text which showing the first longitude, latitude ... I am creating GeoJSON and drawing on leaflet... but leaflet standard first latitude then longitude. I am using PostGIS how I can to change in polygon... if I have point geometry it is very easy I can change st_x,st_y for point.... but there I want to change to the overall boundary of the polygon, my created goem is
[[72.96699,31.96872],[72.9679,31.9669]]
while I want to convert as
[[31.96872,72.96699],[31.9669,72.9679]]
overall my query is
(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)