Tuesday 30 January 2018

postgis - Why does ST_Transform fail?



I got a postGIS error like this,


ERROR:  transform: couldn't project point (100.496 13.7118 0): latitude or longitude exceeded limits (-14)
SELECT ST_Length(ST_Transform(ST_GeomFromText(E'LINESTRING(100.495995129 13.7117836894,100.495962221169 13.7117761471941)',4326),27700));

This lat/lng comes from Bangok, Thailand and the 27700 is a british national grid. Do you think this casued the problem? May I mention that problems like this did not occur when I got lat/lng from Spain or USA.


Any input would be much appreciated.



Answer



A guess: many implementations of transverse Mercator (used by British National Grid) can only be used with a limited range of longitudes centered on the projection's central meridian. Try converting to 32647 (WGS 84 UTM Zone 47North) instead to see if that's the issue.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...