1

I am trying to transform a geometry (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 the following 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?

1 Answer 1

3

The problem is that you've got the geometry coordinates in the wrong order. Well Known Text (WKT) for SRID 4326 uses Longitude then Latitude (think Cartesian coordinates X-Y). As such, you're passing in latitudes more than 90 degrees.

So the operation should be:

spatialite> 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;

Which will produce:

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))
2
  • so if call AsTex(geometry) in query will it return the order as in geometry or in Longitude and Latitude only ??
    – venkat530
    Commented Feb 7, 2014 at 2:11
  • That is a different question - please "Ask Question" again, referencing this question if applicable.
    – BradHards
    Commented Feb 7, 2014 at 2:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.