basemap: Some countries borders not showing up in map
I remember seeing this already a long time ago but I never managed to solve it.
I’m plotting a map using this
m = Basemap(projection='merc',
llcrnrlat=extents[2],
urcrnrlat=extents[3],
llcrnrlon=extents[0],
urcrnrlon=extents[1],
lat_ts=20,
resolution='h')
m.fillcontinents(color='lightgray', lake_color='#2081C3', zorder=1)
m.drawlsmask(land_color=(0, 0, 0, 0), ocean_color='#2081C3',
resolution='f', lakes=True, zorder=2, grid=1.25)
ax = plt.gca()
m.drawcountries(linewidth=0.8)
m.drawcoastlines()
m.readshapefile(f'{SHAPEFILES_DIR}/ITA_adm_shp/ITA_adm1',
'ITA_adm1', linewidth=0.8, color='black', zorder=5)
but some countries (like Switzerland) don’t show up.
Weirdly enough when centering the projection over France Switzerland shows up
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 23 (12 by maintainers)
Commits related to this issue
- Fix unhandled GeometryCollection in BaseGeometry.intersection Solves issue #566. — committed to matplotlib/basemap by molinav 6 months ago
I think you can just remove the pip part altogether, those packages shouldn’t be important.
Anyway I decided to create a new environment from scratch with the dependencies I need, which successfully installed also the latest basemap version. I’ll just need to move the production pipeline to this environment once I have some time.
thank you anyway for the help @molinav !!
I have just released
basemap
1.3.9 on PyPI and conda-forge, which includes the bugfix for the missing country borders. If there is still any problem on your side, feel free to reopen the issue.Hi @guidocioni! Sorry for being so late with this. For the moment, I can confirm you the bug using the following code snippet:
This returns the following in my console:
And the following image is obtained, with Switzerland borders missing, as in your original message:
I would need to check the internals of
Basemap.drawcountries
, to see if the Switzerland borders are read correctly from thebasemap_data_hires
files (which I would expect), and at which point the borders are filtered out from plotting.