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.

I have a table that comprises of Easting, Northing, Range and Meridian but I'm missing the UTM zones of these points. I am able to manually identify the UTM zone knowing the range and Meridian of the location. I wish to automate this by using a python script that will scan in these parameters as variables and extract the UTM zones based on the parameters.

Can someone please help me out! It will really be exciting to achieve this as I really need to get it going, its so clumsy having to go through thousands of point data to this manually.

Meridian      Range      UTM Zone

   W1M       1 to  30    14

   W2M       1 to  30    13

   W3M       1 to  15    13

             16 to 30    12

   W4M       1  to 30    12

   W5M       1  to 30    11

Every data collected is described by a combination of meridian and range value. e.g NW-05-046-06-W4M to NW-05-046-05-W5M.

  • 1
    Could you elaborate more on what your range and meridian fields look like, or even better include a sample of your data in the question?
    – AlmaThom
    Aug 9 '12 at 17:52
  • 1
  • I am asking for ideas on how i can automatically extract my UTM zones based on the information I have (meridian and range), In all the questions I have gone through no one seems to have had such a problem, moreso I am dealing with Python scripting and php which are the major two languages i am good at. Please I would employ you to take a second look at my posting to see that it is not in any way closely related to the ones you listed above.
    – Shade
    Aug 9 '12 at 20:04
  • 1
    @Shade, could you say what you mean by "meridian" and "range" and what they have to do with a UTM zone, given that you also have the locations? And yes, although the script in the apparent duplicate is not in Python, it is so close to Python that you will have no trouble at all porting it.
    – whuber
    Aug 9 '12 at 20:06
  • The questions above are addressing coordinate conversion from Lat\lon to UTM. They already have known UTM zones and some Lat\lon coordinates. but in my own case, I am dealing with survey data which comes only with DLS information (comprising of the Township, range, meridian info) and then the (Easting and Northing) info for the location. I cannot do much with these data if I dont have the UTM zone and so I need to extract the UTM zones of these data(>500,000 data) somehow before I can proceed.
    – Shade
    Aug 9 '12 at 20:10

If you have ArcGIS installed, you should be Shapefile of the UTM zones. My shapefile is located at C:\Program Files (x86)\ArcGIS\Desktop10.0\Reference Systems\UTM.shp. I would convert your PLS data to Centroids and then Intersect that with the UTM zones. If you intersect the PLS polygons, some will have two UTM zones. Each meridian,township,range will then have the corresponding UTM zone.

  • Thanks!, But this is still trying to do it manually.I wish to get a script that will do it automatically. I will attach a sample data on my question to show the mapping of the meridian and range with the UTM zone
    – Shade
    Aug 10 '12 at 16:19

At a minimum, to identify an appropriate UTM zone you need the latitude and longitude of the "principal meridian" and the range east or west. Such information designates a north-south strip of nominal 6 mile by 6 mile squares whose lower left corners are displaced from the meridian's origin by 6 miles east-west for each range.

The code will have to obtain the coordinates of the meridians from some data source: these values cannot be determined by an algorithm (unless possibly some special kinds of meridians are involved: the question does not provide any information about this).

The formulas are simple, once you equate one degree of longitude with 111.2 * cos(latitude) km and recall that 1 mile is close to 1.609 km. With this information you can obtain the longitudes spanned by the quadrant in question and recalling that the UTM zones are 6 degree gores starting with the first at -180..-174 and moving positively around the earth, numbered starting with 1.

This suggests the following pseudocode, which uses the longitude of a quadrant's center to decide on the UTM zone.

function UTMZone(lat, lon, range, ew) {
    # (lat, lon) is the location of the central meridian
    # range is a positive integer
    # ew is an east-west designation for ranges
    if (ew = east) then r = range - 1/2 else r = 1/2 - range
    longitude = lon + r * 6 * 1.609 / (111.2 * cos(lat))
    return round( (longitude + 183)/6 )

For example, consider range 9E relative to the Navaho meridian at (35.748889, -108.533056). The center lies 9-1/2 = 8.5 quadrants east of the meridian. That's 8.5 * 6 = 51 miles. At this latitude, with cosine equal to 0.8115853, there are 111.2 * 0.811585 / 1.609 = 56.08965 miles per degree east-west. Converting those 51 miles to degrees gives 0.9093 degrees, which are added to the longitude of -108.533 to give -107.624 degrees. That's just within UTM zone 13, which extends from -108 to -102 degrees.

We needn't be too fussy about the calculations because sectioning the earth into a perfect square grid doesn't work; the earth isn't flat. Something has to give, and this can be seen in slight slippages of the quadrants relative to each other and tiny adjustments in their sizes. Thus all such calculations are at best approximate. But they should almost always be within about 0.01 degree accuracy, which is fine for deciding on the UTM zone.

It's worth remembering that these zones were designed to extend over 7 degrees, overlapping each other by one full degree at either end, so that it shouldn't be important to identify "the" zone when a quadrant is close to the nominal boundary: there's about five ranges worth of "wiggle room" to work with.

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.