1

When drawing cartopy maps, I add state lines with

ax.add_feature(cfeature.NaturalEarthFeature(
    'cultural', 'admin_1_states_provinces_lines', resolution,
    edgecolor='gray', facecolor='none'))

where resolution is '110m', '50m' or '10m'. The 110m dataset only contains US states, but the others contain far more.

I would like to draw state lines only for selected countries (regardless of the resolution selected), like e.g. only US, Canada and Australia.

I found a similar question in Draw a map of a specific country with cartopy? and downloaded the US shape file from gadm.org. I added the states using

us_shapes = list(shpreader.Reader('shapefiles/gadm36_USA_1.shp').geometries())
ax.add_geometries(us_shapes, ccrs.PlateCarree(), edgecolor='gray',
                  facecolor='none')

But this creates two problem for me:

  • The shapes also contain the country (US in this case) border itself, which I had previously drawn in black. I can of course draw the country borders after the state borders, but this is somewhat superfluous since a lot of coast line is drawn twice. Is there a way to only get the state lines within the country (so without country border)?
  • The shape file seems to contain a very fine resolution (maybe 10m?). When I draw the world map with 110m resolution, I would prefer to only get the state lines in 110m. Otherwise the time to draw the map is significantly larger and the country/state shapes are not perfectly on top. Does the shape file also contain the lower resolutions?

The following image shows the problem: Cartopy World Map with added US states

Bianfable
  • 237
  • 5
  • 13
  • To avoid `coastlines being drawn twice` in your case, involves a lot more work on complex coding. I will wait and see the answers. – swatchai Dec 05 '18 at 14:04
  • @swatchai OK, I guess I can live with the coastlines being drawn twice, but I definitely need them in the correct resolutions to match the rest. – Bianfable Dec 05 '18 at 14:54

0 Answers0