2

I am trying to use the coastline data provided by Natural Earth (in the form of shape files) within basemap. I am getting weird horizontal lines as shown in the figures below. When the plot is centered on 180 degree longitude, the number of such lines increases.

Looking at the location of these lines (which is where continents wrap around), I reckon the source of the problem must be related to how the polygons are defined in the shape file and the wrapping of the polygon around a longitude, but I don't see how I can go about fixing it. I would expect a mapping library like basemap to be able to handle this transparently. Any solution would very be helpful.

I am using the "ne_110m_coastline" data from Natural Earth and I have not modified it in any way. Here's a sample code that replicates the problem:

Map = Basemap(projection='eck4',lon_0=0, resolution='c')
a = Map.readshapefile("ne_110m_coastline", "coast")

enter image description here enter image description here

deepak
  • 2,045
  • 2
  • 21
  • 36
  • I tried this. Had same problem with different projections. If I don't use ne_110m_coastline, it just works fine. I think the coastline file has some data missing especially those near longitude 0 area. Do you have to use ne_110m_coastline? – Hun Apr 18 '16 at 02:02
  • No I don't have to use it. I'd prefer to use a different dataset than the one that comes with baseman because i don't like that it draws rivers and lakes too. Do you know of any other alternatives? – deepak Apr 18 '16 at 02:30
  • This might help. http://stackoverflow.com/questions/14280312/world-map-without-rivers-with-matplotlib-basemap – Hun Apr 18 '16 at 02:34
  • I've seen that before but most answers there are too cumbersome and only achieve partial success. The answer using natural earth coastlines is fine, but shifting to a central longitude of 180 induces the same lines as seen above. – deepak Apr 18 '16 at 14:11

0 Answers0