Renderers
to_geojson(df, x_key='longitude', y_key='latitude')
Converts a DataFrame to GeoJSON.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df |
DataFrame
|
The DataFrame to convert. |
required |
x_key |
str
|
The key in the DataFrame that contains the longitude. Defaults to "longitude". |
'longitude'
|
y_key |
str
|
The key in the DataFrame that contains the latitude. Defaults to "latitude". |
'latitude'
|
Returns:
Type | Description |
---|---|
Optional[str]
|
Optional[str]: The GeoJSON representation of the DataFrame. |
Examples:
from seasnake import MermaidAuth, FishBeltTransect, to_geojson
auth = MermaidAuth()
fish_belt = FishBeltTransect(token=auth.get_token())
project_id = "AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE"
geojson = to_geojson(fish_belt.sample_events(project_id))
print(geojson)