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

Alex Mayrhofer axelm-postgis at nona.net
Mon Dec 5 02:19:07 PST 2005


Patrick wrote:

> 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.

Ok, that would be pretty straightforward - probably with the exception of 
points which are _exactly_ on a zone border - which zone should they use? 
Essentially, they would show up in both zones on  the "border of the map".

However, i'll use the centroid of a geometry to decide about the zone. And 
my data is WGS84, so no problem here...

> 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).

phew - didn't think of that. Out of my scope, fortunately, because i'll be 
fine with the "start SRID + zone offset" approach.

thanks for the valueable insight.

Alex Mayrhofer



More information about the postgis-users mailing list