oneworld.WebMap.add_geojson

WebMap.add_geojson(json_file, subset=None, subset_key='GEOID', layer='map', style={'color': '#fee391', 'fillColor': '#fee391', 'fillOpacity': 0.6, 'opacity': 1.0}, style_mouseover=None, info_mouseover=None)

Add a GeoJSON file to the map.

You can add all the features in the GeoJSON file, or only a subset of those using the subset and subset_key parameters. If you do so, only those features whose subset_key value under the feature’s properties matches the value specified in subset will be added to the map.

Parameters:
  • json_file (str) – Full path name of the GeoJSON file.

  • subset (str) – If defined, only the features of the file whose value of subset_key matches the value in subset will be added to the map (Default: None, i.e., add all features on the file).

  • subset_key (str) – Only relevant if subset is defined. Name of the property (under properties of each feature) that will be used to determine if a feature is added to the map (Default: “GEOID”).

  • layer (str) – Name of the layer on which the selected features will be added. If the specified layer has not yet been created, oneworld will create an overlay with that name using the default settings (Default: “map”, which will add the lines directly to the map object).

  • style (dict) – Dictionary containing keywords and values defining common style values for all features in the GeoJSON file. (Default: {‘opacity’:1.0, ‘fillOpacity’:0.6, ‘color’: ‘#fee391’, ‘fillColor’: ‘#fee391’}).

  • style_mouseover (dict) – If set, style of a feature when the mouse is hovered over it (Default: None).

  • info_mouseover (str) – If set, information to be displayed on a pannel when the mouse is hovered over any feature. Accepts html format (Default: None).

See also

add_choropleth

Notes

For a full listing of style options, see https://leafletjs.com/reference-1.6.0.html#path