mapyta 0.1.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.
- mapyta-0.1.0/.github/workflows/docs.yml +36 -0
- mapyta-0.1.0/.github/workflows/lint.yml +29 -0
- mapyta-0.1.0/.github/workflows/publish.yml +26 -0
- mapyta-0.1.0/.github/workflows/tests.yml +23 -0
- mapyta-0.1.0/.gitignore +12 -0
- mapyta-0.1.0/.pre-commit-config.yaml +29 -0
- mapyta-0.1.0/.ruff.toml +90 -0
- mapyta-0.1.0/LICENSE +21 -0
- mapyta-0.1.0/PKG-INFO +171 -0
- mapyta-0.1.0/README.md +147 -0
- mapyta-0.1.0/docs/.nav.yml +4 -0
- mapyta-0.1.0/docs/_overrides/assets/images/favicon.ico +0 -0
- mapyta-0.1.0/docs/_overrides/assets/images/logo-dark-mode.svg +40 -0
- mapyta-0.1.0/docs/_overrides/assets/images/mapyta-logo-dark-mode.svg +49 -0
- mapyta-0.1.0/docs/_overrides/assets/images/mapyta-logo-light-mode.svg +49 -0
- mapyta-0.1.0/docs/_overrides/assets/javascripts/katex.js +11 -0
- mapyta-0.1.0/docs/_overrides/assets/stylesheets/extra.css +71 -0
- mapyta-0.1.0/docs/_overrides/main.html +1 -0
- mapyta-0.1.0/docs/_scripts/__init__.py +1 -0
- mapyta-0.1.0/docs/_scripts/generate_index.py +41 -0
- mapyta-0.1.0/docs/_scripts/generate_reference_pages.py +56 -0
- mapyta-0.1.0/docs/tutorial/.nav.yml +17 -0
- mapyta-0.1.0/docs/tutorial/advanced.md +83 -0
- mapyta-0.1.0/docs/tutorial/choropleth.md +65 -0
- mapyta-0.1.0/docs/tutorial/clusters.md +38 -0
- mapyta-0.1.0/docs/tutorial/configuration.md +93 -0
- mapyta-0.1.0/docs/tutorial/coordinates.md +36 -0
- mapyta-0.1.0/docs/tutorial/drawing.md +112 -0
- mapyta-0.1.0/docs/tutorial/export.md +70 -0
- mapyta-0.1.0/docs/tutorial/first-map.md +46 -0
- mapyta-0.1.0/docs/tutorial/geodataframe.md +60 -0
- mapyta-0.1.0/docs/tutorial/geometries.md +104 -0
- mapyta-0.1.0/docs/tutorial/heatmaps.md +43 -0
- mapyta-0.1.0/docs/tutorial/index.md +33 -0
- mapyta-0.1.0/docs/tutorial/layers.md +44 -0
- mapyta-0.1.0/docs/tutorial/markers.md +64 -0
- mapyta-0.1.0/docs/tutorial/text-annotations.md +75 -0
- mapyta-0.1.0/docs/tutorial/tooltips-popups.md +63 -0
- mapyta-0.1.0/mapyta/__init__.py +19 -0
- mapyta-0.1.0/mapyta/config.py +225 -0
- mapyta-0.1.0/mapyta/coordinates.py +92 -0
- mapyta-0.1.0/mapyta/export.py +103 -0
- mapyta-0.1.0/mapyta/geojson.py +31 -0
- mapyta-0.1.0/mapyta/map.py +1846 -0
- mapyta-0.1.0/mapyta/markdown.py +67 -0
- mapyta-0.1.0/mapyta/markers.py +164 -0
- mapyta-0.1.0/mapyta/style.py +36 -0
- mapyta-0.1.0/mapyta/tiles.py +83 -0
- mapyta-0.1.0/properdocs.yml +135 -0
- mapyta-0.1.0/pyproject.toml +76 -0
- mapyta-0.1.0/tests/__init__.py +1 -0
- mapyta-0.1.0/tests/conftest.py +79 -0
- mapyta-0.1.0/tests/test_data.py +891 -0
- mapyta-0.1.0/tests/test_draw.py +583 -0
- mapyta-0.1.0/tests/test_export.py +642 -0
- mapyta-0.1.0/tests/test_geometry.py +390 -0
- mapyta-0.1.0/tests/test_layers.py +631 -0
- mapyta-0.1.0/tests/test_map.py +4880 -0
- mapyta-0.1.0/tests/test_map_creation.py +378 -0
- mapyta-0.1.0/tests/test_markers.py +501 -0
- mapyta-0.1.0/tests/test_merge_and_chaining.py +164 -0
- mapyta-0.1.0/tests/test_utilities.py +1417 -0
- mapyta-0.1.0/uv.lock +1824 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
name: Publish docs
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
pages: write
|
|
10
|
+
id-token: write
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
docs:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
environment:
|
|
16
|
+
name: github-pages
|
|
17
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- uses: astral-sh/setup-uv@v5
|
|
22
|
+
with:
|
|
23
|
+
python-version: "3.13"
|
|
24
|
+
|
|
25
|
+
- name: Install docs dependencies
|
|
26
|
+
run: uv sync --group docs
|
|
27
|
+
|
|
28
|
+
- name: Build docs
|
|
29
|
+
run: uv run properdocs build --clean
|
|
30
|
+
|
|
31
|
+
- uses: actions/upload-pages-artifact@v3
|
|
32
|
+
with:
|
|
33
|
+
path: site/
|
|
34
|
+
|
|
35
|
+
- id: deployment
|
|
36
|
+
uses: actions/deploy-pages@v4
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: Lint
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
lint:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
|
|
15
|
+
- uses: astral-sh/setup-uv@v5
|
|
16
|
+
with:
|
|
17
|
+
python-version: "3.13"
|
|
18
|
+
|
|
19
|
+
- name: Install dependencies
|
|
20
|
+
run: uv sync --group dev
|
|
21
|
+
|
|
22
|
+
- name: Check formatting
|
|
23
|
+
run: uv run ruff format --check .
|
|
24
|
+
|
|
25
|
+
- name: Lint
|
|
26
|
+
run: uv run ruff check .
|
|
27
|
+
|
|
28
|
+
- name: Type check
|
|
29
|
+
run: uv run ty check mapyta
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
id-token: write
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
publish:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
environment: pypi
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- uses: astral-sh/setup-uv@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: "3.13"
|
|
21
|
+
|
|
22
|
+
- name: Build package
|
|
23
|
+
run: uv build
|
|
24
|
+
|
|
25
|
+
- name: Publish to PyPI
|
|
26
|
+
run: uv publish
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
tests:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
|
|
15
|
+
- uses: astral-sh/setup-uv@v5
|
|
16
|
+
with:
|
|
17
|
+
python-version: "3.13"
|
|
18
|
+
|
|
19
|
+
- name: Install dependencies
|
|
20
|
+
run: uv sync --group test
|
|
21
|
+
|
|
22
|
+
- name: Run tests with coverage
|
|
23
|
+
run: uv run pytest --cov-fail-under=100
|
mapyta-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# .pre-commit-config.yaml
|
|
2
|
+
# This file configures the pre-commit hooks that will be run before each commit.
|
|
3
|
+
# See https://pre-commit.com for more information.
|
|
4
|
+
# See https://pre-commit.com/hooks.html for more hooks.
|
|
5
|
+
|
|
6
|
+
# To use these hooks:
|
|
7
|
+
# 1. Install pre-commit (https://pre-commit.com/#install).
|
|
8
|
+
# In most cases, this will involve running `pip install pre-commit`.
|
|
9
|
+
# 2. In your terminal, navigate to your repository and run `pre-commit install`.
|
|
10
|
+
# This will install the hooks.
|
|
11
|
+
# 3. Now, the hooks will automatically run every time you try to make a commit.
|
|
12
|
+
# If any of the hooks fail, the commit will be aborted.
|
|
13
|
+
# 4. If a hook fails and you see errors, fix them and try to commit again.
|
|
14
|
+
# The hooks will run again and the commit will only be made if they all pass.
|
|
15
|
+
# 5. If you want to manually run all hooks on all files, run `pre-commit run --all-files`.
|
|
16
|
+
# 6. To update to the latest versions of the hooks, run `pre-commit autoupdate`.
|
|
17
|
+
|
|
18
|
+
repos:
|
|
19
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
20
|
+
rev: v0.12.4
|
|
21
|
+
hooks:
|
|
22
|
+
# Run the linter.
|
|
23
|
+
- id: ruff-check
|
|
24
|
+
args: [ --fix ]
|
|
25
|
+
# Run the formatter.
|
|
26
|
+
- id: ruff-format
|
|
27
|
+
|
|
28
|
+
# As of january 2026, ty does not have an official pre-commit hook.
|
|
29
|
+
# We will add it here once it is available.
|
mapyta-0.1.0/.ruff.toml
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
line-length = 150
|
|
2
|
+
|
|
3
|
+
[lint]
|
|
4
|
+
select = [
|
|
5
|
+
"F", # pyflakes
|
|
6
|
+
"E", # pycodestyle (Errors)
|
|
7
|
+
"W", # pycodestyle (Warnings)
|
|
8
|
+
"C90", # mccabe (complexity)
|
|
9
|
+
"I", # isort
|
|
10
|
+
"N", # pep8 naming
|
|
11
|
+
"D", # pydocstyle
|
|
12
|
+
"UP", # pyupgrade
|
|
13
|
+
"ANN", # flake8-annotations
|
|
14
|
+
"ASYNC", # flake8-async
|
|
15
|
+
"A", # flake8-builtins
|
|
16
|
+
"COM", # flake8-commas
|
|
17
|
+
"C4", # flake8-comprehensions
|
|
18
|
+
"DTZ", # flake8-datetimez
|
|
19
|
+
"EXE", # flake8-executable
|
|
20
|
+
"ISC", # flake8-implicit-str-concat
|
|
21
|
+
"ICN", # flake8-import-conventions
|
|
22
|
+
"INP", # flake8-no-pep420
|
|
23
|
+
"PIE", # flake8-pie
|
|
24
|
+
"T20", # flake8-print
|
|
25
|
+
"PYI", # flake8-pyi
|
|
26
|
+
"PT", # flake8-pytest-style
|
|
27
|
+
"Q", # flake8-quotes
|
|
28
|
+
"RSE", # flake8-raise
|
|
29
|
+
"RET", # flake8-return
|
|
30
|
+
"SLF", # flake8-self
|
|
31
|
+
"SLOT", # flake8-slot
|
|
32
|
+
"SIM", # flake8-simplify
|
|
33
|
+
"TID", # flake8-tidy-imports
|
|
34
|
+
"INT", # flake8-gettext
|
|
35
|
+
"ARG", # flake8-unused-arguments
|
|
36
|
+
"TD", # flake8-todos
|
|
37
|
+
"FIX", # flake8-fixme
|
|
38
|
+
"ERA", # eradicate
|
|
39
|
+
"PD", # pandas-vet
|
|
40
|
+
"PGH", # pygrep-hooks
|
|
41
|
+
"PL", # pylint
|
|
42
|
+
"TRY", # tryceratops
|
|
43
|
+
"FLY", # flyint
|
|
44
|
+
"NPY", # NumPy-specific rules
|
|
45
|
+
"AIR", # Airflow
|
|
46
|
+
"PERF", # Perflint
|
|
47
|
+
"RUF", # Ruff-specific rules
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
ignore = [
|
|
51
|
+
# pydocstyle
|
|
52
|
+
"D205", # blank-line-after-summary
|
|
53
|
+
"D401", # non-imperative-mood
|
|
54
|
+
|
|
55
|
+
# flake8-annotations
|
|
56
|
+
"ANN002", # missing-type-args
|
|
57
|
+
"ANN003", # missing-type-kwargs
|
|
58
|
+
|
|
59
|
+
# flake8-pytest-style
|
|
60
|
+
"PT011", # pytest-raises-too-broad
|
|
61
|
+
|
|
62
|
+
# flake8-implicit-str-concat
|
|
63
|
+
"ISC001", # single-line-implicit-string-concatenation
|
|
64
|
+
|
|
65
|
+
# flake8-commas
|
|
66
|
+
"COM812", # missing-trailing-comma
|
|
67
|
+
|
|
68
|
+
# pylint
|
|
69
|
+
"PLR2004", # magic-value-comparison
|
|
70
|
+
|
|
71
|
+
# tryceratops
|
|
72
|
+
"TRY003", # raise-vanilla-args
|
|
73
|
+
|
|
74
|
+
# Ruff-specific rules
|
|
75
|
+
"RUF002", # ambiguous-unicode-character-docstring
|
|
76
|
+
"RUF003", # ambiguous-unicode-character-comment
|
|
77
|
+
]
|
|
78
|
+
[lint.per-file-ignores]
|
|
79
|
+
"docs/*" = ["T201"]
|
|
80
|
+
|
|
81
|
+
[format]
|
|
82
|
+
quote-style = "double"
|
|
83
|
+
indent-style = "space"
|
|
84
|
+
docstring-code-format = true
|
|
85
|
+
|
|
86
|
+
[lint.pylint]
|
|
87
|
+
max-args = 10
|
|
88
|
+
|
|
89
|
+
[lint.pydocstyle]
|
|
90
|
+
convention = "numpy"
|
mapyta-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright Β© 2026 Mapyta - Enrique GarcΓa
|
|
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.
|
mapyta-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mapyta
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Mapyta, open source python package for GIS mapping and visualization.
|
|
5
|
+
License: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Keywords: GIS,mapping,visualization
|
|
8
|
+
Classifier: Intended Audience :: Science/Research
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
13
|
+
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
15
|
+
Requires-Python: >=3.12
|
|
16
|
+
Requires-Dist: folium>=0.20.0
|
|
17
|
+
Requires-Dist: geopandas>=1.1.3
|
|
18
|
+
Requires-Dist: pyproj>=3.7.2
|
|
19
|
+
Requires-Dist: shapely>=2.1.2
|
|
20
|
+
Provides-Extra: export
|
|
21
|
+
Requires-Dist: chromedriver-autoinstaller>=0.6.0; extra == 'export'
|
|
22
|
+
Requires-Dist: selenium>=4.0.0; extra == 'export'
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
<p align="center">
|
|
26
|
+
<a href="https://egarciamendez.github.io/mapyta">
|
|
27
|
+
<img src="https://egarciamendez.github.io/mapyta/_overrides/assets/images/mapyta-logo-light-mode.svg" alt="Mapyta">
|
|
28
|
+
</a>
|
|
29
|
+
</p>
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
**Documentation**: [https://egarciamendez.github.io/mapyta](https://egarciamendez.github.io/mapyta)
|
|
34
|
+
|
|
35
|
+
**Source Code**: [https://github.com/egarciamendez/mapyta](https://github.com/egarciamendez/mapyta)
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
**One import. A few method calls. A full interactive map.**
|
|
41
|
+
|
|
42
|
+
Build OpenStreetMap visualizations with hover tooltips, choropleths, heatmaps, and export to HTML or PNG all from Shapely geometries.
|
|
43
|
+
|
|
44
|
+
Perfect for geotechnical site plans, infrastructure overviews, or any spatial data visualization where you want more control than static images but don't need the full power of a GIS.
|
|
45
|
+
|
|
46
|
+
*Mapyta is standing on the shoulders of giants like Folium and Leaflet, but it's designed to be more intuitive and
|
|
47
|
+
Pythonic for users who are already familiar with Shapely and GeoPandas. It's not trying to replace a full GIS,
|
|
48
|
+
but rather to provide a simple way to create interactive maps without needing to learn a whole new set of tools.*
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
**Key features:**
|
|
53
|
+
|
|
54
|
+
- πΊοΈ **Shapely-native** β pass `Point`, `Polygon`, `LineString` directly, including multi-geometries
|
|
55
|
+
- π **Markdown/HTML hover and popup text** β bold, italic, links, lists, and code in tooltips
|
|
56
|
+
- π **Emoji & icon markers** β any text or Font Awesome icons as markers
|
|
57
|
+
- π¨ **Choropleth & heatmaps** β color-coded maps from numeric data
|
|
58
|
+
- π **GeoPandas integration** β `Map.from_geodataframe()` one-liner
|
|
59
|
+
- π **Auto CRS detection** β RD New (EPSG:28992) coordinates transform automatically
|
|
60
|
+
- π€ **Export anywhere** β HTML, PNG, SVG, async variants, and `BytesIO` buffers
|
|
61
|
+
- π§© **Feature groups** β toggleable layers with a built-in layer control
|
|
62
|
+
- π **Set of tile providers** β OpenStreetMap, CartoDB, Esri, Stamen, and Kadaster
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
??? example "Full example for power users"
|
|
67
|
+
|
|
68
|
+
Complete map with points, lines, polygons, popups, feature groups, layer control, and HTML export in one block.
|
|
69
|
+
Everything below this fold explains each piece step by step.
|
|
70
|
+
|
|
71
|
+
```python exec="true" html="true" source="tabbed-right"
|
|
72
|
+
from shapely.geometry import Point, LineString, Polygon
|
|
73
|
+
from mapyta import Map, MapConfig
|
|
74
|
+
|
|
75
|
+
m = Map(
|
|
76
|
+
title="Amsterdam Overview",
|
|
77
|
+
config=MapConfig(
|
|
78
|
+
tile_layer=["cartodb_positron", "cartodb_dark"],
|
|
79
|
+
fullscreen=True,
|
|
80
|
+
minimap=True,
|
|
81
|
+
measure_control=True,
|
|
82
|
+
mouse_position=True,
|
|
83
|
+
),
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
# Feature group: landmarks
|
|
87
|
+
m.create_feature_group("ποΈ Landmarks")
|
|
88
|
+
m.add_point(
|
|
89
|
+
point=Point(4.9041, 52.3676),
|
|
90
|
+
marker="ποΈ",
|
|
91
|
+
tooltip="**Royal Palace**",
|
|
92
|
+
popup="**Royal Palace**\nDam Square, Amsterdam\nBuilt: 1665",
|
|
93
|
+
popup_style={"width": 300, "height": 120},
|
|
94
|
+
)
|
|
95
|
+
m.add_point(
|
|
96
|
+
point=Point(4.8834, 52.3667),
|
|
97
|
+
marker="π",
|
|
98
|
+
tooltip="**Anne Frank House**",
|
|
99
|
+
popup="**Anne Frank House**\nPrinsengracht 263\nVisitors/year: ~1.3 million",
|
|
100
|
+
popup_style={"width": 300, "height": 120},
|
|
101
|
+
)
|
|
102
|
+
m.add_point(
|
|
103
|
+
point=Point(4.8795, 52.3600),
|
|
104
|
+
marker="fa-landmark",
|
|
105
|
+
tooltip="**Rijksmuseum**",
|
|
106
|
+
popup="**Rijksmuseum**\nDutch art and history since 1800",
|
|
107
|
+
marker_style={"font-size": "24px", "color": "green"},
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
# Feature group: areas
|
|
111
|
+
m.create_feature_group("π Areas of Interest")
|
|
112
|
+
m.add_polygon(
|
|
113
|
+
polygon=Polygon([(4.876, 52.372), (4.889, 52.372), (4.889, 52.380), (4.876, 52.380)]),
|
|
114
|
+
tooltip="**De Jordaan**\nHistoric neighbourhood",
|
|
115
|
+
popup="**De Jordaan**\n\n- Narrow streets\n- Independent galleries\n- Brown cafΓ©s",
|
|
116
|
+
stroke={"color": "green", "weight": 2},
|
|
117
|
+
fill={"color": "blue", "opacity": 0.15},
|
|
118
|
+
popup_style={"width": 300, "height": 180},
|
|
119
|
+
)
|
|
120
|
+
m.add_linestring(
|
|
121
|
+
line=LineString([(4.8852, 52.3702), (4.8910, 52.3663), (4.8932, 52.3631), (4.884, 52.3569)]),
|
|
122
|
+
tooltip="**Walking route**\n*Centraal β Leidseplein*",
|
|
123
|
+
stroke={"color": "red", "weight": 4, "dash_array": "10 6"},
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
m.reset_target()
|
|
127
|
+
m.add_circle(
|
|
128
|
+
point=Point(4.8812, 52.3584),
|
|
129
|
+
tooltip="**Van Gogh Museum**",
|
|
130
|
+
style={"radius": 12, "stroke": {"color": "green", "weight": 2}, "fill": {"color": "orange", "opacity": 0.5}},
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
m.add_layer_control(collapsed=False)
|
|
134
|
+
m.set_bounds(padding=0.005)
|
|
135
|
+
|
|
136
|
+
print(m.to_html()) # markdown-exec: hide
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Quickstart
|
|
140
|
+
|
|
141
|
+
Install mapyta:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
uv add mapyta
|
|
145
|
+
# or
|
|
146
|
+
pip install mapyta
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Create your first map:
|
|
150
|
+
|
|
151
|
+
```python exec="true" html="true" source="tabbed-right"
|
|
152
|
+
from shapely.geometry import Point
|
|
153
|
+
from mapyta import Map
|
|
154
|
+
|
|
155
|
+
m = Map(title="Hello Amsterdam")
|
|
156
|
+
m.add_point(
|
|
157
|
+
point=Point(4.9041, 52.3676),
|
|
158
|
+
tooltip="**Amsterdam**",
|
|
159
|
+
popup="Capital city of the Netherlands.",
|
|
160
|
+
caption="AMS",
|
|
161
|
+
)
|
|
162
|
+
m.to_html("hello.html")
|
|
163
|
+
|
|
164
|
+
print(m.to_html()) # markdown-exec: hide
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Open `hello.html` in any browser and you're done.
|
|
168
|
+
|
|
169
|
+
## License
|
|
170
|
+
|
|
171
|
+
This project is licensed under the terms of the MIT license.
|
mapyta-0.1.0/README.md
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://egarciamendez.github.io/mapyta">
|
|
3
|
+
<img src="https://egarciamendez.github.io/mapyta/_overrides/assets/images/mapyta-logo-light-mode.svg" alt="Mapyta">
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
**Documentation**: [https://egarciamendez.github.io/mapyta](https://egarciamendez.github.io/mapyta)
|
|
10
|
+
|
|
11
|
+
**Source Code**: [https://github.com/egarciamendez/mapyta](https://github.com/egarciamendez/mapyta)
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
**One import. A few method calls. A full interactive map.**
|
|
17
|
+
|
|
18
|
+
Build OpenStreetMap visualizations with hover tooltips, choropleths, heatmaps, and export to HTML or PNG all from Shapely geometries.
|
|
19
|
+
|
|
20
|
+
Perfect for geotechnical site plans, infrastructure overviews, or any spatial data visualization where you want more control than static images but don't need the full power of a GIS.
|
|
21
|
+
|
|
22
|
+
*Mapyta is standing on the shoulders of giants like Folium and Leaflet, but it's designed to be more intuitive and
|
|
23
|
+
Pythonic for users who are already familiar with Shapely and GeoPandas. It's not trying to replace a full GIS,
|
|
24
|
+
but rather to provide a simple way to create interactive maps without needing to learn a whole new set of tools.*
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
**Key features:**
|
|
29
|
+
|
|
30
|
+
- πΊοΈ **Shapely-native** β pass `Point`, `Polygon`, `LineString` directly, including multi-geometries
|
|
31
|
+
- π **Markdown/HTML hover and popup text** β bold, italic, links, lists, and code in tooltips
|
|
32
|
+
- π **Emoji & icon markers** β any text or Font Awesome icons as markers
|
|
33
|
+
- π¨ **Choropleth & heatmaps** β color-coded maps from numeric data
|
|
34
|
+
- π **GeoPandas integration** β `Map.from_geodataframe()` one-liner
|
|
35
|
+
- π **Auto CRS detection** β RD New (EPSG:28992) coordinates transform automatically
|
|
36
|
+
- π€ **Export anywhere** β HTML, PNG, SVG, async variants, and `BytesIO` buffers
|
|
37
|
+
- π§© **Feature groups** β toggleable layers with a built-in layer control
|
|
38
|
+
- π **Set of tile providers** β OpenStreetMap, CartoDB, Esri, Stamen, and Kadaster
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
??? example "Full example for power users"
|
|
43
|
+
|
|
44
|
+
Complete map with points, lines, polygons, popups, feature groups, layer control, and HTML export in one block.
|
|
45
|
+
Everything below this fold explains each piece step by step.
|
|
46
|
+
|
|
47
|
+
```python exec="true" html="true" source="tabbed-right"
|
|
48
|
+
from shapely.geometry import Point, LineString, Polygon
|
|
49
|
+
from mapyta import Map, MapConfig
|
|
50
|
+
|
|
51
|
+
m = Map(
|
|
52
|
+
title="Amsterdam Overview",
|
|
53
|
+
config=MapConfig(
|
|
54
|
+
tile_layer=["cartodb_positron", "cartodb_dark"],
|
|
55
|
+
fullscreen=True,
|
|
56
|
+
minimap=True,
|
|
57
|
+
measure_control=True,
|
|
58
|
+
mouse_position=True,
|
|
59
|
+
),
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
# Feature group: landmarks
|
|
63
|
+
m.create_feature_group("ποΈ Landmarks")
|
|
64
|
+
m.add_point(
|
|
65
|
+
point=Point(4.9041, 52.3676),
|
|
66
|
+
marker="ποΈ",
|
|
67
|
+
tooltip="**Royal Palace**",
|
|
68
|
+
popup="**Royal Palace**\nDam Square, Amsterdam\nBuilt: 1665",
|
|
69
|
+
popup_style={"width": 300, "height": 120},
|
|
70
|
+
)
|
|
71
|
+
m.add_point(
|
|
72
|
+
point=Point(4.8834, 52.3667),
|
|
73
|
+
marker="π",
|
|
74
|
+
tooltip="**Anne Frank House**",
|
|
75
|
+
popup="**Anne Frank House**\nPrinsengracht 263\nVisitors/year: ~1.3 million",
|
|
76
|
+
popup_style={"width": 300, "height": 120},
|
|
77
|
+
)
|
|
78
|
+
m.add_point(
|
|
79
|
+
point=Point(4.8795, 52.3600),
|
|
80
|
+
marker="fa-landmark",
|
|
81
|
+
tooltip="**Rijksmuseum**",
|
|
82
|
+
popup="**Rijksmuseum**\nDutch art and history since 1800",
|
|
83
|
+
marker_style={"font-size": "24px", "color": "green"},
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
# Feature group: areas
|
|
87
|
+
m.create_feature_group("π Areas of Interest")
|
|
88
|
+
m.add_polygon(
|
|
89
|
+
polygon=Polygon([(4.876, 52.372), (4.889, 52.372), (4.889, 52.380), (4.876, 52.380)]),
|
|
90
|
+
tooltip="**De Jordaan**\nHistoric neighbourhood",
|
|
91
|
+
popup="**De Jordaan**\n\n- Narrow streets\n- Independent galleries\n- Brown cafΓ©s",
|
|
92
|
+
stroke={"color": "green", "weight": 2},
|
|
93
|
+
fill={"color": "blue", "opacity": 0.15},
|
|
94
|
+
popup_style={"width": 300, "height": 180},
|
|
95
|
+
)
|
|
96
|
+
m.add_linestring(
|
|
97
|
+
line=LineString([(4.8852, 52.3702), (4.8910, 52.3663), (4.8932, 52.3631), (4.884, 52.3569)]),
|
|
98
|
+
tooltip="**Walking route**\n*Centraal β Leidseplein*",
|
|
99
|
+
stroke={"color": "red", "weight": 4, "dash_array": "10 6"},
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
m.reset_target()
|
|
103
|
+
m.add_circle(
|
|
104
|
+
point=Point(4.8812, 52.3584),
|
|
105
|
+
tooltip="**Van Gogh Museum**",
|
|
106
|
+
style={"radius": 12, "stroke": {"color": "green", "weight": 2}, "fill": {"color": "orange", "opacity": 0.5}},
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
m.add_layer_control(collapsed=False)
|
|
110
|
+
m.set_bounds(padding=0.005)
|
|
111
|
+
|
|
112
|
+
print(m.to_html()) # markdown-exec: hide
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Quickstart
|
|
116
|
+
|
|
117
|
+
Install mapyta:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
uv add mapyta
|
|
121
|
+
# or
|
|
122
|
+
pip install mapyta
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Create your first map:
|
|
126
|
+
|
|
127
|
+
```python exec="true" html="true" source="tabbed-right"
|
|
128
|
+
from shapely.geometry import Point
|
|
129
|
+
from mapyta import Map
|
|
130
|
+
|
|
131
|
+
m = Map(title="Hello Amsterdam")
|
|
132
|
+
m.add_point(
|
|
133
|
+
point=Point(4.9041, 52.3676),
|
|
134
|
+
tooltip="**Amsterdam**",
|
|
135
|
+
popup="Capital city of the Netherlands.",
|
|
136
|
+
caption="AMS",
|
|
137
|
+
)
|
|
138
|
+
m.to_html("hello.html")
|
|
139
|
+
|
|
140
|
+
print(m.to_html()) # markdown-exec: hide
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Open `hello.html` in any browser and you're done.
|
|
144
|
+
|
|
145
|
+
## License
|
|
146
|
+
|
|
147
|
+
This project is licensed under the terms of the MIT license.
|
|
Binary file
|