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

Fix empty geometries issue #1652

Merged
merged 1 commit into from
Jun 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion cartoframes/utils/geom_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def decode_geometry_item(geom, enc_type):
ENC_EWKT: lambda: _load_ewkt(geom)
}.get(enc_type)
return func() if func else geom
return shapely.geometry.base.BaseGeometry()
return None


def _load_wkb(geom):
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/utils/test_geom_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import geopandas as gpd

from shapely.geos import lgeos
from shapely.geometry import Point, base
from shapely.geometry import Point

from cartoframes.utils.geom_utils import (ENC_EWKT, ENC_SHAPELY, ENC_WKB,
ENC_WKB_BHEX, ENC_WKB_HEX, ENC_WKT,
Expand Down Expand Up @@ -44,7 +44,7 @@ def test_decode_geometry_empty(self):

def test_decode_geometry_none(self):
geom_none = gpd.GeoSeries([None, None])
expected_decoded_geom = gpd.GeoSeries([base.BaseGeometry(), base.BaseGeometry()])
expected_decoded_geom = gpd.GeoSeries([None, None])

decoded_geom = decode_geometry(geom_none)
assert str(decoded_geom) == str(expected_decoded_geom)
Expand Down