matplotlib / basemap

Plot on map projections (with coastlines and political boundaries) using matplotlib
MIT License
775 stars 392 forks source link

Feature request: support for projected UTM EPSG codes #370

Open iannesbitt opened 7 years ago

iannesbitt commented 7 years ago

I'm using Basemap in an application (PyHum) that requires EPSG code input for projection information to use in both Basemap and pyproj. The problem is that Basemap rejects projected NAD83 UTM codes (26919 - NAD83 UTM 19N, for example) and thus PyHum cannot output in UTM. Is there a reason UTM projections are not supported, and if not, is there a good way to incorporate support for them? I've looked at several options but none really make sense except changing Basemap's EPSG support.

WeatherGod commented 7 years ago

Adding EPSG support to Basemap would be non-trivial. It already has a fairly complex object __init__(). Does basemap even support UTM, either? I am pretty sure cartopy does, though.

micahcochran commented 7 years ago

UTM is a shortcut for Transverse Mercator or tmerc. It just populates a few extra parameters to make tmerc work. tmerc is supported by basemap. etmerc is a new algorithm for Transverse Mercator that is more accurate in edge cases.

WeatherGod commented 7 years ago

Ah, that shows how much I use UTM in my day-to-day work. The only EPSG code I know off the top of my head is 4236. In any case, you are right, I would like to see a package that has an internal database for converting the EPSG codes, but a web api call isn't a deal-breaker for me. We already have some functions that fetches from the web, we should just be very clear that that would happen, and not make it a requirement.

On Tue, Sep 19, 2017 at 5:00 PM, Micah Cochran notifications@github.com wrote:

UTM is a shortcut for Transverse Mercator or tmerc. It just populates a few extra parameters to make tmerc work. tmerc is supported by basemap. etmerc is a new algorithm for Transverse Mercator that is more accurate in edge cases.

  • pyCRS https://pypi.python.org/pypi/PyCRS could be used to translate the EPSGcode into a proj4 code. The only quibble that I have with pyCRS is the the EPSG code lookup function that it pulls from a website instead of database.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/matplotlib/basemap/issues/370#issuecomment-330672167, or mute the thread https://github.com/notifications/unsubscribe-auth/AARy-AzgPBTUbfIg-7u_rgiEvQZh1zUbks5skCuIgaJpZM4PZ8tC .

ocefpaf commented 7 years ago

If a web service is not a problem consider using pyepsg instead of pyCRS. It is the same one used in cartopy.