basemap
basemap copied to clipboard
Magnetic coordinates and lines drawing across the world map
I'm extending basemap to work with magnetic coordinates. Basically, latitude longitude are converted to/from magnetic coordinates during calls to Basemap.__call__(). However, I get results like this:

It seems that coastlines/polygons are not properly "broken" on the left/right plot edges. I suspect I have to change something in _readboundarydata() to fix this (since that's where the coastlines and polygons are initiated), and I have had a look at it, but I do not really see what I would need to change. I don't even see how this is handled in the normal (geographic coordinates) case. There are some references to the crossing of east/west datelines, are these "datelines" the left/right map boundaries in projections like the above? I don't really understand what this part of the code accomplishes.
Any tips?
Just for completeness, which version of matplotlib and which version of basemap are you using?
The code dealing with wrappings is insane (I didn't write it), and I am having difficulty figuring it out. There is a lot of magic numbers involved. One thing I might speculate as the source of the problem is exactly what range of longitudes does your code produce? Is it -180 to 180? or is it 0 to 360? Also, is that range half-open or inclusive?
On Wed, Oct 28, 2015 at 9:53 AM, Christer van der Meeren < [email protected]> wrote:
I'm extending basemap to work with magnetic coordinates. Basically, latitude longitude are converted to/from magnetic coordinates during calls to Basemap.call(). However, I get results like this:
[image: figure_1] https://cloud.githubusercontent.com/assets/7766733/10790251/8446e6ee-7d82-11e5-847b-1838642da17a.png
It seems that coastlines/polygons are not properly "broken" on the left/right plot edges. I suspect I have to change something in _readboundarydata() to fix this (since that's where the coastlines and polygons are initiated), and I have had a look at it, but I do not really see what I would need to change. I don't even see how this is handled in the normal (geographic coordinates) case. There are some references to the crossing of east/west datelines, are these "datelines" the left/right map boundaries in projections like the above? I don't really understand what this part of the code accomplishes.
Any tips?
— Reply to this email directly or view it on GitHub https://github.com/matplotlib/basemap/issues/222.
matplotlib 1.4.2 basemap 1.0.7
I haven't really paid attention to what the longitude range is (I'm wrapping other code for the actual conversions), but I don't think that is relevant. Everything must be converted to map projection coordinates before plotting, and no matter if the longitude is -181 or 179 it should be converted to the exact same point. Right? Or is there some code that relies on the actual latitudes/longitudes? Seems strange if so, because whether or not a line is wrapped around depends only on the projection coordinates (alternatively on the longitude AND the specific projection of the map).
Sorry if I'm wrong here.
... unless there is an impedance mismatch of some sort. Looking over the basemap code, I suspect that the code assumes [-180, 180), but is actually miscoded and mishandles the 180.0 edgecase.
On Wed, Oct 28, 2015 at 11:20 AM, Christer van der Meeren < [email protected]> wrote:
matplotlib 1.4.2 basemap 1.0.7
I haven't really paid attention to what the longitude range is, but I don't think that is relevant. Everything must be converted to map projection coordinates before plotting, and no matter if the longitude is -181 or 179 it should be converted to the exact same point. Right?
— Reply to this email directly or view it on GitHub https://github.com/matplotlib/basemap/issues/222#issuecomment-151879501.
I tried constraining the output longitude to [-180, 180) in the conversion functions but it had no effect.