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

[SEDONA-556] Hidden requirement for geopandas in apache-sedona 1.5.2 #1405

Merged
merged 1 commit into from
May 9, 2024
Merged
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
7 changes: 5 additions & 2 deletions python/sedona/maps/SedonaMapUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
# specific language governing permissions and limitations
# under the License.


import geopandas as gpd
import json
from sedona.sql.types import GeometryType

Expand All @@ -38,6 +36,11 @@ def __convert_to_gdf_or_pdf__(cls, df, rename=True, geometry_col=None):
pandas_df = df.toPandas()
if geometry_col is None: # No geometry column found even after searching schema, return Pandas Dataframe
return pandas_df
try:
import geopandas as gpd
except ImportError:
msg = "GeoPandas is missing. You can install it manually or via sedona[kepler-map] or sedona[pydeck-map]."
raise ImportError(msg) from None
geo_df = gpd.GeoDataFrame(pandas_df, geometry=geometry_col)
if geometry_col != "geometry" and rename is True:
geo_df.rename_geometry("geometry", inplace=True)
Expand Down
Loading