Modern GIS toolkit for Python - Simplifying geospatial workflows with built-in data sources, intelligent caching, and fluent APIs
This example demonstrates how to use PyMapGIS to load geospatial data and create an interactive choropleth map using its Leafmap integration.
The Python script interactive_map_example.py
performs the following steps:
import pymapgis as pmg
.ALAND
) is in a numeric format.us_states_land_area_map.html
) in the script’s directory. Tooltips will show the state name and its land area.Ensure PyMapGIS is installed: If you haven’t installed PyMapGIS and its optional dependencies for mapping, you might need to: ```bash pip install pymapgis[leafmap] ``` or ```bash pip install pymapgis leafmap ```
Navigate to the example directory: ```bash cd docs/examples/interactive_mapping_leafmap ```
Run the script: ```bash python interactive_map_example.py ```
us_states_land_area_map.html
will be created in the current directory (docs/examples/interactive_mapping_leafmap/
).If you run this script in a Jupyter Notebook environment, the map might display directly within the notebook after the cell execution, depending on your Leafmap and Jupyter setup. The script explicitly saves to an HTML file for broader compatibility.