sedona.spark.maps package
Submodules
sedona.spark.maps.SedonaKepler module
- class sedona.spark.maps.SedonaKepler.SedonaKepler[source]
Bases:
objectPlot Sedona DataFrames on Kepler.gl maps in a Jupyter notebook.
Requires the
keplerglpackage, installed withapache-sedona[kepler-map].- classmethod add_df(kepler_map, df, name='unnamed')[source]
Adds a SedonaDataFrame to a given map object. Raster columns are left out.
- Parameters:
kepler_map – Map object to add SedonaDataFrame to
df – SedonaDataFrame to add
name – [Optional] Name to assign to the dataframe, default name assigned is ‘unnamed’
- Returns:
Does not return anything, adds df directly to the given map object
- classmethod create_map(df=None, name='unnamed', config=None, height=600, use_arrow=False, show_docs=False)[source]
Creates a map visualization using kepler, optionally taking a sedona dataFrame as data input
- Parameters:
df – [Optional] SedonaDataFrame to plot on the map
name – [Optional] Name to be associated with the given dataframe, if a df is passed with no name, a default name of ‘unnamed’ is set for it.
config – [Optional] A Kepler.gl map config to be applied to the rendered map
height – [Optional] Height of the map in pixels, default is 600
use_arrow – [Optional] Whether to use Arrow to transfer the data to the map, default is False
show_docs – [Optional] Whether to show the Kepler.gl documentation, default is False
- Returns:
A
keplergl.KeplerGlmap object
sedona.spark.maps.SedonaMapUtils module
sedona.spark.maps.SedonaPyDeck module
- class sedona.spark.maps.SedonaPyDeck.SedonaPyDeck[source]
Bases:
objectPlot Sedona DataFrames on pydeck maps in a Jupyter notebook.
Requires the
pydeckpackage, installed withapache-sedona[pydeck-map].- classmethod create_choropleth_map(df, fill_color=None, plot_col=None, initial_view_state=None, map_style=None, map_provider=None, elevation_col=0, api_keys=None, stroked=True)[source]
Create a pydeck map with a choropleth layer added
- Parameters:
df – SedonaDataFrame to plot on the choropleth map.
fill_color – color scheme to fill the map with. If no color scheme is given, a default color scheme is created using the ‘plot_col’ column as the quantizing column
plot_col – Column to be used to create a default color scheme. If fill_color is provided, this parameter is ignored.
initial_view_state – Initial view state for the map
map_style – Map style to use
map_provider – Map provider to use
elevation_col – Optional elevation for the polygons
api_keys – Optional dictionary of API keys for Map providers
stroked – Whether to stroke the polygons
- Returns:
A pydeck Map object with choropleth layer added
- classmethod create_geometry_map(df, fill_color='[85, 183, 177, 255]', line_color='[85, 183, 177, 255]', elevation_col=0, initial_view_state=None, map_style=None, map_provider=None, api_keys=None, stroked=True)[source]
Create a pydeck map with a GeoJsonLayer added for plotting given geometries.
- Parameters:
df – SedonaDataFrame with polygons
fill_color – Optional color for the plotted polygons
line_color – Optional color for the outlines of the plotted geometries
elevation_col – Optional column/numeric value to determine elevation for plotted polygons
initial_view_state – optional initial view state of the pydeck map
map_style – optional map_style of the pydeck map
map_provider – optional map_provider of the pydeck map
api_keys – Optional dictionary of API keys for Map providers
stroked – Whether to draw the outlines of the polygons
- Returns:
A pydeck map with a GeoJsonLayer map added
- classmethod create_heatmap(df, color_range=None, weight=1, aggregation='SUM', initial_view_state=None, map_style=None, map_provider=None, api_keys=None)[source]
Create a pydeck map with a heatmap layer added
- Parameters:
df – SedonaDataFrame to be used to plot the heatmap
color_range – Optional color_range for the heatmap
weight – Optional column to determine weight of each point while plotting the heatmap
aggregation – Optional aggregation to use for the heatmap (used when rendering a zoomed out heatmap)
initial_view_state – Optional initial view state of the pydeck map
map_style – Optional map_style of the pydeck map
map_provider – Optional map_provider for the pydeck map
api_keys – Optional dictionary of API keys for Map providers
- Returns:
A pydeck map with a heatmap layer added
- classmethod create_scatterplot_map(df, fill_color='[255, 140, 0]', radius_col=1, radius_min_pixels=1, radius_max_pixels=10, radius_scale=1, initial_view_state=None, map_style=None, map_provider=None, api_keys=None)[source]
Create a pydeck map with a scatterplot layer
- Parameters:
df – SedonaDataFrame to plot
fill_color – color of the points
radius_col – Column holding the radius of each point in meters, or a number to use as the radius of every point
radius_min_pixels – Minimum radius of a point on screen, in pixels
radius_max_pixels – Maximum radius of a point on screen, in pixels
radius_scale – Multiplier applied to every radius
initial_view_state – optional initial view state of a pydeck map
map_style – optional map_style to be added to the pydeck map
map_provider – optional map_provider to be added to the pydeck map
api_keys – Optional dictionary of API keys for Map providers
- Returns:
A pydeck map object with a scatterplot layer added