ssb-sgis 1.0.13__tar.gz → 1.0.14__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.
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/PKG-INFO +1 -1
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/pyproject.toml +1 -1
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/__init__.py +1 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/maps/explore.py +23 -1
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/maps/maps.py +21 -0
- ssb_sgis-1.0.14/src/sgis/maps/norge_i_bilder.json +11517 -0
- ssb_sgis-1.0.14/src/sgis/maps/norge_i_bilder_wms.py +165 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/LICENSE +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/README.md +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/debug_config.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/exceptions.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/geopandas_tools/__init__.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/geopandas_tools/bounds.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/geopandas_tools/buffer_dissolve_explode.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/geopandas_tools/centerlines.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/geopandas_tools/cleaning.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/geopandas_tools/conversion.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/geopandas_tools/duplicates.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/geopandas_tools/general.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/geopandas_tools/geocoding.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/geopandas_tools/geometry_types.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/geopandas_tools/neighbors.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/geopandas_tools/overlay.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/geopandas_tools/point_operations.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/geopandas_tools/polygon_operations.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/geopandas_tools/polygons_as_rings.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/geopandas_tools/sfilter.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/helpers.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/io/_is_dapla.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/io/dapla_functions.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/io/opener.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/io/read_parquet.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/maps/__init__.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/maps/examine.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/maps/httpserver.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/maps/legend.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/maps/map.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/maps/thematicmap.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/maps/tilesources.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/networkanalysis/__init__.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/networkanalysis/_get_route.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/networkanalysis/_od_cost_matrix.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/networkanalysis/_points.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/networkanalysis/_service_area.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/networkanalysis/closing_network_holes.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/networkanalysis/cutting_lines.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/networkanalysis/directednetwork.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/networkanalysis/finding_isolated_networks.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/networkanalysis/network.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/networkanalysis/networkanalysis.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/networkanalysis/networkanalysisrules.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/networkanalysis/nodes.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/networkanalysis/traveling_salesman.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/parallel/parallel.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/py.typed +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/raster/__init__.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/raster/base.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/raster/image_collection.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/raster/indices.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/raster/regex.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/raster/sentinel_config.py +0 -0
- {ssb_sgis-1.0.13 → ssb_sgis-1.0.14}/src/sgis/raster/zonal.py +0 -0
|
@@ -96,6 +96,7 @@ from .maps.maps import explore
|
|
|
96
96
|
from .maps.maps import explore_locals
|
|
97
97
|
from .maps.maps import qtm
|
|
98
98
|
from .maps.maps import samplemap
|
|
99
|
+
from .maps.norge_i_bilder_wms import NorgeIBilderWms
|
|
99
100
|
from .maps.thematicmap import ThematicMap
|
|
100
101
|
from .maps.tilesources import kartverket as kartverket_tiles
|
|
101
102
|
from .maps.tilesources import xyz as xyztiles
|
|
@@ -44,6 +44,7 @@ from ..geopandas_tools.general import clean_geoms
|
|
|
44
44
|
from ..geopandas_tools.general import make_all_singlepart
|
|
45
45
|
from ..geopandas_tools.geometry_types import get_geom_type
|
|
46
46
|
from ..geopandas_tools.geometry_types import to_single_geom_type
|
|
47
|
+
from .norge_i_bilder_wms import NorgeIBilderWms
|
|
47
48
|
|
|
48
49
|
try:
|
|
49
50
|
from ..raster.image_collection import Band
|
|
@@ -157,7 +158,9 @@ def to_tile(tile: str | xyzservices.TileProvider, max_zoom: int) -> folium.TileL
|
|
|
157
158
|
except TypeError:
|
|
158
159
|
name = tile
|
|
159
160
|
|
|
160
|
-
if not isinstance(tile,
|
|
161
|
+
if isinstance(tile, folium.map.Layer) and not isinstance(tile, folium.GeoJson):
|
|
162
|
+
return tile
|
|
163
|
+
elif not isinstance(tile, str):
|
|
161
164
|
try:
|
|
162
165
|
return folium.TileLayer(tile, name=name, max_zoom=max_zoom)
|
|
163
166
|
except TypeError:
|
|
@@ -277,6 +280,7 @@ class Explore(Map):
|
|
|
277
280
|
max_images: int = 10,
|
|
278
281
|
max_nodata_percentage: int = 100,
|
|
279
282
|
display: bool = True,
|
|
283
|
+
norge_i_bilder: bool = False,
|
|
280
284
|
**kwargs,
|
|
281
285
|
) -> None:
|
|
282
286
|
"""Initialiser.
|
|
@@ -306,6 +310,9 @@ class Explore(Map):
|
|
|
306
310
|
max_nodata_percentage: Maximum percentage nodata values (e.g. clouds) ro allow in
|
|
307
311
|
image arrays.
|
|
308
312
|
display: Whether to display the map interactively.
|
|
313
|
+
norge_i_bilder: If True, all Norge i bilder images in bounds will be loaded
|
|
314
|
+
into the map. Can optionally be set to an instance of NorgeIBilderWms to filter
|
|
315
|
+
years and names.
|
|
309
316
|
**kwargs: Additional keyword arguments. Can also be geometry-like objects
|
|
310
317
|
where the key is the label.
|
|
311
318
|
"""
|
|
@@ -322,6 +329,7 @@ class Explore(Map):
|
|
|
322
329
|
self.max_images = max_images
|
|
323
330
|
self.max_nodata_percentage = max_nodata_percentage
|
|
324
331
|
self.display = display
|
|
332
|
+
self.norge_i_bilder = norge_i_bilder
|
|
325
333
|
self.legend = None
|
|
326
334
|
|
|
327
335
|
self.browser = browser
|
|
@@ -760,6 +768,14 @@ class Explore(Map):
|
|
|
760
768
|
for tile in tiles:
|
|
761
769
|
to_tile(tile, max_zoom=self.max_zoom).add_to(mapobj)
|
|
762
770
|
|
|
771
|
+
def _add_norge_i_bilder(self, map_: folium.Map, bbox: Any) -> None:
|
|
772
|
+
if not isinstance(self.norge_i_bilder, NorgeIBilderWms):
|
|
773
|
+
self.norge_i_bilder = NorgeIBilderWms()
|
|
774
|
+
|
|
775
|
+
tiles = self.norge_i_bilder.get_tiles(bbox, max_zoom=self.max_zoom)
|
|
776
|
+
for tile in tiles.values():
|
|
777
|
+
map_.add_child(tile)
|
|
778
|
+
|
|
763
779
|
def _create_continous_map(self):
|
|
764
780
|
self._prepare_continous_map()
|
|
765
781
|
if self.scheme:
|
|
@@ -966,6 +982,9 @@ class Explore(Map):
|
|
|
966
982
|
m.get_root().add_child(style)
|
|
967
983
|
# folium.LayerControl(collapsed=False).add_to(m)
|
|
968
984
|
|
|
985
|
+
if self.norge_i_bilder:
|
|
986
|
+
self._add_norge_i_bilder(m, bounds)
|
|
987
|
+
|
|
969
988
|
return m
|
|
970
989
|
|
|
971
990
|
def _make_geojson(
|
|
@@ -1112,6 +1131,7 @@ class Explore(Map):
|
|
|
1112
1131
|
highlight_function=highlight_function,
|
|
1113
1132
|
smooth_factor=self.smooth_factor,
|
|
1114
1133
|
show=show,
|
|
1134
|
+
# on_each_feature="function(feature,layer){layer.bindTooltip(feature.properties.NAME,{permanent:true,direction:'center'});return layer;}",
|
|
1115
1135
|
**kwargs,
|
|
1116
1136
|
)
|
|
1117
1137
|
|
|
@@ -1141,6 +1161,8 @@ def _tooltip_popup(
|
|
|
1141
1161
|
return folium.GeoJsonTooltip(fields, **kwargs)
|
|
1142
1162
|
elif type_ == "popup":
|
|
1143
1163
|
return folium.GeoJsonPopup(fields, **kwargs)
|
|
1164
|
+
else:
|
|
1165
|
+
raise ValueError(type_)
|
|
1144
1166
|
|
|
1145
1167
|
|
|
1146
1168
|
def _intersects_if_not_none_or_empty(obj: Any, other: Any) -> bool:
|
|
@@ -31,6 +31,7 @@ from ..geopandas_tools.geocoding import address_to_gdf
|
|
|
31
31
|
from ..geopandas_tools.geometry_types import get_geom_type
|
|
32
32
|
from .explore import Explore
|
|
33
33
|
from .map import Map
|
|
34
|
+
from .norge_i_bilder_wms import NorgeIBilderWms
|
|
34
35
|
from .thematicmap import ThematicMap
|
|
35
36
|
|
|
36
37
|
try:
|
|
@@ -57,6 +58,9 @@ def _get_location_mask(kwargs: dict, gdfs) -> tuple[GeoDataFrame | None, dict]:
|
|
|
57
58
|
"akersveien": (10.7476367, 59.9222191),
|
|
58
59
|
"kongsvinger": (12.0035242, 60.1875279),
|
|
59
60
|
"stavanger": (5.6960601, 58.8946196),
|
|
61
|
+
"trondheim": (10.39677054, 63.42687816),
|
|
62
|
+
"trondhjem": (10.39677054, 63.42687816),
|
|
63
|
+
"bergen": (5.32574594, 60.39550309),
|
|
60
64
|
"volda": (6.0705987, 62.146643),
|
|
61
65
|
}
|
|
62
66
|
|
|
@@ -87,6 +91,7 @@ def explore(
|
|
|
87
91
|
size: int | None = None,
|
|
88
92
|
max_images: int = 10,
|
|
89
93
|
max_nodata_percentage: int = 100,
|
|
94
|
+
norge_i_bilder: bool | NorgeIBilderWms = False,
|
|
90
95
|
**kwargs,
|
|
91
96
|
) -> Explore:
|
|
92
97
|
"""Interactive map of GeoDataFrames with layers that can be toggled on/off.
|
|
@@ -118,6 +123,9 @@ def explore(
|
|
|
118
123
|
map. Defaults to 10.
|
|
119
124
|
max_nodata_percentage: Maximum percentage nodata values (e.g. clouds) ro allow in
|
|
120
125
|
image arrays.
|
|
126
|
+
norge_i_bilder: If True, all Norge i bilder images in bounds will be loaded
|
|
127
|
+
into the map. Can optionally be set to an instance of NorgeIBilderWms to filter
|
|
128
|
+
years and names.
|
|
121
129
|
**kwargs: Keyword arguments to pass to geopandas.GeoDataFrame.explore, for
|
|
122
130
|
instance 'cmap' to change the colors, 'scheme' to change how the data
|
|
123
131
|
is grouped. This defaults to 'fisherjenkssampled' for numeric data.
|
|
@@ -167,6 +175,7 @@ def explore(
|
|
|
167
175
|
max_zoom=max_zoom,
|
|
168
176
|
max_images=max_images,
|
|
169
177
|
max_nodata_percentage=max_nodata_percentage,
|
|
178
|
+
norge_i_bilder=norge_i_bilder,
|
|
170
179
|
**kwargs,
|
|
171
180
|
)
|
|
172
181
|
|
|
@@ -224,6 +233,7 @@ def explore(
|
|
|
224
233
|
max_zoom=max_zoom,
|
|
225
234
|
max_images=max_images,
|
|
226
235
|
max_nodata_percentage=max_nodata_percentage,
|
|
236
|
+
norge_i_bilder=norge_i_bilder,
|
|
227
237
|
**kwargs,
|
|
228
238
|
)
|
|
229
239
|
|
|
@@ -235,6 +245,7 @@ def explore(
|
|
|
235
245
|
smooth_factor=smooth_factor,
|
|
236
246
|
max_images=max_images,
|
|
237
247
|
max_nodata_percentage=max_nodata_percentage,
|
|
248
|
+
norge_i_bilder=norge_i_bilder,
|
|
238
249
|
**kwargs,
|
|
239
250
|
)
|
|
240
251
|
|
|
@@ -260,6 +271,7 @@ def samplemap(
|
|
|
260
271
|
browser: bool = False,
|
|
261
272
|
max_images: int = 10,
|
|
262
273
|
max_nodata_percentage: int = 100,
|
|
274
|
+
norge_i_bilder: bool | NorgeIBilderWms = False,
|
|
263
275
|
**kwargs,
|
|
264
276
|
) -> Explore:
|
|
265
277
|
"""Shows an interactive map of a random area of GeoDataFrames.
|
|
@@ -295,6 +307,9 @@ def samplemap(
|
|
|
295
307
|
map. Defaults to 10.
|
|
296
308
|
max_nodata_percentage: Maximum percentage nodata values (e.g. clouds) ro allow in
|
|
297
309
|
image arrays.
|
|
310
|
+
norge_i_bilder: If True, all Norge i bilder images in bounds will be loaded
|
|
311
|
+
into the map. Can optionally be set to an instance of NorgeIBilderWms to filter
|
|
312
|
+
years and names.
|
|
298
313
|
**kwargs: Keyword arguments to pass to geopandas.GeoDataFrame.explore, for
|
|
299
314
|
instance 'cmap' to change the colors, 'scheme' to change how the data
|
|
300
315
|
is grouped. This defaults to 'fisherjenkssampled' for numeric data.
|
|
@@ -378,6 +393,7 @@ def samplemap(
|
|
|
378
393
|
smooth_factor=smooth_factor,
|
|
379
394
|
max_images=max_images,
|
|
380
395
|
max_nodata_percentage=max_nodata_percentage,
|
|
396
|
+
norge_i_bilder=norge_i_bilder,
|
|
381
397
|
**kwargs,
|
|
382
398
|
)
|
|
383
399
|
|
|
@@ -392,6 +408,7 @@ def clipmap(
|
|
|
392
408
|
browser: bool = False,
|
|
393
409
|
max_images: int = 10,
|
|
394
410
|
max_nodata_percentage: int = 100,
|
|
411
|
+
norge_i_bilder: bool | NorgeIBilderWms = False,
|
|
395
412
|
**kwargs,
|
|
396
413
|
) -> Explore | Map:
|
|
397
414
|
"""Shows an interactive map of a of GeoDataFrames clipped to the mask extent.
|
|
@@ -422,6 +439,9 @@ def clipmap(
|
|
|
422
439
|
map. Defaults to 10.
|
|
423
440
|
max_nodata_percentage: Maximum percentage nodata values (e.g. clouds) ro allow in
|
|
424
441
|
image arrays.
|
|
442
|
+
norge_i_bilder: If True, all Norge i bilder images in bounds will be loaded
|
|
443
|
+
into the map. Can optionally be set to an instance of NorgeIBilderWms to filter
|
|
444
|
+
years and names.
|
|
425
445
|
**kwargs: Keyword arguments to pass to geopandas.GeoDataFrame.explore, for
|
|
426
446
|
instance 'cmap' to change the colors, 'scheme' to change how the data
|
|
427
447
|
is grouped. This defaults to 'fisherjenkssampled' for numeric data.
|
|
@@ -457,6 +477,7 @@ def clipmap(
|
|
|
457
477
|
smooth_factor=smooth_factor,
|
|
458
478
|
max_images=max_images,
|
|
459
479
|
max_nodata_percentage=max_nodata_percentage,
|
|
480
|
+
norge_i_bilder=norge_i_bilder,
|
|
460
481
|
**kwargs,
|
|
461
482
|
)
|
|
462
483
|
m.mask = mask
|