Question

I am trying to transfrom below grometry (geo referenced to australia)

POLYGON((-33.917172 151.110971,-33.916443 151.112495,-33.917637 151.113276,-33.917783 151.111512,-33.917253 151.111577,-33.917172 151.110971))

from SRID 4326 to 3112 using below query

SELECT AsText(Transform(PolygonFromText('POLYGON((-33.917172 151.110971,-33.916443 151.112495,-33.917637 151.113276,-33.917783 151.111512,-33.917253 151.111577,-33.917172 151.110971))',4326),3112)) as result

in spatialite GUI 1.7.1 with spatialite 4.1.1 with all GEOS,PROJ extensions enabled but the resulting geometry is

POLYGON((Inf Inf, Inf Inf, Inf Inf, Inf Inf, Inf Inf, Inf Inf))

Why is this happening?

Was it helpful?

Solution

Very easy, you just have to invert LON/LAT values:

SELECT AsText(Transform(PolygonFromText('POLYGON((151.110971 -33.917172, 151.112495 -33.916443, 151.113276 -33.917637, 151.111512 -33.917783, 151.111577 -33.917253, 151.110971 -33.917172))',4326),3112)) as result

result:

POLYGON((1569305.481332 -3926985.759663, 1569455.307825 -3926925.091727, 1569508.606645 -3927065.382207, 1569345.639225 -3927059.314561, 1569359.502478 -3927002.182676, 1569305.481332 -3926985.759663))

http://en.wikipedia.org/wiki/Well-known_text

POLYGON(x y) = POLYGON(lon lat)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top