Skip to content

Commit

Permalink
Merge pull request #1652 from CartoDB/juanra/fix-empty-geometries
Browse files Browse the repository at this point in the history
Fix empty geometries issue
  • Loading branch information
Jesus89 authored Jun 23, 2020
2 parents ee2b443 + e20e43b commit 4f4f2ec
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
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

0 comments on commit 4f4f2ec

Please sign in to comment.