maplibreum 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- maplibreum-0.2.0/CHANGELOG.md +45 -0
- maplibreum-0.2.0/LICENSE +21 -0
- maplibreum-0.2.0/MANIFEST.in +4 -0
- maplibreum-0.2.0/PKG-INFO +281 -0
- maplibreum-0.2.0/README.md +237 -0
- maplibreum-0.2.0/maplibreum/__init__.py +57 -0
- maplibreum-0.2.0/maplibreum/_version.py +7 -0
- maplibreum-0.2.0/maplibreum/animation.py +411 -0
- maplibreum-0.2.0/maplibreum/babylon.py +135 -0
- maplibreum-0.2.0/maplibreum/choropleth.py +153 -0
- maplibreum-0.2.0/maplibreum/cluster.py +359 -0
- maplibreum-0.2.0/maplibreum/controls.py +1741 -0
- maplibreum-0.2.0/maplibreum/core.py +3770 -0
- maplibreum-0.2.0/maplibreum/custom.py +249 -0
- maplibreum-0.2.0/maplibreum/datasources.py +22 -0
- maplibreum-0.2.0/maplibreum/deckgl.py +145 -0
- maplibreum-0.2.0/maplibreum/experimental.py +358 -0
- maplibreum-0.2.0/maplibreum/expressions.py +102 -0
- maplibreum-0.2.0/maplibreum/layers.py +175 -0
- maplibreum-0.2.0/maplibreum/markers.py +97 -0
- maplibreum-0.2.0/maplibreum/overlays.py +170 -0
- maplibreum-0.2.0/maplibreum/pmtiles.py +83 -0
- maplibreum-0.2.0/maplibreum/protocols.py +97 -0
- maplibreum-0.2.0/maplibreum/realtime.py +260 -0
- maplibreum-0.2.0/maplibreum/sources.py +614 -0
- maplibreum-0.2.0/maplibreum/styles.py +9 -0
- maplibreum-0.2.0/maplibreum/templates/__init__.py +1 -0
- maplibreum-0.2.0/maplibreum/templates/map_template.html +1561 -0
- maplibreum-0.2.0/maplibreum/templates/sync_maps.js +66 -0
- maplibreum-0.2.0/maplibreum/three.py +170 -0
- maplibreum-0.2.0/maplibreum/threejs.py +297 -0
- maplibreum-0.2.0/maplibreum/timedimension.py +29 -0
- maplibreum-0.2.0/maplibreum/utils.py +64 -0
- maplibreum-0.2.0/maplibreum.egg-info/PKG-INFO +281 -0
- maplibreum-0.2.0/maplibreum.egg-info/SOURCES.txt +87 -0
- maplibreum-0.2.0/maplibreum.egg-info/dependency_links.txt +1 -0
- maplibreum-0.2.0/maplibreum.egg-info/requires.txt +24 -0
- maplibreum-0.2.0/maplibreum.egg-info/top_level.txt +1 -0
- maplibreum-0.2.0/pyproject.toml +78 -0
- maplibreum-0.2.0/setup.cfg +4 -0
- maplibreum-0.2.0/tests/test_animation.py +63 -0
- maplibreum-0.2.0/tests/test_basic.py +159 -0
- maplibreum-0.2.0/tests/test_camera_actions.py +32 -0
- maplibreum-0.2.0/tests/test_cdn_fallbacks.py +118 -0
- maplibreum-0.2.0/tests/test_choropleth.py +86 -0
- maplibreum-0.2.0/tests/test_cluster.py +63 -0
- maplibreum-0.2.0/tests/test_cluster_performance.py +30 -0
- maplibreum-0.2.0/tests/test_core.py +12 -0
- maplibreum-0.2.0/tests/test_draw_control.py +18 -0
- maplibreum-0.2.0/tests/test_events.py +87 -0
- maplibreum-0.2.0/tests/test_export_png.py +46 -0
- maplibreum-0.2.0/tests/test_expressions.py +22 -0
- maplibreum-0.2.0/tests/test_feature_group.py +16 -0
- maplibreum-0.2.0/tests/test_features.py +328 -0
- maplibreum-0.2.0/tests/test_field_test_api.py +183 -0
- maplibreum-0.2.0/tests/test_fit_bounds.py +20 -0
- maplibreum-0.2.0/tests/test_float_image.py +25 -0
- maplibreum-0.2.0/tests/test_geocoding_control.py +85 -0
- maplibreum-0.2.0/tests/test_geopandas_integration.py +54 -0
- maplibreum-0.2.0/tests/test_image_overlay.py +28 -0
- maplibreum-0.2.0/tests/test_latlng_popup.py +9 -0
- maplibreum-0.2.0/tests/test_map_rtl_defaults.py +12 -0
- maplibreum-0.2.0/tests/test_map_rtl_mobile.py +48 -0
- maplibreum-0.2.0/tests/test_maplibre_version.py +40 -0
- maplibreum-0.2.0/tests/test_marker_draggable.py +20 -0
- maplibreum-0.2.0/tests/test_marker_html_icons.py +24 -0
- maplibreum-0.2.0/tests/test_marker_icon.py +18 -0
- maplibreum-0.2.0/tests/test_measure_control.py +74 -0
- maplibreum-0.2.0/tests/test_minimap.py +23 -0
- maplibreum-0.2.0/tests/test_opensidewalkmap_examples.py +239 -0
- maplibreum-0.2.0/tests/test_pitch_bearing.py +9 -0
- maplibreum-0.2.0/tests/test_pmtiles.py +152 -0
- maplibreum-0.2.0/tests/test_popup_regression.py +18 -0
- maplibreum-0.2.0/tests/test_popup_template.py +28 -0
- maplibreum-0.2.0/tests/test_protocols.py +32 -0
- maplibreum-0.2.0/tests/test_public_api_exports.py +21 -0
- maplibreum-0.2.0/tests/test_realtime.py +139 -0
- maplibreum-0.2.0/tests/test_repr_html.py +10 -0
- maplibreum-0.2.0/tests/test_search_control.py +21 -0
- maplibreum-0.2.0/tests/test_security_xss.py +35 -0
- maplibreum-0.2.0/tests/test_terrain_sky_fog.py +41 -0
- maplibreum-0.2.0/tests/test_text_filter_control.py +51 -0
- maplibreum-0.2.0/tests/test_three_layer.py +96 -0
- maplibreum-0.2.0/tests/test_time_dimension.py +46 -0
- maplibreum-0.2.0/tests/test_toggle_control.py +39 -0
- maplibreum-0.2.0/tests/test_tooltip.py +21 -0
- maplibreum-0.2.0/tests/test_utils.py +26 -0
- maplibreum-0.2.0/tests/test_video_overlay.py +28 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is inspired by [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.2.0] - 2026-08-20
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- Added a complete-style dropdown control, external ES-module and stylesheet loading, structured vector-feature popups, reusable feature-state hover handling, and page-level dashboard elements.
|
|
13
|
+
- Retained initial source definitions on the generated map runtime so large mutable GeoJSON sources can be reused without serializing a second copy.
|
|
14
|
+
- Added five production field-test examples reproducing the distinct MapLibre applications deployed by `opensidewalkmap_beta`: the main node map, accessible routing, hazard analysis, completeness analysis, and data-acquisition dashboard.
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
- Standardized generated maps on MapLibre GL JS 6.0.0 and its ES module build.
|
|
18
|
+
- Added an independent jsDelivr fallback for the MapLibre runtime and stylesheet.
|
|
19
|
+
- Normalized raw GeoJSON and `__geo_interface__` objects into valid GeoJSON sources.
|
|
20
|
+
- Expanded CI across Python 3.9–3.13 with separate browser, documentation, and package-release gates.
|
|
21
|
+
- Added eight-shard browser validation for all implemented gallery examples.
|
|
22
|
+
- Added live-CDN smoke tests for unpkg and the forced jsDelivr fallback.
|
|
23
|
+
- Added a clean-wheel installation and standalone-render smoke test.
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
- JSON-encoded floating-panel HTML so backticks and `${...}` text cannot break out of a JavaScript template literal, and removed its unnecessary delayed insertion race.
|
|
27
|
+
- Declared the existing runtime use of `requests` as an installation dependency.
|
|
28
|
+
- Made every implemented gallery example generate a browser-testable HTML page.
|
|
29
|
+
- Served browser tests over local HTTP and adapted MapLibre 6's ES module
|
|
30
|
+
version API to the generated page's browser-global compatibility contract.
|
|
31
|
+
- Repaired strict Sphinx documentation builds and clarified package discovery for bundled templates.
|
|
32
|
+
|
|
33
|
+
## [0.1.0] - 2025-09-15
|
|
34
|
+
### Added
|
|
35
|
+
- Initial MapLibre integration with a `Map` object that renders interactive maps in notebooks and exported HTML.
|
|
36
|
+
- Layer primitives including GeoJSON overlays, choropleths, clustered data sources, and time-aware visualisations.
|
|
37
|
+
- Media overlays for static imagery and video along with floating image support.
|
|
38
|
+
- Marker utilities with HTML, DivIcon, and Beautify icon support plus draggable markers and clustering helpers.
|
|
39
|
+
- Map controls such as mini map, measure, search, draw tools, layer toggles, and camera helpers.
|
|
40
|
+
- Terrain, sky, and fog helpers alongside expression builders for data-driven styling.
|
|
41
|
+
- Event wiring for click, move, and draw callbacks in Jupyter environments.
|
|
42
|
+
|
|
43
|
+
[Unreleased]: https://github.com/kauevestena/maplibreum_prototype/compare/v0.2.0...HEAD
|
|
44
|
+
[0.2.0]: https://github.com/kauevestena/maplibreum_prototype/releases/tag/v0.2.0
|
|
45
|
+
[0.1.0]: https://github.com/kauevestena/maplibreum_prototype/tree/e0ed3869ac734cfd8077f1f1a6b9b8245ff066e8
|
maplibreum-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Kauê de Moraes Vestena
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: maplibreum
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: A Python library for creating interactive MapLibre maps, like Folium but for MapLibre.
|
|
5
|
+
Author-email: Kauê de Moraes Vestena <kauemv2@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Documentation, https://kauevestena.github.io/maplibreum_prototype/docs/
|
|
8
|
+
Project-URL: Source, https://github.com/kauevestena/maplibreum_prototype
|
|
9
|
+
Project-URL: Issues, https://github.com/kauevestena/maplibreum_prototype/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/kauevestena/maplibreum_prototype/blob/main/CHANGELOG.md
|
|
11
|
+
Keywords: map,mapping,geospatial,GIS,MapLibre,Jupyter
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
22
|
+
Classifier: Framework :: Jupyter
|
|
23
|
+
Requires-Python: >=3.9
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: Jinja2>=3.0
|
|
27
|
+
Requires-Dist: MarkupSafe>=2.0
|
|
28
|
+
Requires-Dist: ipython>=8.0
|
|
29
|
+
Requires-Dist: ijson>=3.0
|
|
30
|
+
Requires-Dist: rtree>=1.0.0
|
|
31
|
+
Requires-Dist: requests>=2.0
|
|
32
|
+
Provides-Extra: test
|
|
33
|
+
Requires-Dist: pytest<9,>=8.0; python_version < "3.10" and extra == "test"
|
|
34
|
+
Requires-Dist: pytest>=8.0; python_version >= "3.10" and extra == "test"
|
|
35
|
+
Requires-Dist: requests-mock>=1.9; extra == "test"
|
|
36
|
+
Requires-Dist: playwright>=1.0; extra == "test"
|
|
37
|
+
Requires-Dist: pytest-playwright>=0.5; extra == "test"
|
|
38
|
+
Requires-Dist: geopandas>=0.10.0; extra == "test"
|
|
39
|
+
Provides-Extra: geo
|
|
40
|
+
Requires-Dist: geopandas>=0.10.0; extra == "geo"
|
|
41
|
+
Provides-Extra: all
|
|
42
|
+
Requires-Dist: geopandas>=0.10.0; extra == "all"
|
|
43
|
+
Dynamic: license-file
|
|
44
|
+
|
|
45
|
+
<p align="center">
|
|
46
|
+
<picture>
|
|
47
|
+
<source media="(prefers-color-scheme: dark)" srcset="branding/logo-dark.svg">
|
|
48
|
+
<img src="branding/logo.svg" alt="MapLibreum logo" width="320">
|
|
49
|
+
</picture>
|
|
50
|
+
</p>
|
|
51
|
+
|
|
52
|
+
[](https://github.com/kauevestena/maplibreum_prototype/actions/workflows/ci.yml)
|
|
53
|
+
[](https://github.com/kauevestena/maplibreum_prototype/actions/workflows/deploy-unified-site.yml)
|
|
54
|
+
[](https://pypi.org/project/maplibreum/)
|
|
55
|
+
|
|
56
|
+
# MapLibreum
|
|
57
|
+
|
|
58
|
+
A Python library for creating interactive MapLibre maps, like Folium but for MapLibre.
|
|
59
|
+
|
|
60
|
+
## Installation
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pip install maplibreum
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Development
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pip install -e .
|
|
70
|
+
pytest
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Usage
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
from maplibreum import Map
|
|
77
|
+
|
|
78
|
+
# Create a map centered at a specific location
|
|
79
|
+
m = Map(center=[-23.5505, -46.6333], zoom=10)
|
|
80
|
+
|
|
81
|
+
# Pin a compatible MapLibre GL JS version (defaults to 6.0.0)
|
|
82
|
+
m_custom = Map(maplibre_version="6.0.0")
|
|
83
|
+
|
|
84
|
+
# Add a marker at the map center
|
|
85
|
+
m.add_marker(popup="Hello, MapLibre!")
|
|
86
|
+
|
|
87
|
+
# Or specify coordinates for the marker
|
|
88
|
+
m.add_marker(coordinates=[-23.55, -46.63], popup="Another marker")
|
|
89
|
+
|
|
90
|
+
# Add a heatmap layer from GeoJSON points
|
|
91
|
+
geojson = {"type": "FeatureCollection", "features": []}
|
|
92
|
+
source = {"type": "geojson", "data": geojson}
|
|
93
|
+
m.add_heatmap_layer("heat", source)
|
|
94
|
+
|
|
95
|
+
# Register event callbacks (Jupyter notebooks)
|
|
96
|
+
def handle_click(evt):
|
|
97
|
+
print("Clicked at", evt["lngLat"])
|
|
98
|
+
m.on_click(handle_click)
|
|
99
|
+
|
|
100
|
+
# Enable built-in controls
|
|
101
|
+
m.add_control("geolocate", "top-right", options={"trackUserLocation": True})
|
|
102
|
+
m.add_control(
|
|
103
|
+
"attribution", "bottom-right", options={"customAttribution": "My Data"}
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
# Controls
|
|
107
|
+
from maplibreum.controls import MiniMapControl, MeasureControl, SearchControl
|
|
108
|
+
|
|
109
|
+
# Add a minimap
|
|
110
|
+
m.add_control(MiniMapControl())
|
|
111
|
+
|
|
112
|
+
# Add a measure control
|
|
113
|
+
m.add_measure_control()
|
|
114
|
+
|
|
115
|
+
# Add a search control
|
|
116
|
+
# You will need an API key from a geocoding provider like Maptiler.
|
|
117
|
+
# https://www.maptiler.com/cloud/keys/
|
|
118
|
+
m.add_search_control(SearchControl(provider="maptiler", api_key="YOUR_API_KEY"))
|
|
119
|
+
|
|
120
|
+
# Enable terrain and atmospheric effects
|
|
121
|
+
m.add_dem_source("terrain", "https://example.com/dem.png")
|
|
122
|
+
m.set_terrain("terrain")
|
|
123
|
+
m.add_sky_layer()
|
|
124
|
+
m.set_fog()
|
|
125
|
+
|
|
126
|
+
# Save the map to an HTML file
|
|
127
|
+
m.save("my_map.html")
|
|
128
|
+
|
|
129
|
+
# Switch to an Albers projection and enable RTL/mobile options
|
|
130
|
+
m.set_projection({"name": "albers", "parallels": [29.5, 45.5], "center": [-96, 37.8]})
|
|
131
|
+
m.enable_rtl_text_plugin()
|
|
132
|
+
m.set_mobile_behavior(cooperative_gestures=True, touch_zoom_rotate=False)
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Feature Demonstrations
|
|
136
|
+
|
|
137
|
+
```python
|
|
138
|
+
from maplibreum import (
|
|
139
|
+
Map,
|
|
140
|
+
Choropleth,
|
|
141
|
+
Marker,
|
|
142
|
+
MarkerCluster,
|
|
143
|
+
LayerControl,
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
m = Map()
|
|
147
|
+
|
|
148
|
+
# Choropleth
|
|
149
|
+
Choropleth(geojson_data).add_to(m)
|
|
150
|
+
|
|
151
|
+
# Marker clusters
|
|
152
|
+
cluster = MarkerCluster().add_to(m)
|
|
153
|
+
Marker(coordinates=[0, 0]).add_to(cluster)
|
|
154
|
+
|
|
155
|
+
# Clustered GeoJSON
|
|
156
|
+
m.add_clustered_geojson(geojson_data)
|
|
157
|
+
|
|
158
|
+
# Layer controls
|
|
159
|
+
LayerControl().add_to(m)
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Expressions
|
|
163
|
+
|
|
164
|
+
MapLibre uses array-based expressions for data-driven styling. The
|
|
165
|
+
``maplibreum.expressions`` module provides helpers to construct and
|
|
166
|
+
validate these expressions:
|
|
167
|
+
|
|
168
|
+
```python
|
|
169
|
+
from maplibreum.expressions import get, interpolate, var
|
|
170
|
+
|
|
171
|
+
color = interpolate(
|
|
172
|
+
"linear",
|
|
173
|
+
var("heatmap-density"),
|
|
174
|
+
[(0, "blue"), (1, "red")],
|
|
175
|
+
)
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Example Notebooks
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
jupyter notebook examples
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Live Examples Gallery
|
|
185
|
+
|
|
186
|
+
View interactive examples deployed to GitHub Pages: [MapLibreum Examples Gallery](https://kauevestena.github.io/maplibreum_prototype/)
|
|
187
|
+
|
|
188
|
+
The examples gallery is automatically generated from Jupyter notebooks in the `examples/` folder and showcases:
|
|
189
|
+
- Creative MapLibreum examples and tutorials
|
|
190
|
+
- Basic usage patterns
|
|
191
|
+
- New features demonstrations
|
|
192
|
+
- Event handling and interactions
|
|
193
|
+
|
|
194
|
+
To deploy examples to GitHub Pages, see the
|
|
195
|
+
[GitHub Pages documentation](https://github.com/kauevestena/maplibreum_prototype/blob/main/docs/GITHUB_PAGES.md).
|
|
196
|
+
|
|
197
|
+
## Changelog
|
|
198
|
+
|
|
199
|
+
See the [CHANGELOG](CHANGELOG.md) for a detailed list of updates in each release.
|
|
200
|
+
|
|
201
|
+
## Testing MapLibreum Functionality
|
|
202
|
+
|
|
203
|
+
### Basic Testing
|
|
204
|
+
|
|
205
|
+
Run the core test suite to verify MapLibreum's basic functionality:
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
# Install development dependencies
|
|
209
|
+
pip install -e .
|
|
210
|
+
pip install pytest jupyter
|
|
211
|
+
|
|
212
|
+
# Run all basic tests
|
|
213
|
+
pytest tests/ -v
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Advanced Testing: MapLibre Examples Validation
|
|
217
|
+
|
|
218
|
+
To verify that MapLibreum is working properly and to check feature coverage against MapLibre GL JS, use the comprehensive testing suite in `development/maplibre_examples/`:
|
|
219
|
+
|
|
220
|
+
#### MapLibre Examples Testing Suite
|
|
221
|
+
|
|
222
|
+
The `development/maplibre_examples/` directory contains a systematic testing system that validates MapLibreum's capability to reproduce all official MapLibre GL JS examples. This provides:
|
|
223
|
+
|
|
224
|
+
- **Automated validation** of feature coverage
|
|
225
|
+
- **Regression testing** for new releases
|
|
226
|
+
- **Example conversion** from JavaScript to Python
|
|
227
|
+
- **Performance benchmarking** against reference implementations
|
|
228
|
+
|
|
229
|
+
#### Quick Status Check
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
# Install dependencies for the testing suite
|
|
233
|
+
pip install requests beautifulsoup4
|
|
234
|
+
|
|
235
|
+
# Check current implementation progress
|
|
236
|
+
python -c "
|
|
237
|
+
import json
|
|
238
|
+
with open('development/maplibre_examples/status.json') as f:
|
|
239
|
+
data = json.load(f)
|
|
240
|
+
total = len(data)
|
|
241
|
+
implemented = sum(1 for v in data.values() if v['task_status'])
|
|
242
|
+
print(f'MapLibreum Feature Coverage: {implemented}/{total} ({implemented/total*100:.1f}%)')
|
|
243
|
+
print(f'Total MapLibre examples available: {total}')
|
|
244
|
+
print(f'Examples successfully implemented: {implemented}')
|
|
245
|
+
"
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
#### Running Example Tests
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
# Run all implemented example tests (when available)
|
|
252
|
+
pytest tests/test_examples/ -v
|
|
253
|
+
|
|
254
|
+
# Refresh examples from MapLibre.org (optional)
|
|
255
|
+
python development/maplibre_examples/scrapping.py
|
|
256
|
+
|
|
257
|
+
# Find next example to implement
|
|
258
|
+
python -c "
|
|
259
|
+
import json
|
|
260
|
+
with open('development/maplibre_examples/status.json') as f:
|
|
261
|
+
data = json.load(f)
|
|
262
|
+
for name, info in data.items():
|
|
263
|
+
if not info['task_status']:
|
|
264
|
+
print(f'Next unimplemented example: {name}')
|
|
265
|
+
print(f'MapLibre URL: {info[\"url\"]}')
|
|
266
|
+
break
|
|
267
|
+
"
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
For detailed information about the testing suite, see the
|
|
271
|
+
[MapLibre examples testing guide](https://github.com/kauevestena/maplibreum_prototype/blob/main/development/maplibre_examples/README.md).
|
|
272
|
+
|
|
273
|
+
## Contributing
|
|
274
|
+
|
|
275
|
+
Contributions are welcome! Please see the [issues page](https://github.com/kauevestena/maplibreum_prototype/issues) to see what needs to be done.
|
|
276
|
+
|
|
277
|
+
## License
|
|
278
|
+
|
|
279
|
+
This project is licensed under the MIT License; see the
|
|
280
|
+
[LICENSE](https://github.com/kauevestena/maplibreum_prototype/blob/main/LICENSE)
|
|
281
|
+
for details.
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="branding/logo-dark.svg">
|
|
4
|
+
<img src="branding/logo.svg" alt="MapLibreum logo" width="320">
|
|
5
|
+
</picture>
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
[](https://github.com/kauevestena/maplibreum_prototype/actions/workflows/ci.yml)
|
|
9
|
+
[](https://github.com/kauevestena/maplibreum_prototype/actions/workflows/deploy-unified-site.yml)
|
|
10
|
+
[](https://pypi.org/project/maplibreum/)
|
|
11
|
+
|
|
12
|
+
# MapLibreum
|
|
13
|
+
|
|
14
|
+
A Python library for creating interactive MapLibre maps, like Folium but for MapLibre.
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pip install maplibreum
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Development
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pip install -e .
|
|
26
|
+
pytest
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
from maplibreum import Map
|
|
33
|
+
|
|
34
|
+
# Create a map centered at a specific location
|
|
35
|
+
m = Map(center=[-23.5505, -46.6333], zoom=10)
|
|
36
|
+
|
|
37
|
+
# Pin a compatible MapLibre GL JS version (defaults to 6.0.0)
|
|
38
|
+
m_custom = Map(maplibre_version="6.0.0")
|
|
39
|
+
|
|
40
|
+
# Add a marker at the map center
|
|
41
|
+
m.add_marker(popup="Hello, MapLibre!")
|
|
42
|
+
|
|
43
|
+
# Or specify coordinates for the marker
|
|
44
|
+
m.add_marker(coordinates=[-23.55, -46.63], popup="Another marker")
|
|
45
|
+
|
|
46
|
+
# Add a heatmap layer from GeoJSON points
|
|
47
|
+
geojson = {"type": "FeatureCollection", "features": []}
|
|
48
|
+
source = {"type": "geojson", "data": geojson}
|
|
49
|
+
m.add_heatmap_layer("heat", source)
|
|
50
|
+
|
|
51
|
+
# Register event callbacks (Jupyter notebooks)
|
|
52
|
+
def handle_click(evt):
|
|
53
|
+
print("Clicked at", evt["lngLat"])
|
|
54
|
+
m.on_click(handle_click)
|
|
55
|
+
|
|
56
|
+
# Enable built-in controls
|
|
57
|
+
m.add_control("geolocate", "top-right", options={"trackUserLocation": True})
|
|
58
|
+
m.add_control(
|
|
59
|
+
"attribution", "bottom-right", options={"customAttribution": "My Data"}
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
# Controls
|
|
63
|
+
from maplibreum.controls import MiniMapControl, MeasureControl, SearchControl
|
|
64
|
+
|
|
65
|
+
# Add a minimap
|
|
66
|
+
m.add_control(MiniMapControl())
|
|
67
|
+
|
|
68
|
+
# Add a measure control
|
|
69
|
+
m.add_measure_control()
|
|
70
|
+
|
|
71
|
+
# Add a search control
|
|
72
|
+
# You will need an API key from a geocoding provider like Maptiler.
|
|
73
|
+
# https://www.maptiler.com/cloud/keys/
|
|
74
|
+
m.add_search_control(SearchControl(provider="maptiler", api_key="YOUR_API_KEY"))
|
|
75
|
+
|
|
76
|
+
# Enable terrain and atmospheric effects
|
|
77
|
+
m.add_dem_source("terrain", "https://example.com/dem.png")
|
|
78
|
+
m.set_terrain("terrain")
|
|
79
|
+
m.add_sky_layer()
|
|
80
|
+
m.set_fog()
|
|
81
|
+
|
|
82
|
+
# Save the map to an HTML file
|
|
83
|
+
m.save("my_map.html")
|
|
84
|
+
|
|
85
|
+
# Switch to an Albers projection and enable RTL/mobile options
|
|
86
|
+
m.set_projection({"name": "albers", "parallels": [29.5, 45.5], "center": [-96, 37.8]})
|
|
87
|
+
m.enable_rtl_text_plugin()
|
|
88
|
+
m.set_mobile_behavior(cooperative_gestures=True, touch_zoom_rotate=False)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Feature Demonstrations
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
from maplibreum import (
|
|
95
|
+
Map,
|
|
96
|
+
Choropleth,
|
|
97
|
+
Marker,
|
|
98
|
+
MarkerCluster,
|
|
99
|
+
LayerControl,
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
m = Map()
|
|
103
|
+
|
|
104
|
+
# Choropleth
|
|
105
|
+
Choropleth(geojson_data).add_to(m)
|
|
106
|
+
|
|
107
|
+
# Marker clusters
|
|
108
|
+
cluster = MarkerCluster().add_to(m)
|
|
109
|
+
Marker(coordinates=[0, 0]).add_to(cluster)
|
|
110
|
+
|
|
111
|
+
# Clustered GeoJSON
|
|
112
|
+
m.add_clustered_geojson(geojson_data)
|
|
113
|
+
|
|
114
|
+
# Layer controls
|
|
115
|
+
LayerControl().add_to(m)
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Expressions
|
|
119
|
+
|
|
120
|
+
MapLibre uses array-based expressions for data-driven styling. The
|
|
121
|
+
``maplibreum.expressions`` module provides helpers to construct and
|
|
122
|
+
validate these expressions:
|
|
123
|
+
|
|
124
|
+
```python
|
|
125
|
+
from maplibreum.expressions import get, interpolate, var
|
|
126
|
+
|
|
127
|
+
color = interpolate(
|
|
128
|
+
"linear",
|
|
129
|
+
var("heatmap-density"),
|
|
130
|
+
[(0, "blue"), (1, "red")],
|
|
131
|
+
)
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Example Notebooks
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
jupyter notebook examples
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Live Examples Gallery
|
|
141
|
+
|
|
142
|
+
View interactive examples deployed to GitHub Pages: [MapLibreum Examples Gallery](https://kauevestena.github.io/maplibreum_prototype/)
|
|
143
|
+
|
|
144
|
+
The examples gallery is automatically generated from Jupyter notebooks in the `examples/` folder and showcases:
|
|
145
|
+
- Creative MapLibreum examples and tutorials
|
|
146
|
+
- Basic usage patterns
|
|
147
|
+
- New features demonstrations
|
|
148
|
+
- Event handling and interactions
|
|
149
|
+
|
|
150
|
+
To deploy examples to GitHub Pages, see the
|
|
151
|
+
[GitHub Pages documentation](https://github.com/kauevestena/maplibreum_prototype/blob/main/docs/GITHUB_PAGES.md).
|
|
152
|
+
|
|
153
|
+
## Changelog
|
|
154
|
+
|
|
155
|
+
See the [CHANGELOG](CHANGELOG.md) for a detailed list of updates in each release.
|
|
156
|
+
|
|
157
|
+
## Testing MapLibreum Functionality
|
|
158
|
+
|
|
159
|
+
### Basic Testing
|
|
160
|
+
|
|
161
|
+
Run the core test suite to verify MapLibreum's basic functionality:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
# Install development dependencies
|
|
165
|
+
pip install -e .
|
|
166
|
+
pip install pytest jupyter
|
|
167
|
+
|
|
168
|
+
# Run all basic tests
|
|
169
|
+
pytest tests/ -v
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Advanced Testing: MapLibre Examples Validation
|
|
173
|
+
|
|
174
|
+
To verify that MapLibreum is working properly and to check feature coverage against MapLibre GL JS, use the comprehensive testing suite in `development/maplibre_examples/`:
|
|
175
|
+
|
|
176
|
+
#### MapLibre Examples Testing Suite
|
|
177
|
+
|
|
178
|
+
The `development/maplibre_examples/` directory contains a systematic testing system that validates MapLibreum's capability to reproduce all official MapLibre GL JS examples. This provides:
|
|
179
|
+
|
|
180
|
+
- **Automated validation** of feature coverage
|
|
181
|
+
- **Regression testing** for new releases
|
|
182
|
+
- **Example conversion** from JavaScript to Python
|
|
183
|
+
- **Performance benchmarking** against reference implementations
|
|
184
|
+
|
|
185
|
+
#### Quick Status Check
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
# Install dependencies for the testing suite
|
|
189
|
+
pip install requests beautifulsoup4
|
|
190
|
+
|
|
191
|
+
# Check current implementation progress
|
|
192
|
+
python -c "
|
|
193
|
+
import json
|
|
194
|
+
with open('development/maplibre_examples/status.json') as f:
|
|
195
|
+
data = json.load(f)
|
|
196
|
+
total = len(data)
|
|
197
|
+
implemented = sum(1 for v in data.values() if v['task_status'])
|
|
198
|
+
print(f'MapLibreum Feature Coverage: {implemented}/{total} ({implemented/total*100:.1f}%)')
|
|
199
|
+
print(f'Total MapLibre examples available: {total}')
|
|
200
|
+
print(f'Examples successfully implemented: {implemented}')
|
|
201
|
+
"
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
#### Running Example Tests
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
# Run all implemented example tests (when available)
|
|
208
|
+
pytest tests/test_examples/ -v
|
|
209
|
+
|
|
210
|
+
# Refresh examples from MapLibre.org (optional)
|
|
211
|
+
python development/maplibre_examples/scrapping.py
|
|
212
|
+
|
|
213
|
+
# Find next example to implement
|
|
214
|
+
python -c "
|
|
215
|
+
import json
|
|
216
|
+
with open('development/maplibre_examples/status.json') as f:
|
|
217
|
+
data = json.load(f)
|
|
218
|
+
for name, info in data.items():
|
|
219
|
+
if not info['task_status']:
|
|
220
|
+
print(f'Next unimplemented example: {name}')
|
|
221
|
+
print(f'MapLibre URL: {info[\"url\"]}')
|
|
222
|
+
break
|
|
223
|
+
"
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
For detailed information about the testing suite, see the
|
|
227
|
+
[MapLibre examples testing guide](https://github.com/kauevestena/maplibreum_prototype/blob/main/development/maplibre_examples/README.md).
|
|
228
|
+
|
|
229
|
+
## Contributing
|
|
230
|
+
|
|
231
|
+
Contributions are welcome! Please see the [issues page](https://github.com/kauevestena/maplibreum_prototype/issues) to see what needs to be done.
|
|
232
|
+
|
|
233
|
+
## License
|
|
234
|
+
|
|
235
|
+
This project is licensed under the MIT License; see the
|
|
236
|
+
[LICENSE](https://github.com/kauevestena/maplibreum_prototype/blob/main/LICENSE)
|
|
237
|
+
for details.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
from ._version import __version__
|
|
2
|
+
from .babylon import BabylonLayer
|
|
3
|
+
from .three import ThreeLayer
|
|
4
|
+
from .choropleth import Choropleth
|
|
5
|
+
from .cluster import ClusteredGeoJson, MarkerCluster, cluster_features
|
|
6
|
+
from .core import (GeoJson, GeoJsonPopup, GeoJsonTooltip, LayerControl,
|
|
7
|
+
MAPLIBRE_VERSION, LatLngPopup, Legend, Map, Marker, Popup,
|
|
8
|
+
StateToggle, Tooltip)
|
|
9
|
+
from .overlays import ImageOverlay, VideoOverlay
|
|
10
|
+
from .markers import BeautifyIcon, DivIcon, Icon
|
|
11
|
+
from .animation import AnimationLoop, TemporalInterval
|
|
12
|
+
from .timedimension import TimeDimension
|
|
13
|
+
from .controls import StorytellingControl, StyleSwitcherControl
|
|
14
|
+
from . import controls
|
|
15
|
+
from . import sources
|
|
16
|
+
from . import layers
|
|
17
|
+
from . import experimental
|
|
18
|
+
from .custom import CustomGlobeLayer
|
|
19
|
+
from .protocols import PMTilesProtocol, PMTilesSource
|
|
20
|
+
|
|
21
|
+
__all__ = [
|
|
22
|
+
"Map",
|
|
23
|
+
"MAPLIBRE_VERSION",
|
|
24
|
+
"PMTilesProtocol",
|
|
25
|
+
"PMTilesSource",
|
|
26
|
+
"Marker",
|
|
27
|
+
"GeoJson",
|
|
28
|
+
"Legend",
|
|
29
|
+
"LayerControl",
|
|
30
|
+
"Choropleth",
|
|
31
|
+
"Icon",
|
|
32
|
+
"DivIcon",
|
|
33
|
+
"BeautifyIcon",
|
|
34
|
+
"ImageOverlay",
|
|
35
|
+
"VideoOverlay",
|
|
36
|
+
"Tooltip",
|
|
37
|
+
"GeoJsonPopup",
|
|
38
|
+
"GeoJsonTooltip",
|
|
39
|
+
"LatLngPopup",
|
|
40
|
+
"Popup",
|
|
41
|
+
"StateToggle",
|
|
42
|
+
"TimeDimension",
|
|
43
|
+
"MarkerCluster",
|
|
44
|
+
"ClusteredGeoJson",
|
|
45
|
+
"cluster_features",
|
|
46
|
+
"__version__",
|
|
47
|
+
"StorytellingControl",
|
|
48
|
+
"StyleSwitcherControl",
|
|
49
|
+
"controls",
|
|
50
|
+
"sources",
|
|
51
|
+
"layers",
|
|
52
|
+
"AnimationLoop",
|
|
53
|
+
"TemporalInterval",
|
|
54
|
+
"CustomGlobeLayer",
|
|
55
|
+
"PMTilesProtocol",
|
|
56
|
+
"PMTilesSource",
|
|
57
|
+
]
|