Search code examples
cartopy

How do I know what NaturalEarthFeature names are available for cartopy?


The cartopy.feature.NaturalEarthFeature class of cartopy looks like a very convenient way to add high quality map features, but I haven't been able to figure out what values are allowed for the name parameter at class initialization. The documentation indicates it needs to be a valid dataset name from www.naturalearthdata.com, but the dataset information there does not give clear indication of the datasets' names.

I have tried the obvious such as 'natural-earth-i-with-shaded-relief' (or variant 'natural_earth_i_with_shaded_relief') and other such guesses, but none of my guesses worked. The only names that don't drop a 404 on me are 'land' and 'ocean' under the 'physical' category -- but even then, although the code runs it doesn't render anything for those features. I am expecting some sort of basic land or ocean shading at the very least. Ideally I would like to add physical shaded relief as a backdrop to my data overlay.


Solution

  • Q: What are the values allowed for the name parameter of the cartopy command below?

    cartopy.feature.NaturalEarthFeature(category, name, scale, **kwargs)
    

    Answer: The name can be figured out from the (shapefile) file names in the depository:

    https://github.com/nvkelso/natural-earth-vector
    

    For example, at scale '50m' of cultural category, the link is here:

    In that place you will find many shapefiles. One of it is

    ne_50m_admin_0_boundary_lines_land.shp
    

    The name parameter of this file is only part of it (without 'ne_50m_'):

    "admin_0_boundary_lines_land".
    

    With this example, I hope you can figure out any file you want.