Hi Everyone, I am looking for a python or php script that will accept the Range and Meridian values of a location and use it to identify the UTM zone.
The UTM system divides the surface of Earth between 80°S and 84°N latitude into 60 zones, each 6° of longitude in width. Zone 1 covers longitude 180° to 174° W; zone numbering increases eastward to zone 60 that covers longitude 174 to 180 East.
zone = int((( merid + 180 ) % 360 ) / 6 ) + 1
>>> for merid in range(-177,183,6): ... print merid, merid-3,merid+3,int(((merid + 180) % 360) / 6) + 1 ... -177 -180 -174 1 -171 -174 -168 2 -165 -168 -162 3
Range and Meridian
I'm not familiar with type of data Irene is looking at but just noticed that the same question is posted (with no accepted answer) at Stack Exchange GIS so that is somewhere else to look for ideas on how to do this.
- Graeme
(All Range values are 1,2,3,4,5,.........30)
Meridian = W2M ; Range = 1 to 30
Meridian = W3M ; Range = 1 to 30
Meridian = W4M ; Range = 1 to 30
Meridian = W5M ; Range = 1 to 30
I would like to use a python script to deduce the UTM zones for these meridian and range values.
Thanks for your help
I'm not familiar with what you mean by "range" unless you mean the range of a single zone, say -72 to -78 longitude. The meridian is of course the center of the zone, say, -74. UTM is nicely described in its wikipedia article, as follows:
So -- you know the zone's central meridian, you can calculate the zone like this:zone = int((( merid + 180 ) % 360 ) / 6 ) + 1
For a value of merid = -75 this yields a zone value of 18.
Here's python interactive code to test it:>>> for merid in range(-177,183,6): ... print merid, merid-3,merid+3,int(((merid + 180) % 360) / 6) + 1 ... -177 -180 -174 1 -171 -174 -168 2 -165 -168 -162 3
Here's another explanation, that uses different (but I'm assuming equivalent) integer math.
http://www.resurgentsoftware.com/GeoMag/utm_coordinates.htm
Your terminology is a little confusing - both those terms seem like they relate to Public Land Survey System (Township-Range-section) for describing legal locations, but refer to different attributes of that nomenclature. It would help if you could clarify these terms - for instance, a PLSS township/range/section is described according to a specific Baseline and Meridian - do you mean Baseline here instead of Range or do you really mean the Range (denoted usually as a value E or W of a the Meridian.. ). Also, Meridian in this context is not the same as the Central Meridian as a UTM zone, so a clearer example of these terms is important. PLSS Meridian and baselines are descriptive rather than expressed as degrees of longitude - for instance the PLSS for Arizona references the 'Gila and Salt River Base Line and Meridian'. Perhaps an example of the data you have would be useful as well.
I'm not familiar with what you mean by "range" unless you mean the range of a single zone, say -72 to -78 longitude. The meridian is of course the center of the zone, say, -74. UTM is nicely described in its wikipedia article, as follows:
So -- you know the zone's central meridian, you can calculate the zone like this:zone = int((( merid + 180 ) % 360 ) / 6 ) + 1
For a value of merid = -75 this yields a zone value of 18.
Here's python interactive code to test it:>>> for merid in range(-177,183,6): ... print merid, merid-3,merid+3,int(((merid + 180) % 360) / 6) + 1 ... -177 -180 -174 1 -171 -174 -168 2 -165 -168 -162 3
Here's another explanation, that uses different (but I'm assuming equivalent) integer math.
http://www.resurgentsoftware.com/GeoMag/utm_coordinates.htm
Hi Curtprv,
I ran the script above but it gave me a wrong answer for the supplied meridian.
For instance in my code below, I tried to see what the equation will return as the zone for meridian 2 but it gave me Zone 31 instead of Zone 13. If calculated manually, the zone is determined by two parameters - the DLS range and the Meridian value which i found to be missing in your equation. Please can you take a look once more at the equation.
merid = 2 zone = int((( merid+180) % 360) / 6) + 1 print zone
the zone is determined by two parameters - the DLS range and the Meridian value which i found to be missing in your equation. Please can you take a look once more at the equation.