ssb-sgis 1.1.6__tar.gz → 1.1.8__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.1.6 → ssb_sgis-1.1.8}/PKG-INFO +1 -1
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/pyproject.toml +1 -1
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/geopandas_tools/duplicates.py +2 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/io/dapla_functions.py +9 -10
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/maps/map.py +6 -11
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/LICENSE +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/README.md +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/__init__.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/conf.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/debug_config.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/exceptions.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/geopandas_tools/__init__.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/geopandas_tools/bounds.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/geopandas_tools/buffer_dissolve_explode.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/geopandas_tools/centerlines.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/geopandas_tools/cleaning.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/geopandas_tools/conversion.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/geopandas_tools/general.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/geopandas_tools/geocoding.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/geopandas_tools/geometry_types.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/geopandas_tools/neighbors.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/geopandas_tools/overlay.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/geopandas_tools/point_operations.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/geopandas_tools/polygon_operations.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/geopandas_tools/polygons_as_rings.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/geopandas_tools/sfilter.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/helpers.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/io/__init__.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/io/_is_dapla.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/io/opener.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/io/read_parquet.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/maps/__init__.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/maps/examine.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/maps/explore.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/maps/httpserver.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/maps/legend.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/maps/maps.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/maps/norge_i_bilder.json +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/maps/thematicmap.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/maps/tilesources.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/maps/wms.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/networkanalysis/__init__.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/networkanalysis/_get_route.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/networkanalysis/_od_cost_matrix.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/networkanalysis/_points.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/networkanalysis/_service_area.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/networkanalysis/closing_network_holes.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/networkanalysis/cutting_lines.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/networkanalysis/directednetwork.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/networkanalysis/finding_isolated_networks.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/networkanalysis/network.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/networkanalysis/networkanalysis.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/networkanalysis/networkanalysisrules.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/networkanalysis/nodes.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/networkanalysis/traveling_salesman.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/parallel/__init__.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/parallel/parallel.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/py.typed +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/raster/__init__.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/raster/base.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/raster/image_collection.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/raster/indices.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/raster/regex.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/raster/sentinel_config.py +0 -0
- {ssb_sgis-1.1.6 → ssb_sgis-1.1.8}/src/sgis/raster/zonal.py +0 -0
|
@@ -164,6 +164,8 @@ def update_geometries(
|
|
|
164
164
|
|
|
165
165
|
copied.index = copied.index.map(index_mapper)
|
|
166
166
|
|
|
167
|
+
copied = make_all_singlepart(copied)
|
|
168
|
+
|
|
167
169
|
# TODO check why polygons dissappear in rare cases. For now, just add back the missing
|
|
168
170
|
dissapeared = sfilter_inverse(gdf, copied.buffer(-PRECISION))
|
|
169
171
|
copied = pd.concat([copied, dissapeared])
|
|
@@ -99,12 +99,14 @@ def read_geopandas(
|
|
|
99
99
|
**kwargs,
|
|
100
100
|
)
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
single_eq_filter = (
|
|
103
103
|
isinstance(filters, Iterable)
|
|
104
104
|
and len(filters) == 1
|
|
105
105
|
and ("=" in next(iter(filters)) or "==" in next(iter(filters)))
|
|
106
|
-
)
|
|
107
|
-
|
|
106
|
+
)
|
|
107
|
+
# try to read files in subfolder path / "column=value"
|
|
108
|
+
# because glob is slow without GCSFileSystem from the root partition
|
|
109
|
+
if single_eq_filter:
|
|
108
110
|
try:
|
|
109
111
|
expression = "".join(next(iter(filters))).replace("==", "=")
|
|
110
112
|
glob_func = _get_glob(file_system)
|
|
@@ -126,7 +128,7 @@ def read_geopandas(
|
|
|
126
128
|
return gpd.GeoDataFrame(
|
|
127
129
|
_read_partitioned_parquet(
|
|
128
130
|
gcs_path,
|
|
129
|
-
read_func=
|
|
131
|
+
read_func=pq.read_table,
|
|
130
132
|
file_system=file_system,
|
|
131
133
|
mask=mask,
|
|
132
134
|
filters=filters,
|
|
@@ -143,7 +145,7 @@ def read_geopandas(
|
|
|
143
145
|
read_func = gpd.read_file
|
|
144
146
|
|
|
145
147
|
with file_system.open(gcs_path, mode="rb") as file:
|
|
146
|
-
|
|
148
|
+
return _read_geopandas(
|
|
147
149
|
file,
|
|
148
150
|
read_func=read_func,
|
|
149
151
|
file_format=file_format,
|
|
@@ -151,8 +153,6 @@ def read_geopandas(
|
|
|
151
153
|
**kwargs,
|
|
152
154
|
)
|
|
153
155
|
|
|
154
|
-
return df
|
|
155
|
-
|
|
156
156
|
|
|
157
157
|
def _read_geopandas_from_iterable(
|
|
158
158
|
paths, mask, file_system, use_threads, pandas_fallback, **kwargs
|
|
@@ -761,17 +761,16 @@ def _read_partitioned_parquet(
|
|
|
761
761
|
|
|
762
762
|
if results:
|
|
763
763
|
if all(isinstance(x, DataFrame) for x in results):
|
|
764
|
-
|
|
764
|
+
return pd.concat(results)
|
|
765
765
|
else:
|
|
766
766
|
geo_metadata = _get_geo_metadata(next(iter(child_paths)), file_system)
|
|
767
|
-
|
|
767
|
+
return _arrow_to_geopandas(
|
|
768
768
|
pyarrow.concat_tables(
|
|
769
769
|
results,
|
|
770
770
|
promote_options="permissive",
|
|
771
771
|
),
|
|
772
772
|
geo_metadata,
|
|
773
773
|
)
|
|
774
|
-
return results
|
|
775
774
|
|
|
776
775
|
# add columns to empty DataFrame
|
|
777
776
|
first_path = next(iter(child_paths + [path]))
|
|
@@ -128,6 +128,8 @@ class Map:
|
|
|
128
128
|
categorical: Set to True to convert 'column' to string values.
|
|
129
129
|
**kwargs: Arbitrary keyword arguments.
|
|
130
130
|
"""
|
|
131
|
+
self.kwargs = {}
|
|
132
|
+
|
|
131
133
|
gdfs, column, kwargs = self._separate_args(gdfs, column, kwargs)
|
|
132
134
|
|
|
133
135
|
self._column = column
|
|
@@ -175,7 +177,6 @@ class Map:
|
|
|
175
177
|
self.labels = new_labels
|
|
176
178
|
|
|
177
179
|
# pop all geometry-like items from kwargs into self._gdfs
|
|
178
|
-
self.kwargs = {}
|
|
179
180
|
i = 0
|
|
180
181
|
for key, value in kwargs.items():
|
|
181
182
|
try:
|
|
@@ -237,8 +238,8 @@ class Map:
|
|
|
237
238
|
self._gdf = pd.concat(self._gdfs, ignore_index=True)
|
|
238
239
|
|
|
239
240
|
self._nan_idx = self._gdf[self._column].isna()
|
|
240
|
-
self._get_unique_values()
|
|
241
241
|
self._to_categorical()
|
|
242
|
+
self._get_unique_values()
|
|
242
243
|
|
|
243
244
|
def _to_categorical(self):
|
|
244
245
|
if not (self._is_categorical and self.column is not None):
|
|
@@ -262,9 +263,9 @@ class Map:
|
|
|
262
263
|
self._gdfs[i][self.column] = to_string_via_int(gdf[self.column])
|
|
263
264
|
self._gdf[self.column] = to_string_via_int(self._gdf[self.column])
|
|
264
265
|
|
|
265
|
-
def __getattr__(self, attr: str) -> Any:
|
|
266
|
-
|
|
267
|
-
|
|
266
|
+
# def __getattr__(self, attr: str) -> Any:
|
|
267
|
+
# """Search for attribute in kwargs."""
|
|
268
|
+
# return self.kwargs.get(attr, super().__getattribute__(attr))
|
|
268
269
|
|
|
269
270
|
def __bool__(self) -> bool:
|
|
270
271
|
"""True of any gdfs with more than 0 rows."""
|
|
@@ -554,12 +555,6 @@ class Map:
|
|
|
554
555
|
)
|
|
555
556
|
n = n + maybe_area + maybe_length
|
|
556
557
|
|
|
557
|
-
if n == 0:
|
|
558
|
-
raise ValueError(
|
|
559
|
-
f"The column {self._column!r} is not present in any "
|
|
560
|
-
"of the passed GeoDataFrames."
|
|
561
|
-
)
|
|
562
|
-
|
|
563
558
|
def _check_if_categorical(self) -> bool:
|
|
564
559
|
"""Quite messy this..."""
|
|
565
560
|
if not self._column or not self._gdfs:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|