5

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.

5
  • Related gis.stackexchange.com/questions/30117/…
    – Mapperz
    Sep 14, 2012 at 15:44
  • What's the E in E'LINESTRING': typo or something I don't recognize?
    – andytilia
    Sep 14, 2012 at 16:22
  • i just copied it from postgresql log file in which E indicates a string if I am not mistaken..
    – Antony
    Sep 14, 2012 at 17:02
  • 2
    Why are you trying to convert lat/lng from Bangkok, Thailand to British National Grid? That doesn't seem to make much sense - is there a specific reason?
    – CHenderson
    Sep 14, 2012 at 19:07
  • Hi, I started testing in the UK but now it has gone global so I am trying to come around this problem.
    – Antony
    Sep 17, 2012 at 9:10

1 Answer 1

7

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.

6
  • hi, i tried the 32647 and it still throws the same error. Thanks for your help though!
    – Antony
    Sep 14, 2012 at 15:58
  • What versions of PostGIS and PROJ.4 are you using? Testing the suggested SRID 32647 works with PostGIS -trunk and PROJ.4 4.8.0
    – dustymugs
    Sep 14, 2012 at 18:38
  • Try swapping the coordinate order from lon/lat to lat/lon? That is, use 13.7118 100.496.
    – mkennedy
    Sep 14, 2012 at 19:36
  • 1
    I just ran your query using 32647 and it worked fine: SELECT ST_Length(ST_Transform(ST_GeomFromText(E'LINESTRING(100.495995129 13.7117836894,100.495962221169 13.7117761471941)',4326),32647)); Sep 14, 2012 at 22:38
  • Hi, I tried it today and it worked, then I tried it again and it did not by throwing an error like this, ERROR: AddToPROJ4SRSCache: couldn't parse proj4 string: '+proj=utm +zone=47 +ellps=WGS84 +datum=WGS84 +units=m +no_defs ': latitude or longitude exceeded limits
    – Antony
    Sep 17, 2012 at 8:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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