geovizpy 0.1.6__py3-none-any.whl → 0.1.7__py3-none-any.whl
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.
- geovizpy/geoviz.py +3 -1
- geovizpy/insets.py +20 -0
- geovizpy/renderer.py +13 -4
- {geovizpy-0.1.6.dist-info → geovizpy-0.1.7.dist-info}/METADATA +118 -118
- geovizpy-0.1.7.dist-info/RECORD +13 -0
- {geovizpy-0.1.6.dist-info → geovizpy-0.1.7.dist-info}/WHEEL +1 -1
- geovizpy-0.1.6.dist-info/RECORD +0 -12
- {geovizpy-0.1.6.dist-info → geovizpy-0.1.7.dist-info}/top_level.txt +0 -0
geovizpy/geoviz.py
CHANGED
|
@@ -6,6 +6,7 @@ from .legends import LegendsMixin
|
|
|
6
6
|
from .effects import EffectsMixin
|
|
7
7
|
from .controls import ControlsMixin
|
|
8
8
|
from .renderer import RendererMixin
|
|
9
|
+
from .insets import InsetsMixin
|
|
9
10
|
|
|
10
11
|
class Geoviz(
|
|
11
12
|
MarksMixin,
|
|
@@ -13,7 +14,8 @@ class Geoviz(
|
|
|
13
14
|
LegendsMixin,
|
|
14
15
|
EffectsMixin,
|
|
15
16
|
ControlsMixin,
|
|
16
|
-
RendererMixin
|
|
17
|
+
RendererMixin,
|
|
18
|
+
InsetsMixin
|
|
17
19
|
):
|
|
18
20
|
"""
|
|
19
21
|
A Python wrapper for the geoviz JavaScript library.
|
geovizpy/insets.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""Module for creating inset maps."""
|
|
2
|
+
|
|
3
|
+
class InsetsMixin:
|
|
4
|
+
"""Mixin class for adding inset map functionality."""
|
|
5
|
+
|
|
6
|
+
def inset(self, **kwargs):
|
|
7
|
+
"""
|
|
8
|
+
Add an inset map to the main map.
|
|
9
|
+
|
|
10
|
+
Args:
|
|
11
|
+
pos (list): [x, y] position of the inset.
|
|
12
|
+
width (int): Width of the inset SVG.
|
|
13
|
+
height (int): Height of the inset SVG.
|
|
14
|
+
domain (object): GeoJSON to define the domain of the inset.
|
|
15
|
+
projection (string): Projection name for the inset.
|
|
16
|
+
outline (dict): Dictionary for outline properties (e.g., {"stroke": "black", "strokeWidth": 2}).
|
|
17
|
+
"""
|
|
18
|
+
# The actual creation of the inset will be handled in the JavaScript renderer,
|
|
19
|
+
# where the `geoviz.create` function will be called with the main SVG as parent.
|
|
20
|
+
return self._add_command("inset.create", kwargs)
|
geovizpy/renderer.py
CHANGED
|
@@ -94,12 +94,21 @@ class RendererMixin:
|
|
|
94
94
|
}} else {{
|
|
95
95
|
console.warn("Method " + parts[0] + " not found");
|
|
96
96
|
}}
|
|
97
|
-
}} else if (parts.length === 2) {
|
|
98
|
-
if (
|
|
97
|
+
}} else if (parts.length === 2) {
|
|
98
|
+
if (cmd.name === "inset.create") {
|
|
99
|
+
const insetArgs = { ...cmd.args };
|
|
100
|
+
const outlineArgs = insetArgs.outline;
|
|
101
|
+
delete insetArgs.outline;
|
|
102
|
+
|
|
103
|
+
const insetSvg = geoviz.create({ parent: svg, ...insetArgs });
|
|
104
|
+
if (outlineArgs) {
|
|
105
|
+
insetSvg.outline(outlineArgs);
|
|
106
|
+
}
|
|
107
|
+
} else if (svg[parts[0]] && svg[parts[0]][parts[1]]) {
|
|
99
108
|
svg[parts[0]][parts[1]](cmd.args);
|
|
100
|
-
}
|
|
109
|
+
} else {
|
|
101
110
|
console.warn("Method " + cmd.name + " not found");
|
|
102
|
-
}
|
|
111
|
+
}
|
|
103
112
|
}}
|
|
104
113
|
}}
|
|
105
114
|
}});
|
|
@@ -1,118 +1,118 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: geovizpy
|
|
3
|
-
Version: 0.1.
|
|
4
|
-
Summary: A Python wrapper for the geoviz JavaScript library
|
|
5
|
-
Author: fbxyz
|
|
6
|
-
Project-URL: Source, https://codeberg.org/fbxyz/geovizpy
|
|
7
|
-
Classifier: Programming Language :: Python :: 3
|
|
8
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
-
Classifier: Operating System :: OS Independent
|
|
10
|
-
Requires-Python: >=3.6
|
|
11
|
-
Description-Content-Type: text/markdown
|
|
12
|
-
Provides-Extra: export
|
|
13
|
-
Requires-Dist: playwright; extra == "export"
|
|
14
|
-
Dynamic: author
|
|
15
|
-
Dynamic: classifier
|
|
16
|
-
Dynamic: description
|
|
17
|
-
Dynamic: description-content-type
|
|
18
|
-
Dynamic: project-url
|
|
19
|
-
Dynamic: provides-extra
|
|
20
|
-
Dynamic: requires-python
|
|
21
|
-
Dynamic: summary
|
|
22
|
-
|
|
23
|
-
# geovizpy
|
|
24
|
-
|
|
25
|
-
**geovizpy** is a Python wrapper for the `geoviz` JavaScript library, designed to bring the power of D3.js-based thematic mapping to Python. It allows you to create high-quality, interactive maps directly from Python scripts or Jupyter notebooks.
|
|
26
|
-
|
|
27
|
-
This library is a wrapper around the `geoviz` library. For detailed information on the underlying mapping logic, please refer to the [original geoviz documentation](https://github.com/neocarto/geoviz).
|
|
28
|
-
|
|
29
|
-

|
|
30
|
-
|
|
31
|
-
## Features
|
|
32
|
-
|
|
33
|
-
- **Simple, chainable API**: Build complex maps by chaining intuitive methods.
|
|
34
|
-
- **Variety of Map Types**: Create choropleth, proportional symbol, typology, and other thematic maps.
|
|
35
|
-
- **Interactive Controls**: Add hover-to-expand controls for toggling layer visibility and exporting the map as SVG or PNG.
|
|
36
|
-
- **Customizable**: Extensive options to customize colors, legends, strokes, and more.
|
|
37
|
-
- **Standalone HTML**: Renders self-contained HTML files with no server required.
|
|
38
|
-
- **Image Export**: Save maps directly to PNG or SVG from Python (requires optional dependencies).
|
|
39
|
-
|
|
40
|
-
## Installation
|
|
41
|
-
|
|
42
|
-
### Standard Installation
|
|
43
|
-
|
|
44
|
-
You can install the core library using pip:
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
pip install geovizpy
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
Or install directly from the source repository:
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
pip install git+https://codeberg.org/fbxyz/geovizpy.git
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
### For Image Export
|
|
57
|
-
|
|
58
|
-
To save maps as PNG or SVG files directly from Python, you need to install the optional `export` dependencies:
|
|
59
|
-
|
|
60
|
-
1. **Install the extra dependencies:**
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
pip install "geovizpy[export]"
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
2. **Install Playwright's browser binaries:**
|
|
67
|
-
|
|
68
|
-
```bash
|
|
69
|
-
playwright install
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
On Linux, you may also need to install host dependencies:
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
sudo playwright install-deps
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
## Quick Start
|
|
79
|
-
|
|
80
|
-
Here is a simple example of how to create a choropleth map:
|
|
81
|
-
|
|
82
|
-
```python
|
|
83
|
-
from geovizpy import Geoviz
|
|
84
|
-
import json
|
|
85
|
-
|
|
86
|
-
# Load your GeoJSON data
|
|
87
|
-
# (Assuming 'world.json' is in a 'data' subdirectory)
|
|
88
|
-
with open("data/world.json") as f:
|
|
89
|
-
world_data = json.load(f)
|
|
90
|
-
|
|
91
|
-
# Initialize the map
|
|
92
|
-
viz = Geoviz(projection="EqualEarth", width=800)
|
|
93
|
-
|
|
94
|
-
# Add layers
|
|
95
|
-
viz.outline()
|
|
96
|
-
viz.graticule()
|
|
97
|
-
|
|
98
|
-
# Add a choropleth layer
|
|
99
|
-
viz.choro(
|
|
100
|
-
data=world_data,
|
|
101
|
-
var="gdppc",
|
|
102
|
-
colors="Blues",
|
|
103
|
-
legend=True,
|
|
104
|
-
leg_title="GDP per Capita"
|
|
105
|
-
)
|
|
106
|
-
|
|
107
|
-
# Add interactive controls
|
|
108
|
-
viz.add_layer_control(layers=["choropleth_gdp"])
|
|
109
|
-
viz.add_export_control()
|
|
110
|
-
|
|
111
|
-
# Save the map
|
|
112
|
-
viz.save("my_map.html") # Renders an interactive HTML file
|
|
113
|
-
# viz.save("my_map.png") # Renders a static PNG image (requires export dependencies)
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
## Documentation
|
|
117
|
-
|
|
118
|
-
For more detailed information on all available methods and parameters, please see the [full documentation](https://geovizpy.readthedocs.io/en/latest/).
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: geovizpy
|
|
3
|
+
Version: 0.1.7
|
|
4
|
+
Summary: A Python wrapper for the geoviz JavaScript library
|
|
5
|
+
Author: fbxyz
|
|
6
|
+
Project-URL: Source, https://codeberg.org/fbxyz/geovizpy
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.6
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
Provides-Extra: export
|
|
13
|
+
Requires-Dist: playwright; extra == "export"
|
|
14
|
+
Dynamic: author
|
|
15
|
+
Dynamic: classifier
|
|
16
|
+
Dynamic: description
|
|
17
|
+
Dynamic: description-content-type
|
|
18
|
+
Dynamic: project-url
|
|
19
|
+
Dynamic: provides-extra
|
|
20
|
+
Dynamic: requires-python
|
|
21
|
+
Dynamic: summary
|
|
22
|
+
|
|
23
|
+
# geovizpy
|
|
24
|
+
|
|
25
|
+
**geovizpy** is a Python wrapper for the `geoviz` JavaScript library, designed to bring the power of D3.js-based thematic mapping to Python. It allows you to create high-quality, interactive maps directly from Python scripts or Jupyter notebooks.
|
|
26
|
+
|
|
27
|
+
This library is a wrapper around the `geoviz` library. For detailed information on the underlying mapping logic, please refer to the [original geoviz documentation](https://github.com/neocarto/geoviz).
|
|
28
|
+
|
|
29
|
+

|
|
30
|
+
|
|
31
|
+
## Features
|
|
32
|
+
|
|
33
|
+
- **Simple, chainable API**: Build complex maps by chaining intuitive methods.
|
|
34
|
+
- **Variety of Map Types**: Create choropleth, proportional symbol, typology, and other thematic maps.
|
|
35
|
+
- **Interactive Controls**: Add hover-to-expand controls for toggling layer visibility and exporting the map as SVG or PNG.
|
|
36
|
+
- **Customizable**: Extensive options to customize colors, legends, strokes, and more.
|
|
37
|
+
- **Standalone HTML**: Renders self-contained HTML files with no server required.
|
|
38
|
+
- **Image Export**: Save maps directly to PNG or SVG from Python (requires optional dependencies).
|
|
39
|
+
|
|
40
|
+
## Installation
|
|
41
|
+
|
|
42
|
+
### Standard Installation
|
|
43
|
+
|
|
44
|
+
You can install the core library using pip:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install geovizpy
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Or install directly from the source repository:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pip install git+https://codeberg.org/fbxyz/geovizpy.git
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### For Image Export
|
|
57
|
+
|
|
58
|
+
To save maps as PNG or SVG files directly from Python, you need to install the optional `export` dependencies:
|
|
59
|
+
|
|
60
|
+
1. **Install the extra dependencies:**
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pip install "geovizpy[export]"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
2. **Install Playwright's browser binaries:**
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
playwright install
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
On Linux, you may also need to install host dependencies:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
sudo playwright install-deps
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Quick Start
|
|
79
|
+
|
|
80
|
+
Here is a simple example of how to create a choropleth map:
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
from geovizpy import Geoviz
|
|
84
|
+
import json
|
|
85
|
+
|
|
86
|
+
# Load your GeoJSON data
|
|
87
|
+
# (Assuming 'world.json' is in a 'data' subdirectory)
|
|
88
|
+
with open("data/world.json") as f:
|
|
89
|
+
world_data = json.load(f)
|
|
90
|
+
|
|
91
|
+
# Initialize the map
|
|
92
|
+
viz = Geoviz(projection="EqualEarth", width=800)
|
|
93
|
+
|
|
94
|
+
# Add layers
|
|
95
|
+
viz.outline()
|
|
96
|
+
viz.graticule()
|
|
97
|
+
|
|
98
|
+
# Add a choropleth layer
|
|
99
|
+
viz.choro(
|
|
100
|
+
data=world_data,
|
|
101
|
+
var="gdppc",
|
|
102
|
+
colors="Blues",
|
|
103
|
+
legend=True,
|
|
104
|
+
leg_title="GDP per Capita"
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
# Add interactive controls
|
|
108
|
+
viz.add_layer_control(layers=["choropleth_gdp"])
|
|
109
|
+
viz.add_export_control()
|
|
110
|
+
|
|
111
|
+
# Save the map
|
|
112
|
+
viz.save("my_map.html") # Renders an interactive HTML file
|
|
113
|
+
# viz.save("my_map.png") # Renders a static PNG image (requires export dependencies)
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Documentation
|
|
117
|
+
|
|
118
|
+
For more detailed information on all available methods and parameters, please see the [full documentation](https://geovizpy.readthedocs.io/en/latest/).
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
geovizpy/__init__.py,sha256=gvgVlK5oB6meBmYgXkXFVohPKkO3ev9UupPA8BQNzYg,120
|
|
2
|
+
geovizpy/controls.py,sha256=pvSrbrkgyB8VURVXED3Etou3Wk2wfWB5p4nnvHLFrgM,1319
|
|
3
|
+
geovizpy/effects.py,sha256=6F78g0IJEbEG8EsKurmBapE8UX0sho7zKHDnzqJ0ci0,1433
|
|
4
|
+
geovizpy/geoviz.py,sha256=nSkblpSf7MeHtdNhkC-g9ltByBaLCbIjW1URVizeMv0,1464
|
|
5
|
+
geovizpy/insets.py,sha256=ljraMXuPGhyPLfkkA9y7Io6fIQGD7j2dU44F9ZvM8pM,861
|
|
6
|
+
geovizpy/legends.py,sha256=IPn_1drQ9MkmJlQ54XwBqAlTRSyq98sm8gzgE-ATRog,2218
|
|
7
|
+
geovizpy/marks.py,sha256=xqwf8ELY05lnrrXGQljMe-mm315vUt_-qOmdFAsYhwA,5520
|
|
8
|
+
geovizpy/plots.py,sha256=EVjPPBFyUFQpXH7sAuxCz_sctonJVUxoi8edbehKrpI,3089
|
|
9
|
+
geovizpy/renderer.py,sha256=51jdjvR2uHr6fFeCOUHC1lCl8ayp7hU2yN5gD-f9rSg,16905
|
|
10
|
+
geovizpy-0.1.7.dist-info/METADATA,sha256=RxFZorl1X5yKz1CyiZu3egebipETy6BwjO0lQMqjCWE,3581
|
|
11
|
+
geovizpy-0.1.7.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
12
|
+
geovizpy-0.1.7.dist-info/top_level.txt,sha256=3D5AFdMd9bWEvGQUWDy6jccJamUwdKmchgCmxLHaAYs,9
|
|
13
|
+
geovizpy-0.1.7.dist-info/RECORD,,
|
geovizpy-0.1.6.dist-info/RECORD
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
geovizpy/__init__.py,sha256=gvgVlK5oB6meBmYgXkXFVohPKkO3ev9UupPA8BQNzYg,120
|
|
2
|
-
geovizpy/controls.py,sha256=pvSrbrkgyB8VURVXED3Etou3Wk2wfWB5p4nnvHLFrgM,1319
|
|
3
|
-
geovizpy/effects.py,sha256=6F78g0IJEbEG8EsKurmBapE8UX0sho7zKHDnzqJ0ci0,1433
|
|
4
|
-
geovizpy/geoviz.py,sha256=bG1A5AQIhsfIJ9RQ4RJteG9HRuu70k2xI9l_eydQTH0,1415
|
|
5
|
-
geovizpy/legends.py,sha256=IPn_1drQ9MkmJlQ54XwBqAlTRSyq98sm8gzgE-ATRog,2218
|
|
6
|
-
geovizpy/marks.py,sha256=xqwf8ELY05lnrrXGQljMe-mm315vUt_-qOmdFAsYhwA,5520
|
|
7
|
-
geovizpy/plots.py,sha256=EVjPPBFyUFQpXH7sAuxCz_sctonJVUxoi8edbehKrpI,3089
|
|
8
|
-
geovizpy/renderer.py,sha256=ql9eaRGo-274MEA6ZXcLY4QpidJdmHlt65IuHiwAbko,16543
|
|
9
|
-
geovizpy-0.1.6.dist-info/METADATA,sha256=l9WRhOd_vESt9qOK071kioRARK4OTvpCymOEtXRbHhE,3463
|
|
10
|
-
geovizpy-0.1.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
11
|
-
geovizpy-0.1.6.dist-info/top_level.txt,sha256=3D5AFdMd9bWEvGQUWDy6jccJamUwdKmchgCmxLHaAYs,9
|
|
12
|
-
geovizpy-0.1.6.dist-info/RECORD,,
|
|
File without changes
|