Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOCS] Update Sedona Visualization docs to include note for single geometry column #929

Merged
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
16f39f5
Update apache sedona version to 1.4.1
iGN5117 Jul 4, 2023
c132894
Refactored notebook imports and added unified SedonaContext entry points
iGN5117 Jul 4, 2023
ff9238c
Replaced geopandas plot with KeplerGL visualization.
iGN5117 Jul 4, 2023
38ae4bd
Merge branch 'master' into develop_Nilesh_1.5.0_NotebookVisualization
iGN5117 Jul 4, 2023
40135b3
Add keplerGL to pipfile
iGN5117 Jul 5, 2023
c7a62a2
Merge branch 'develop_Nilesh_1.5.0_NotebookVisualization' of https://…
iGN5117 Jul 5, 2023
6629120
Merge branch 'master' into develop_Nilesh_1.5.0_NotebookVisualization
iGN5117 Jul 5, 2023
3095099
try adding dependencies in pipfile
iGN5117 Jul 6, 2023
10adc55
Merge branch 'develop_Nilesh_1.5.0_NotebookVisualization' of https://…
iGN5117 Jul 6, 2023
088aaf4
Add keplergl import
iGN5117 Jul 6, 2023
8e22147
Add env.yml for binder (copied from leafmap)
iGN5117 Jul 7, 2023
d9d3cbb
Force version 3.6.4 of jupyter lab in pipfile
iGN5117 Jul 11, 2023
196ac82
revert adding environment.yml
iGN5117 Jul 11, 2023
0f0015c
add sedona.maps with SedonaKepler, a wrapper for KeplerGl visualizati…
iGN5117 Jul 11, 2023
92578dc
Merge branch 'sedona-master' into develop_Nilesh_1.5.0_NotebookVisual…
iGN5117 Jul 11, 2023
bb46de5
Refactor SedonaKepler wrapper to take SedonaDataFrames as data input
iGN5117 Jul 12, 2023
349c855
moved sedonakepler tests to a separate folder
iGN5117 Jul 13, 2023
a566ee0
Add apache license header to newly created py files
iGN5117 Jul 13, 2023
f7964ba
refactor private method signature to be in line with naming convention
iGN5117 Jul 13, 2023
5786f2a
Added comment explaining usage of _repr_html()
iGN5117 Jul 13, 2023
4ce9f22
Update documentation
iGN5117 Jul 14, 2023
084e0dd
fix typo
iGN5117 Jul 14, 2023
b4295e2
Add copies of datasets to get around keplergl bug
iGN5117 Jul 14, 2023
2e822bf
Refactor SedonaKepler constructor to add support for pandas with pyth…
iGN5117 Jul 17, 2023
bea9973
Missed pushing gif
iGN5117 Jul 18, 2023
c320d2c
Add SedonaPyDeck wrapper for pydeck
iGN5117 Jul 21, 2023
e6da651
Refactor to add generic plot geometry map API
iGN5117 Jul 23, 2023
338b093
Merge branch 'sedona-master' into develop_Nilesh_1.5.0_NotebookVisual…
iGN5117 Jul 23, 2023
899f2b6
Update SedonaKepler docstring to remove geometry_col
iGN5117 Jul 24, 2023
8579b57
Update test logic and updated scatterplot tests
iGN5117 Jul 24, 2023
51ae0f0
Update documentation to add a note about lon-lat order requirement fo…
iGN5117 Jul 24, 2023
a7effc3
Updated chicago crimes license name
iGN5117 Jul 24, 2023
2fa4b9f
missed capitalizing
iGN5117 Jul 24, 2023
84d3130
refactored licenses
iGN5117 Jul 24, 2023
32fcda3
1) increase linewidth in geometry_map
iGN5117 Jul 25, 2023
4997c28
Merge branch 'sedona-master' into develop_Nilesh_1.5.0_NotebookVisual…
iGN5117 Jul 26, 2023
2baba30
fix failing test
iGN5117 Jul 26, 2023
a809f7d
Update docs for Sedona Visualization
iGN5117 Jul 28, 2023
f2ab11a
Address PR comments
iGN5117 Jul 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/tutorial/sql.md
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,9 @@ Sedona provides `SedonaPyDeck` and `SedonaKepler` wrappers, both of which expose
!!!Note
Both SedonaPyDeck and SedonaKepler expect the default geometry order to be lon-lat. If your dataframe has geometries in the lat-lon order, please check out [ST_FlipCoordinates](https://sedona.apache.org/latest-snapshot/api/sql/Function/#st_flipcoordinates)

!!!Note
Both SedonaPyDeck and SedonaKepler are designed to work with SedonaDataFrames containing only 1 geometry column. Passing dataframes with multiple geometry columns will cause errors.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add the following sentence to SedonaPyDeck and SedonaKepler:

To use SedonaPyDeck, GeoPandas and PyDeck must be installed. We recommend the following installation commands:

pip install 'pandas<=1.3.5'
pip install 'geopandas<=0.10.2'
pip install pydeck==0.8.0

To use SedonaKepler, GeoPandas and KeplerGL must be installed. We recommend the following installation commands:

pip install 'pandas<=1.3.5'
pip install 'geopandas<=0.10.2'
pip install keplergl==0.3.2

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


### SedonaPyDeck
Spatial query results can be visualized in Jupyter lab/notebook using SedonaPyDeck.

Expand Down
2 changes: 1 addition & 1 deletion python/sedona/maps/SedonaMapUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def __extract_point_coordinate__(cls, geom):
@classmethod
def _extract_first_sub_geometry_(cls, geom):
while SedonaMapUtils.__is_geom_collection__(geom.geom_type):
return SedonaMapUtils._extract_first_sub_geometry_(geom.geoms[0])
geom = geom.geoms[0]
return geom

@classmethod
Expand Down
15 changes: 8 additions & 7 deletions python/sedona/maps/SedonaPyDeck.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ def create_geometry_map(cls, df, fill_color="[85, 183, 177, 255]", line_color="[
geometry_col = SedonaMapUtils.__get_geometry_col__(df)
gdf = SedonaPyDeck._prepare_df_(df, geometry_col=geometry_col)
geom_type = gdf[geometry_col][0].geom_type
type_list = SedonaPyDeck._create_coord_column_(gdf, geometry_col=geometry_col)
if len(type_list) == 3:
if line_color == "[85, 183, 177, 255]":
line_color = "[237, 119, 79]"
SedonaPyDeck._create_coord_column_(gdf, geometry_col=geometry_col)
# if len(type_list) >= 2: # change line colors if any to make it more visible.
# if line_color == "[85, 183, 177, 255]":
# line_color = "[237, 119, 79]"

layer = SedonaPyDeck._create_fat_layer_(gdf, fill_color=fill_color, elevation_col=elevation_col,
line_color=line_color)
Expand All @@ -100,7 +100,8 @@ def create_geometry_map(cls, df, fill_color="[85, 183, 177, 255]", line_color="[
return map_

@classmethod
def create_scatterplot_map(cls, 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,
def create_scatterplot_map(cls, 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):
"""
Create a pydeck map with a scatterplot layer
Expand Down Expand Up @@ -235,7 +236,6 @@ def _create_coord_column_(cls, gdf, geometry_col, add_points=False):
type_list = []
gdf['coordinate_array_sedona'] = gdf.apply(
lambda val: list(SedonaMapUtils.__extract_coordinate__(val[geometry_col], type_list)), axis=1)
return type_list

@classmethod
def _create_fat_layer_(cls, gdf, fill_color, line_color, elevation_col):
Expand All @@ -244,12 +244,13 @@ def _create_fat_layer_(cls, gdf, fill_color, line_color, elevation_col):
data=gdf,
auto_highlight=True,
get_fill_color=fill_color,
opacity=1.0,
opacity=0.4,
stroked=False,
extruded=True,
get_elevation=elevation_col,
get_line_color=line_color,
pickable=True,
get_line_width=3
)

return layer
5 changes: 3 additions & 2 deletions python/tests/maps/test_sedonapydeck.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,13 @@ def testPolygonMap(self):
data=buildings_gdf,
auto_highlight=True,
get_fill_color="[85, 183, 177, 255]",
opacity=1.0,
opacity=0.4,
stroked=False,
extruded=True,
get_elevation='confidence * 10',
pickable=True,
get_line_color="[85, 183, 177, 255]"
get_line_color="[85, 183, 177, 255]",
get_line_width=3
)
p_map = pdk.Deck(layers=[polygon_layer])
sedona_pydeck_map = SedonaPyDeck.create_geometry_map(df=buildings_df, elevation_col='confidence * 10')
Expand Down