# Geometry Transformation in Spatialite 4.1.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?

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