geovizpy 0.1.6__tar.gz → 0.1.7__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.
@@ -1,118 +1,118 @@
1
- Metadata-Version: 2.4
2
- Name: geovizpy
3
- Version: 0.1.6
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
- ![Choropleth Map Example](https://codeberg.org/fbxyz/geovizpy/raw/branch/main/docs/source/_static/choropleth.png)
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
+ ![Choropleth Map Example](https://codeberg.org/fbxyz/geovizpy/raw/branch/main/docs/source/_static/choropleth.png)
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/).
@@ -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.
@@ -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)
@@ -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 (svg[parts[0]] && svg[parts[0]][parts[1]]) {{
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
- }} else {{
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.6
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
- ![Choropleth Map Example](https://codeberg.org/fbxyz/geovizpy/raw/branch/main/docs/source/_static/choropleth.png)
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
+ ![Choropleth Map Example](https://codeberg.org/fbxyz/geovizpy/raw/branch/main/docs/source/_static/choropleth.png)
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/).
@@ -4,6 +4,7 @@ geovizpy/__init__.py
4
4
  geovizpy/controls.py
5
5
  geovizpy/effects.py
6
6
  geovizpy/geoviz.py
7
+ geovizpy/insets.py
7
8
  geovizpy/legends.py
8
9
  geovizpy/marks.py
9
10
  geovizpy/plots.py
@@ -1,4 +1,4 @@
1
- [egg_info]
2
- tag_build =
3
- tag_date = 0
4
-
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -9,7 +9,7 @@ long_description = (this_directory / "README.md").read_text()
9
9
 
10
10
  setup(
11
11
  name="geovizpy",
12
- version="0.1.6",
12
+ version="0.1.7",
13
13
  description="A Python wrapper for the geoviz JavaScript library",
14
14
  long_description=long_description,
15
15
  long_description_content_type='text/markdown',
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes