API¶
Geoplot¶
|
Create a folium map centred on a GeoJSON FeatureCollection. |
|
Plot GeoJSON features on a folium map. |
|
Plot a choropleth on a folium map. |
-
faculty_extras.geoplot.
centred_map
(feature_collection, feature_selection=None, feature_index_property='id', ignore_missing_features=False, **kwargs)¶ Create a folium map centred on a GeoJSON FeatureCollection.
- Parameters
- feature_collectiondict
A GeoJSON FeatureCollection
- feature_selectionarray-like, optional
A set of keys to select a slice from feature_collection (default: use whole feature_collection)
- feature_index_propertystr, optional
The property of features in feature_collection to use when extracting a selection (default: ‘id’)
- ignore_missing_featuresbool, optional
When True, quitely ignore features in feature_selection missing from feature_collection (default: False)
- **kwargs
Additional keyword arguments to pass to folium.Map
- Returns
- folium.Map
A map centred on feature_collection
-
faculty_extras.geoplot.
single_colour
(folium_map, feature_collection, fill_colour, feature_selection=None, feature_index_property='id', ignore_missing_features=False, **kwargs)¶ Plot GeoJSON features on a folium map.
- Parameters
- folium_mapfolium.Map
The folium map to plot on
- feature_collectiondict
A GeoJSON FeatureCollection
- fill_colourstr
A colour name or hex code
- feature_selectionarray-like, optional
A selection to slice the feature collection with
- feature_index_propertystr, optional
The property of features in feature_collection to use when extracting a selection (default: ‘id’)
- ignore_missing_featuresbool, optional
When True, quitely ignore features in feature_selection missing from feature_collection (default: False)
- **kwargs
Additional keyword arguments to pass to the folium choropleth method
-
faculty_extras.geoplot.
choropleth
(folium_map, feature_collection, feature_index, feature_data, feature_index_property='id', bins=5, colourmap='viridis', ignore_missing_features=False, **kwargs)¶ Plot a choropleth on a folium map.
- Parameters
- folium_mapfolium.Map
The folium map object to plot on
- feature_collectiondict
A GeoJSON FeatureCollection
- feature_indexarray-like
A sequence of feature identifiers corresponding to the feature_data column
- feature_dataarray-like
Scalar values to plot on the map for each feature in feature_index
- feature_index_propertystr, optional
The property of features in feature_collection containing the feature_index (default: ‘id’)
- binsint or array-like, optional
The number of bins, or, the edges of the bins (default: 5)
- colourmapstr, optional
The matplotlib colourmap to use (http://matplotlib.org/users/colormaps.html, default: ‘viridis’)
- ignore_missing_featuresbool, optional
When True, quitely ignore features missing from feature_collection (default: False)
- ignore_missing_featuresbool, optional
When True, quitely ignore features in feature_index missing from feature_collection (default: False)
- **kwargs
Additional keyword arguments to pass to the folium choropleth method
Geojson¶
|
Extract a slice from a GeoJSON FeatureCollection. |
|
Calculate the centre of a GeoJSON object. |
|
Calculate the bounding box of a GeoJSON object. |
-
faculty_extras.geoplot.geojson.
slice
(feature_collection, feature_selection, feature_index_property, ignore_missing_features=False)¶ Extract a slice from a GeoJSON FeatureCollection.
- Parameters
- feature_collectiondict
A GeoJSON FeatureCollection
- feature_selectionarray-like, optional
A set of keys to select a slice from feature_collection (default: use whole feature_collection)
- feature_index_propertystr, optional
The property of features in feature_collection to use when extracting a selection (default: ‘id’)
- ignore_missing_featuresbool, optional
When True, quitely ignore features in feature_selection missing from feature_collection (default: False)
-
faculty_extras.geoplot.geojson.
centre
(geojson_object)¶ Calculate the centre of a GeoJSON object.
The midpoint of the bounding box is evaluated, not the centroid.
- Parameters
- geojson_objectdict
The GeoJSON object to calculate the centre of
- Returns
- float
The longitude of the centre
- float
The latitude of the centre
-
faculty_extras.geoplot.geojson.
bounding_box
(geojson_object)¶ Calculate the bounding box of a GeoJSON object.
- Parameters
- geojson_objectdict
The GeoJSON object to calculate the bounding box of
- Returns
- numpy.ndarray
[min_longitude, min_latitude, max_longitude, max_latitude]