add_feature

property MapsGrid.add_feature

Interface to features provided by NaturalEarth.

(see https://www.naturalearthdata.com)

The features are grouped into the categories β€œcultural” and β€œphysical” and available at 3 different scales:

  • 10 : Large-scale data (1:10m)

  • 50 : Medium-scale data (1:50m)

  • 110 : Small-scale data (1:110m)

If you use scale=”auto”, the appropriate scale of the feature will be determined based on the map-extent.

For available features and additional info, check the docstring of the individual categories!

>>> m.add_feature.< category >.< feature-name >(scale=10, ... style-kwargs ...)

Examples

  • add black (coarse resolution) coastlines

    >>> from eomaps import Maps
    >>> m = Maps()
    >>> m.add_feature.physical.coastline(scale=110, fc="none", ec="k")
    
  • color all land red with 50% transparency and automatically determine the appropriate scale if you zoom the map

    >>> from eomaps import Maps
    >>> m = Maps()
    >>> m.add_feature.physical.land(scale="auto", fc="r", alpha=0.5)
    
  • fetch features as geopandas.GeoDataFrame (to color all countries with respect to the area)

    >>> from eomaps import Maps
    >>> m = Maps()
    >>> countries = m.add_feature.cultural.admin_0_countries.get_gdf(scale=10)
    >>> countries["area_rank"] = countries.area.rank()
    >>> m.add_gdf(countries, column="area_rank")