This is an automated email from the ASF dual-hosted git repository.
jiayu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sedona.git
The following commit(s) were added to refs/heads/master by this push:
new d1addaea [SEDONA-330] Fix SedonaPyDeck bugs (#922)
d1addaea is described below
commit d1addaea59d027d523cede4a3b72e3e150e63513
Author: Nilesh Gajwani <[email protected]>
AuthorDate: Thu Jul 27 12:49:52 2023 -0700
[SEDONA-330] Fix SedonaPyDeck bugs (#922)
---
python/sedona/maps/SedonaMapUtils.py | 2 +-
python/sedona/maps/SedonaPyDeck.py | 15 ++++++++-------
python/tests/maps/test_sedonapydeck.py | 5 +++--
3 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/python/sedona/maps/SedonaMapUtils.py
b/python/sedona/maps/SedonaMapUtils.py
index 6ebd4f6f..3d9614af 100644
--- a/python/sedona/maps/SedonaMapUtils.py
+++ b/python/sedona/maps/SedonaMapUtils.py
@@ -77,7 +77,7 @@ class SedonaMapUtils:
@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
diff --git a/python/sedona/maps/SedonaPyDeck.py
b/python/sedona/maps/SedonaPyDeck.py
index 22ef8d5b..154b8a4c 100644
--- a/python/sedona/maps/SedonaPyDeck.py
+++ b/python/sedona/maps/SedonaPyDeck.py
@@ -82,10 +82,10 @@ class SedonaPyDeck:
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)
@@ -100,7 +100,8 @@ class SedonaPyDeck:
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
@@ -235,7 +236,6 @@ class SedonaPyDeck:
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):
@@ -244,12 +244,13 @@ class SedonaPyDeck:
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
diff --git a/python/tests/maps/test_sedonapydeck.py
b/python/tests/maps/test_sedonapydeck.py
index e7ef09a8..2d45ecf5 100644
--- a/python/tests/maps/test_sedonapydeck.py
+++ b/python/tests/maps/test_sedonapydeck.py
@@ -70,12 +70,13 @@ class TestVisualization(TestBase):
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')