[postgis-users] Re: function to find UTM zone SRID from POINT

Patrick pvanlaake at users.sourceforge.net
Sat Dec 3 12:34:16 PST 2005


"Alex Mayrhofer" <axelm-postgis at nona.net> wrote in message 
news:439198E6.1070000 at nona.net...
> Is there a function/table to find out the SRID of the UTM zone where a 
> given point falls into? This should be a fairly frequent problem - i'd 
> like to avoid reinventing the wheel ;)
>
Alex,

This depends on how your point is defined. If it is lat/long on WGS84, then 
it is pretty straightforward. The zone number is calculated as (long + 186) 
div 6. Positive latitudes add an N, negative an S. UTM zones have sequential 
SRIDs. So if you find the starting SRID for zone 01N and 01S and add the 
zone number -1, you have the answer to your question.

Problems arise when the point is projected, because then there is no way to 
derive the zone number from the coordinates; you'd have to know the zone 
number, then proceed as above.

Further problems lie in the selection of datum. UTM has no fixed datum and 
you will thus find many entries for a given zone number in spatial_ref_sys, 
each having a different datum. Using the original EPSG tables instead of 
spatial_ref_sys gives you more options for analysis, but it is no easy 
solution. This wheel has not been invented yet, but I am working on it (see 
threads on 18 October and 10 November).

Best,
Patrick 






More information about the postgis-users mailing list