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

Add add_vector_layer function #445

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

giswqs
Copy link

@giswqs giswqs commented Feb 5, 2025

Fix #437

This PR adds:

  • add_vector_layer function for loading any geopandas supported vector format, including shapefile, geopackage, kml
  • vector_to_geojson function for converting any geopandas supported vector format to GeoJSON
  • Update the notebook example to include the add_vector_layer examples.

📚 Documentation preview: https://jupytergis--445.org.readthedocs.build/en/445/
💡 JupyterLite preview: https://jupytergis--445.org.readthedocs.build/en/445/lite

Copy link
Contributor

github-actions bot commented Feb 5, 2025

Binder 👈 Launch a Binder on branch giswqs/jupytergis/vector

@mfisher87 mfisher87 added the enhancement New feature or request label Feb 5, 2025
Copy link
Contributor

github-actions bot commented Feb 5, 2025

Integration tests report: appsharing.space

**kwargs,
)
else:
df = gpd.read_file(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this will download the GeoJSON if I do something like:

url = "https://github.com/opengeos/datasets/releases/download/world/countries.geojson"
doc.add_vector_layer(path=url, name="GeoJSON")

This is unfortunate since it will embed the GeoJSON data into the JGIS file, which may be an unwanted behavior. Keeping the GeoJSON source pointed by URL may be better.

So I guess we'd want to consider two approaches in this function:

  • if it's a URL, we keep the URL as-is and don't embed the data
  • if it's a local file or some in-memory data in Python, we don't have the choice but to embed the data so we keep this logic here

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

Successfully merging this pull request may close these issues.

Support Adding Shapefile Layers via Python API
3 participants