[postgis-users] Reverse X and Y coordinates?

Olivier Courtin olivier.courtin at oslandia.com
Fri Dec 18 10:15:50 PST 2009


On Dec 18, 2009, at 6:52 PM, Anthony McClure wrote:

Hi,

> I have a problem that I cannot find a solution to.  I have the X and  
> Y coordinates reversed in
> the geometries within my database.  I need the X's to become Y's and  
> the Y's to become X's.
> The geometries are all polygons or multi-polygons.  Is there  
> anything within PostGIS I can
> execute SQL wise to do this?

That's a pure hack (never been designed for this)

But if you have SVN PostGIS (with libxml2) :
SELECT st_astext(st_geomfromgml(st_asgml(3, st_astext('POINT(1 0)'),  
8, 16)));

Will output:
POINT(0 1)



--
Olivief






More information about the postgis-users mailing list