Skip to content

Add: Native support for GeoJSON via geopandas with dashboard example #733

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sanjai-11
Copy link

@sanjai-11 sanjai-11 commented May 14, 2025


name: Pull Request
about: Add built-in support for geospatial data using GeoPandas
title: "[Feature] Add GeoPandas Support for Geospatial Data Sources"
labels: enhancement
assignees: ''

Related Issue
Fixes #530

Description of Changes
This PR adds first-class support for geospatial data in Preswald using geopandas. Key updates include:

  • Added support for type = "geojson" in preswald.toml
  • Added flatten_geometry = true|false toggle for geometry handling
  • Implemented load_geospatial_source() using geopandas.read_file() in data.py
  • Automatically flattens geometries into GeoJSON via __geo_interface__ when enabled
  • Supports .geojson, .shp, .gpkg file formats
  • Added a new example at examples/geo/ with monuments_geo.geojson and interactive dashboard
  • Ensured compatibility with get_df(), plotly(), table(), chat(), and map rendering

Type of Change

  • New feature (non-breaking change which adds functionality)
  • New example
  • Bug fix
  • Breaking change
  • Documentation update
  • Test improvement

Testing

  • Ran the Preswald app with monuments_geo.geojson
  • Validated data loading, filtering, mapping, and analytics
  • Verified map location markers are correctly scaled by visitors
  • Tested toggling flatten_geometry in preswald.toml
  • Confirmed behavior with missing/malformed files
  • Screenshots attached in issue discussion (see hover interaction and map rendering)

Screenshots
image
image
image

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (inline comments + example)
  • My changes generate no new warnings
  • I have run my code against examples and ensured no errors
  • Any dependent changes have been merged and published in downstream modules

@sanjai-11
Copy link
Author

Hi @amrutha97,
I've opened a PR addressing this issue: #530

The implementation adds native geopandas support as discussed, including:

  1. type = "geojson" and "shapefile" support in preswald.toml
  2. Automatic flattening of geometry using geo_interface
  3. Configurable flatten_geometry option
  4. A working example app under examples/geo/ with visualizations

Please have a look when you get a chance..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Integrate with geopandas for Native Geospatial Data Handling
1 participant