BUG: Handle missing geometry with to_crs and shapely (#1618)

* BUG: Handle missing geometry with to_crs and shapely

* remove pygeos compat stuff in tests
This commit is contained in:
Alan D. Snow
2020-09-14 09:34:24 +01:00
committed by GitHub
parent 5616ba40a8
commit d6932671c6
2 changed files with 13 additions and 1 deletions
+4 -1
View File
@@ -886,6 +886,9 @@ def transform(data, func):
result = np.empty(n, dtype=object)
for i in range(n):
geom = data[i]
result[i] = transform(func, geom)
if _isna(geom):
result[i] = geom
else:
result[i] = transform(func, geom)
return result
+9
View File
@@ -49,6 +49,15 @@ def test_to_crs_transform():
assert_geodataframe_equal(df, utm, check_less_precise=True)
def test_to_crs_transform__missing_data():
# https://github.com/geopandas/geopandas/issues/1573
df = df_epsg26918()
df.loc[3, "geometry"] = None
lonlat = df.to_crs(epsg=4326)
utm = lonlat.to_crs(epsg=26918)
assert_geodataframe_equal(df, utm, check_less_precise=True)
def test_to_crs_inplace():
df = df_epsg26918()
lonlat = df.to_crs(epsg=4326)