dash-leaflet
dash-leaflet copied to clipboard
Polygon GeoJSON from url won't add to map
I am unable to add a .fgb polygon as a GeoJSON feature to my Dash Leaflet map. I tested this using Python 3.12 with dash==3.1.1 and dash-leaflet==1.1.2. Using the Flatgeobuf example on the GeoJSON tutorial page, I am unable to reproduce the example in the docs. Here are the steps to reproduce:
- Create script:
uv init --script test.py --python 3.12 - Add dependencies:
uv add --script test.py 'dash-leaflet==1.1.2' 'dash==3.1.1' - Download the .fgb from the example and move it to your pwd:
https://github.com/emilhe/dash-leaflet-docs/raw/refs/heads/main/assets/us-counties.fgb - Paste in the
Flatgeobufcode into test.py and replace "url=/assets/us-counties.fgb" with "url=./us-counties.fgb". - Run with
uv run test.py.
This pulls up a map, but the us counties are not displayed. I have also tested by pointing the url to the raw file url on GitHub, and also tested pointing to a .fgb I have stored on a file server and have used for other projects.