Turbo87 / utm

Bidirectional UTM-WGS84 converter for python
http://pypi.python.org/pypi/utm
MIT License
486 stars 101 forks source link

UTM zone exceptions error #19

Closed hogend closed 7 years ago

hogend commented 8 years ago

By definition zones are left-closed, right-open intervals, e.g. zone 31: 0 <= latitude < 6. In function latlon_to_zone_number:

if 72 <= latitude <= 84 and longitude >= 0:
    if longitude <= 9:
        return 31
    elif longitude <= 21:
        return 33
    elif longitude <= 33:
        return 35
    elif longitude <= 42:
        return 37

For latitudes >=72, this results in: zone 31: 0 <= longitude <= 9 zone 33: 9 < longitude <= 21 zone 35: 21< longitude <= 33 zone 37: 33< longitude <= 42

but for latitudes < 72: zone 37: 36 <= latitude < 42

Turbo87 commented 8 years ago

@hogend thanks for reporting this! do you think you could open a pull request with the suggested changes?

astrojuanlu commented 7 years ago

I'm interested in looking into this too, but I could not find any source or reference that supports the first statement: "By definition zones are left-closed, right-open intervals". Any material on this?

hogend commented 7 years ago

On Fri, Jun 23, 2017 at 03:45:19AM -0700, Juan Luis Cano Rodríguez wrote:

I'm interested in looking into this too, but I could not find any source or reference that supports the first statement: "By definition zones are left-closed, right-open intervals". Any material on this?

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/Turbo87/utm/issues/19#issuecomment-310634487

Hello,

I am sorry for the late reply, but I have been sailing the last couple weeks with very limited internet connectivity. The definite reference for UTM is Technical Manual 8358.1 (see http://earth-info.nga.mil/GandG/publications/ ). A more elaborate explanation is given in NGA.SIG.0012_2.0.0_UTMUPS (Version 2.0.0 - March 25, 2014): The Universal Grids and the Transverse Mercator and Polar Stereographic Map Projectionsm; especially in section 7.4 (document 4. at the above mentioned website). Hope this helps, Regards,

Rene Hogendoorn

astrojuanlu commented 7 years ago

Awesome @hogend, that is exactly what I meant. In section 7.5 of NGA.SIG.0012_2.0.0_UTMUPS we have the full pseudocode:

screenshot-2017-7-4 the-universal-grids_v7e_plain nb - nga sig 0012_2 0 0_utmups pdf