Generate entire Mapbox Style sheet in Python thread
See original GitHub issueBackground
Currently, there is business logic occurring in both the Python mapboxgl
library and the javascript templates. Since this is a Python library, we should isolate all business logic to Python, and make the Javascript/HTML components true templates only. This should greatly increase supportability of the mapboxgl
library as it grows by isolating bugs to Mapbox GL Style Spec changes, which are much rarer than changes to the Mapbox GL JS Javascript library.
Approach
- Generate a complete Mapbox GL Style Sheet in a Python dictionary in the viz.py
- Serve the JSON-format style sheet to the HTML template via a the Jupyter Notebook local web server.
- Each time the analysis updates, the templates do not need to be destroyed & recreated. The map style simply updates with map.setStyle(newStyleURL)
cc @perrygeo
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Blank or missing map tiles | Help - Mapbox docs
This guide explains how to troubleshoot some common reasons maps fail to load. Your style ID is invalid. If you are using a...
Read more >Self-hosting Mapbox vector tiles - GIS Stack Exchange
One step of the new vector tile process is to curate the vector data by adjusting what you want in the data. The...
Read more >Mapbox map layers in Python - Plotly
Detailed examples of Mapbox Map Layers including changing color, size, log axes, and more in Python.
Read more >Micromobility: Threading Traffic on 2 Wheels - Winter 2022
Micromobility: Threading Traffic on 2 Wheels | BUILD with Mapbox - Winter 2022. 11 views · 8 days ago ...more ...
Read more >MapLibre – Mapbox GL Native Open Source Fork - YouTube
Want to learn how to build applications with vector maps for iOS or Android? Looking for more information about #MapLibre?
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is going to help so much with multi-layer maps if we can include the layer definitions!! Been playing around with serializing the property expressions on the Python side to get styled heatmaps layered under a point and linestring viz. Fun stuff : )
This could be done with a websocket as well! As for the parsing and jinja issue, have you ever considered using something with a little more structure like a protocol buffer thats serialized as json if you knew what your were doing you could probably scrape the page with the style sheet spec on it to generate the protocol buffer structures based on the required fields etc. I’m not saying it’d be easy, in fact it’d probably be a pain but once you did once you could probably do it as things are updated (assuming that style-spec page stays up to date.) lol I may have to try this now!