Turbo87 / utm

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

lat/lon to forced UTM projection #7

Closed ghost closed 9 years ago

ghost commented 10 years ago

It would be nice to be able to force a from_latlon convertion into a specific UTM zone. You see, most of Denmark is positioned in zone 32, while the eastern most part of Sealand (including Copenhagen) and the island Bornholm is located in zone 33. But for simplicity, maps of Denmark are often created, so the entire Sealand is projected in zone 32 and only Bornholm is sometimes projected in zone 33.

Therefore I suggest to add optionally arguments to from_latlon, so one could force it to be converted to a specific UTM zone. Example:

def from_latlon(latitude, longitude,force_utm_zome=False,force_utm_letter=None):
..

    if force_utm_zone and force_utm_letter:
        zone_number = int(force_utm_zone)
        zone_letter = force_zone_letter
    else:
        zone_number = latlon_to_zone_number(latitude, longitude)
        zone_letter = latitudeto_zone_letter(latitude)

I know it is going to add complexity to your otherwise simple and clean solution, but for some it is required to be able to force UTM zones.

What do you think about the issue?

Turbo87 commented 9 years ago

@xcalibur666 this functionality is now part of utm v0.4.0 which I just released on PyPI