GeoAlchemy2 0.14.6__py3-none-any.whl → 0.15.0__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.
- {GeoAlchemy2-0.14.6.dist-info → GeoAlchemy2-0.15.0.dist-info}/METADATA +4 -1
- GeoAlchemy2-0.15.0.dist-info/RECORD +31 -0
- {GeoAlchemy2-0.14.6.dist-info → GeoAlchemy2-0.15.0.dist-info}/WHEEL +1 -1
- geoalchemy2/__init__.py +1 -0
- geoalchemy2/_functions_helpers.py +2 -2
- geoalchemy2/admin/__init__.py +1 -0
- geoalchemy2/admin/dialects/__init__.py +1 -0
- geoalchemy2/admin/dialects/common.py +1 -0
- geoalchemy2/admin/dialects/geopackage.py +1 -0
- geoalchemy2/admin/dialects/mysql.py +1 -0
- geoalchemy2/admin/dialects/postgresql.py +1 -0
- geoalchemy2/admin/dialects/sqlite.py +1 -0
- geoalchemy2/alembic_helpers.py +1 -0
- geoalchemy2/comparator.py +1 -0
- geoalchemy2/elements.py +1 -0
- geoalchemy2/functions.py +1 -0
- geoalchemy2/functions.pyi +2 -2
- geoalchemy2/shape.py +1 -0
- geoalchemy2/types/__init__.py +5 -4
- geoalchemy2/types/dialects/__init__.py +1 -0
- geoalchemy2/types/dialects/geopackage.py +1 -0
- geoalchemy2/types/dialects/mysql.py +1 -0
- geoalchemy2/types/dialects/postgresql.py +1 -0
- geoalchemy2/types/dialects/sqlite.py +34 -5
- GeoAlchemy2-0.14.6.dist-info/RECORD +0 -31
- {GeoAlchemy2-0.14.6.dist-info → GeoAlchemy2-0.15.0.dist-info}/COPYING.rst +0 -0
- {GeoAlchemy2-0.14.6.dist-info → GeoAlchemy2-0.15.0.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: GeoAlchemy2
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.15.0
|
4
4
|
Summary: Using SQLAlchemy with Spatial Databases
|
5
5
|
Home-page: https://geoalchemy-2.readthedocs.io/en/stable/
|
6
6
|
Author: Eric Lemoine
|
@@ -43,6 +43,9 @@ GeoAlchemy 2
|
|
43
43
|
:target: https://geoalchemy-2.readthedocs.io/en/latest/?badge=latest
|
44
44
|
:alt: Documentation Status
|
45
45
|
|
46
|
+
.. image:: https://zenodo.org/badge/5638538.svg
|
47
|
+
:target: https://zenodo.org/doi/10.5281/zenodo.10808783
|
48
|
+
|
46
49
|
GeoAlchemy 2 is a Python toolkit for working with spatial databases. It is
|
47
50
|
based on the gorgeous `SQLAlchemy <http://www.sqlalchemy.org/>`_.
|
48
51
|
|
@@ -0,0 +1,31 @@
|
|
1
|
+
geoalchemy2/__init__.py,sha256=Wb5f11AM_hYn56yrxOAOjCT3z76TCtseqjFo2hKsob4,1971
|
2
|
+
geoalchemy2/_functions.py,sha256=e8v584Fx_fmh8XnJvkuYEXrcyPDiWV95Mu2yw6L-LHY,62863
|
3
|
+
geoalchemy2/_functions_helpers.py,sha256=hVM9DDTgf-oM27EZu6ycW1y2ENnSxUJixdINetWsu0E,2651
|
4
|
+
geoalchemy2/alembic_helpers.py,sha256=WYjKiVVyHtlB4DI22z-G0-x8NnG8othAINUwmxBCMcs,27885
|
5
|
+
geoalchemy2/comparator.py,sha256=WUDXn10doDlJVnYiWbVIAhhBu7N5AO9BI8sNf2mhpA4,8100
|
6
|
+
geoalchemy2/elements.py,sha256=xgei9RuohTdWJdX37enLqsHMhwRqg6wrKntUUc96cEg,12999
|
7
|
+
geoalchemy2/exc.py,sha256=Nn9bRKB_35skWDMkEf4_Y2GL6gvguPVycPZcbOfa69g,226
|
8
|
+
geoalchemy2/functions.py,sha256=0he8hy_SAWpXAFPdfg32NMW5G0FaZP7yVl0jn0MRLBQ,10320
|
9
|
+
geoalchemy2/functions.pyi,sha256=rKCKdDSVTgeUQHItkOKqJSEuyKmVJ30bpjLpCPwMI5g,108636
|
10
|
+
geoalchemy2/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
|
+
geoalchemy2/shape.py,sha256=TZJIhCN4p4ZVwZMXidxYxTMeeyReAyoFzyYwspJRqSA,2792
|
12
|
+
geoalchemy2/utils.py,sha256=OYWYnT64tjp4DWhPdq3KIxHbVti932xPMtGGxajtu-I,488
|
13
|
+
geoalchemy2/admin/__init__.py,sha256=s8L5C9pYC5dTxhIp9j-JzWeg9kEJevXUW8Pq4_L4aZ8,3984
|
14
|
+
geoalchemy2/admin/dialects/__init__.py,sha256=XodzuBbWKkkSQzM5EL3I33azuE-y_go0nVOlmIyJ13g,367
|
15
|
+
geoalchemy2/admin/dialects/common.py,sha256=8OkGa7T2Gxz2vDVnC9nva8Ma0YqBwGxHWfBJoZF1cNQ,2936
|
16
|
+
geoalchemy2/admin/dialects/geopackage.py,sha256=UaJignKtlo13oHxq92yescVJtXFEXkm4fy5WzR6sLT8,13469
|
17
|
+
geoalchemy2/admin/dialects/mysql.py,sha256=z2gmkTGav60_myDCFxO1yeezDKBcNcMxFvcpH-OqVKw,6867
|
18
|
+
geoalchemy2/admin/dialects/postgresql.py,sha256=VwB_h3TC8M5aQ6aKE3UYgxHfbEKav3eIHJeLx534Zzg,6191
|
19
|
+
geoalchemy2/admin/dialects/sqlite.py,sha256=UYQuNDDy-1-lsvYlqyKy01UtHgLF4iEN42fE5D-9QQk,13597
|
20
|
+
geoalchemy2/types/__init__.py,sha256=dD2-E8rr1nXr_d4CqyiEvRjO1H-dDRQnzr5B1g3_an8,14186
|
21
|
+
geoalchemy2/types/dialects/__init__.py,sha256=sw__RqGAFVrUPGrICjsva9SPoYLBNfyAkBHmsJkT7k0,359
|
22
|
+
geoalchemy2/types/dialects/common.py,sha256=gxKaRQhIODJhu_yBurlvFNAqGh3LfPNu_DcObEG1wlU,138
|
23
|
+
geoalchemy2/types/dialects/geopackage.py,sha256=nRmN_PnF-CWMEHkWhKVdsybnw3SvXZIBXAHIHXJLTqw,147
|
24
|
+
geoalchemy2/types/dialects/mysql.py,sha256=zMNi1920v0XlVaCJWSwtq0b0P5YQRn8y3X_rBxC5KEw,1790
|
25
|
+
geoalchemy2/types/dialects/postgresql.py,sha256=7NBKEbDJXMwX8Sgs6o_N2bAUHgjUcjbrdmYOA7sDiRw,1117
|
26
|
+
geoalchemy2/types/dialects/sqlite.py,sha256=HaRVLvIM9wsyzlSK4-kJJzg1wNrXFWTBkJkFB0Hga3U,1861
|
27
|
+
GeoAlchemy2-0.15.0.dist-info/COPYING.rst,sha256=-bQKftq9uMOROzF7oN65kYBBIJKxTmBuDoftp27IC3I,1056
|
28
|
+
GeoAlchemy2-0.15.0.dist-info/METADATA,sha256=QYBPH87pEDchUfLaF74jOHX4JKeMG1LnAfuUjKLMbXU,2087
|
29
|
+
GeoAlchemy2-0.15.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
30
|
+
GeoAlchemy2-0.15.0.dist-info/top_level.txt,sha256=3kGUTcfBeXd61zFpof6-qiuw1peNF_HuZabgHQgrdis,12
|
31
|
+
GeoAlchemy2-0.15.0.dist-info/RECORD,,
|
geoalchemy2/__init__.py
CHANGED
@@ -60,8 +60,8 @@ class TableRowElement(ColumnElement):
|
|
60
60
|
"""The cache is disabled for this class."""
|
61
61
|
|
62
62
|
def __init__(self, selectable: bool) -> None: ...
|
63
|
-
@property
|
64
|
-
def _from_objects(self) -> List[bool]: ...
|
63
|
+
@property # type: ignore[override]
|
64
|
+
def _from_objects(self) -> List[bool]: ...
|
65
65
|
'''
|
66
66
|
stub_file_parts = [header]
|
67
67
|
|
geoalchemy2/admin/__init__.py
CHANGED
geoalchemy2/alembic_helpers.py
CHANGED
geoalchemy2/comparator.py
CHANGED
geoalchemy2/elements.py
CHANGED
@@ -117,6 +117,7 @@ class WKTElement(_SpatialElement):
|
|
117
117
|
"""
|
118
118
|
|
119
119
|
_REMOVE_SRID = re.compile("(SRID=([0-9]+); ?)?(.*)")
|
120
|
+
SPLIT_WKT_PATTERN = re.compile(r"((SRID=\d+) *; *)?([\w ]+) *(\([\d ,\(\)]+\))")
|
120
121
|
|
121
122
|
geom_from: str = "ST_GeomFromText"
|
122
123
|
geom_from_extended_version: str = "ST_GeomFromEWKT"
|
geoalchemy2/functions.py
CHANGED
geoalchemy2/functions.pyi
CHANGED
@@ -13,8 +13,8 @@ class TableRowElement(ColumnElement):
|
|
13
13
|
"""The cache is disabled for this class."""
|
14
14
|
|
15
15
|
def __init__(self, selectable: bool) -> None: ...
|
16
|
-
@property
|
17
|
-
def _from_objects(self) -> List[bool]: ...
|
16
|
+
@property # type: ignore[override]
|
17
|
+
def _from_objects(self) -> List[bool]: ...
|
18
18
|
|
19
19
|
class ST_AsGeoJSON(GenericFunction):
|
20
20
|
"""
|
geoalchemy2/shape.py
CHANGED
geoalchemy2/types/__init__.py
CHANGED
@@ -4,6 +4,7 @@ The :class:`geoalchemy2.types.Geometry`, :class:`geoalchemy2.types.Geography`, a
|
|
4
4
|
:class:`geoalchemy2.types.Raster` classes are used when defining geometry, geography and raster
|
5
5
|
columns/properties in models.
|
6
6
|
"""
|
7
|
+
|
7
8
|
import warnings
|
8
9
|
from typing import Any
|
9
10
|
from typing import Dict
|
@@ -114,14 +115,14 @@ class _GISType(UserDefinedType):
|
|
114
115
|
|
115
116
|
def __init__(
|
116
117
|
self,
|
117
|
-
geometry_type="GEOMETRY",
|
118
|
+
geometry_type: Optional[str] = "GEOMETRY",
|
118
119
|
srid=-1,
|
119
120
|
dimension=2,
|
120
121
|
spatial_index=True,
|
121
122
|
use_N_D_index=False,
|
122
|
-
use_typmod=None,
|
123
|
-
from_text=None,
|
124
|
-
name=None,
|
123
|
+
use_typmod: Optional[bool] = None,
|
124
|
+
from_text: Optional[str] = None,
|
125
|
+
name: Optional[str] = None,
|
125
126
|
nullable=True,
|
126
127
|
_spatial_index_reflected=None,
|
127
128
|
) -> None:
|
@@ -1,21 +1,50 @@
|
|
1
1
|
"""This module defines specific functions for SQLite dialect."""
|
2
|
+
|
3
|
+
import re
|
4
|
+
|
2
5
|
from geoalchemy2.elements import RasterElement
|
3
6
|
from geoalchemy2.elements import WKBElement
|
4
7
|
from geoalchemy2.elements import WKTElement
|
5
8
|
from geoalchemy2.shape import to_shape
|
6
9
|
|
7
10
|
|
11
|
+
def format_geom_type(wkt, default_srid=None):
|
12
|
+
"""Format the Geometry type for SQLite."""
|
13
|
+
match = re.match(WKTElement.SPLIT_WKT_PATTERN, wkt)
|
14
|
+
if match is None:
|
15
|
+
return wkt
|
16
|
+
_, srid, geom_type, coords = match.groups()
|
17
|
+
geom_type = geom_type.replace(" ", "")
|
18
|
+
if geom_type.endswith("ZM"):
|
19
|
+
geom_type = geom_type[:-2]
|
20
|
+
elif geom_type.endswith("Z"):
|
21
|
+
geom_type = geom_type[:-1]
|
22
|
+
if srid is None and default_srid is not None:
|
23
|
+
srid = f"SRID={default_srid}"
|
24
|
+
if srid is not None:
|
25
|
+
return "%s;%s%s" % (srid, geom_type, coords)
|
26
|
+
else:
|
27
|
+
return "%s%s" % (geom_type, coords)
|
28
|
+
|
29
|
+
|
8
30
|
def bind_processor_process(spatial_type, bindvalue):
|
9
31
|
if isinstance(bindvalue, WKTElement):
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
32
|
+
return format_geom_type(
|
33
|
+
bindvalue.data,
|
34
|
+
default_srid=bindvalue.srid if bindvalue.srid >= 0 else spatial_type.srid,
|
35
|
+
)
|
14
36
|
elif isinstance(bindvalue, WKBElement):
|
15
37
|
# With SpatiaLite we use Shapely to convert the WKBElement to an EWKT string
|
16
38
|
shape = to_shape(bindvalue)
|
17
|
-
|
39
|
+
# shapely.wkb.loads returns geom_type with a 'Z', for example, 'LINESTRING Z'
|
40
|
+
# which is a limitation with SpatiaLite. Hence, a temporary fix.
|
41
|
+
res = format_geom_type(
|
42
|
+
shape.wkt, default_srid=bindvalue.srid if bindvalue.srid >= 0 else spatial_type.srid
|
43
|
+
)
|
44
|
+
return res
|
18
45
|
elif isinstance(bindvalue, RasterElement):
|
19
46
|
return "%s" % (bindvalue.data)
|
47
|
+
elif isinstance(bindvalue, str):
|
48
|
+
return format_geom_type(bindvalue, default_srid=spatial_type.srid)
|
20
49
|
else:
|
21
50
|
return bindvalue
|
@@ -1,31 +0,0 @@
|
|
1
|
-
geoalchemy2/__init__.py,sha256=N1HOMPNSrNa6oIpo7CBGnUOt-Fu5SzdqngDEoqyvmOo,1970
|
2
|
-
geoalchemy2/_functions.py,sha256=e8v584Fx_fmh8XnJvkuYEXrcyPDiWV95Mu2yw6L-LHY,62863
|
3
|
-
geoalchemy2/_functions_helpers.py,sha256=bINko9ivqpbG-mdwoYx2mQcSs8ygiiIWik3zs-RPmUQ,2651
|
4
|
-
geoalchemy2/alembic_helpers.py,sha256=canBGpmeaTMMQR0u55C2xW-A31L1-CVVC2ZymRrew0A,27884
|
5
|
-
geoalchemy2/comparator.py,sha256=ZWQyPJnT0IgiG3NvPLqBcEFqu2ae17QKRc5LZk1ozRU,8099
|
6
|
-
geoalchemy2/elements.py,sha256=-FSSixQbAS_jO5TysMGxRDdbq5VZ9ZHQOk1YdHqs1nc,12914
|
7
|
-
geoalchemy2/exc.py,sha256=Nn9bRKB_35skWDMkEf4_Y2GL6gvguPVycPZcbOfa69g,226
|
8
|
-
geoalchemy2/functions.py,sha256=PvnwjZfmvDCRrbOxdje0xK5gZ0PJZcIyBaeIrXBPNP4,10319
|
9
|
-
geoalchemy2/functions.pyi,sha256=sGnrJh5Oae2UuPnrom_pAfT-IWXvTnKwHi6N3cjnN1M,108636
|
10
|
-
geoalchemy2/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
|
-
geoalchemy2/shape.py,sha256=1c6oVhAGJHKgFfYzHMpw9HcFicLjSV1Bb3JWol01TjM,2791
|
12
|
-
geoalchemy2/utils.py,sha256=OYWYnT64tjp4DWhPdq3KIxHbVti932xPMtGGxajtu-I,488
|
13
|
-
geoalchemy2/admin/__init__.py,sha256=QwqC-IaQRm_vXV4ZBOuPk3C2byeno65IGzkAdQ5URDc,3983
|
14
|
-
geoalchemy2/admin/dialects/__init__.py,sha256=1QYO2ET6emC-uB30CC97_4_td-O6SOudoEPsJOfo4IE,366
|
15
|
-
geoalchemy2/admin/dialects/common.py,sha256=bIAkd1TUnn24XEaJU6_OZ_eSHOOlMKthOEkBJ4p6Z4k,2935
|
16
|
-
geoalchemy2/admin/dialects/geopackage.py,sha256=AX3Jq2-yJW5SzZJDLUytNGsqs05x4NwxHifPirO500o,13468
|
17
|
-
geoalchemy2/admin/dialects/mysql.py,sha256=p4GSudDUMRDc2usyPCJ--JWQkyV08yuitxhrNKJPGXE,6866
|
18
|
-
geoalchemy2/admin/dialects/postgresql.py,sha256=GTUoWKGEhkNiC0tVHkfIcXpNwd-JumY9kaqoBivKXLo,6190
|
19
|
-
geoalchemy2/admin/dialects/sqlite.py,sha256=oAx6_XFVqAcL82IyUl19QM4XjMrt-Ofc-OmMsAbjfyI,13596
|
20
|
-
geoalchemy2/types/__init__.py,sha256=xUVCOxk55Pjk_MfEwW0F1MGD5KicCazUOZ_J7J-938c,14116
|
21
|
-
geoalchemy2/types/dialects/__init__.py,sha256=Z9GgQc7pEbOMnPglXnU0tBSY7DynB5uszCwfw2CGT_k,358
|
22
|
-
geoalchemy2/types/dialects/common.py,sha256=gxKaRQhIODJhu_yBurlvFNAqGh3LfPNu_DcObEG1wlU,138
|
23
|
-
geoalchemy2/types/dialects/geopackage.py,sha256=V7XFYNQrSukCj1mIaPIDYuMZRcXolj0CWMEy057t2VY,146
|
24
|
-
geoalchemy2/types/dialects/mysql.py,sha256=I37iC1Gl78p9BF3f3RB-zBjmQcT64bN60RFXitvVsiI,1789
|
25
|
-
geoalchemy2/types/dialects/postgresql.py,sha256=4B2IPoZfV99w7KUYkazSJs7c6LjF1cALVhFgB7atKCk,1116
|
26
|
-
geoalchemy2/types/dialects/sqlite.py,sha256=e3gj-JuxVP7bHU9BjsKRjjYJK_6OYJlwGaFA3VumamM,835
|
27
|
-
GeoAlchemy2-0.14.6.dist-info/COPYING.rst,sha256=-bQKftq9uMOROzF7oN65kYBBIJKxTmBuDoftp27IC3I,1056
|
28
|
-
GeoAlchemy2-0.14.6.dist-info/METADATA,sha256=Ftgl89xSMZFX6US8QcCaZyaD4j1Oki2rUQ_yX1Qi4bQ,1980
|
29
|
-
GeoAlchemy2-0.14.6.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
30
|
-
GeoAlchemy2-0.14.6.dist-info/top_level.txt,sha256=3kGUTcfBeXd61zFpof6-qiuw1peNF_HuZabgHQgrdis,12
|
31
|
-
GeoAlchemy2-0.14.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|