geobox 1.1.1__py3-none-any.whl → 1.2.1__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.
- geobox/enums.py +18 -1
- geobox/file.py +30 -5
- {geobox-1.1.1.dist-info → geobox-1.2.1.dist-info}/METADATA +1 -1
- {geobox-1.1.1.dist-info → geobox-1.2.1.dist-info}/RECORD +7 -7
- {geobox-1.1.1.dist-info → geobox-1.2.1.dist-info}/WHEEL +0 -0
- {geobox-1.1.1.dist-info → geobox-1.2.1.dist-info}/licenses/LICENSE +0 -0
- {geobox-1.1.1.dist-info → geobox-1.2.1.dist-info}/top_level.txt +0 -0
geobox/enums.py
CHANGED
|
@@ -21,6 +21,23 @@ class PublishFileType(Enum):
|
|
|
21
21
|
MODEL3D = 'model3d'
|
|
22
22
|
|
|
23
23
|
class FileType(Enum):
|
|
24
|
+
Compressed = 'Compressed'
|
|
25
|
+
Complex = 'Complex'
|
|
26
|
+
Image = 'Image'
|
|
27
|
+
Video = 'Video'
|
|
28
|
+
Document = 'Document'
|
|
29
|
+
GPKG = 'GPKG'
|
|
30
|
+
DXF = 'DXF'
|
|
31
|
+
GPX = 'GPX'
|
|
32
|
+
CSV = 'CSV'
|
|
33
|
+
Shapefile = 'Shapefile'
|
|
34
|
+
KML = 'KML'
|
|
35
|
+
GLB = 'GLB'
|
|
36
|
+
FileGDB = 'FileGDB'
|
|
37
|
+
GeoTIFF = 'GeoTIFF'
|
|
38
|
+
GeoJSON = 'GeoJSON'
|
|
39
|
+
|
|
40
|
+
class FileFormat(Enum):
|
|
24
41
|
# Spatial Data Formats
|
|
25
42
|
Shapefile = '.shp'
|
|
26
43
|
FileGDB = '.gdb'
|
|
@@ -30,7 +47,7 @@ class FileType(Enum):
|
|
|
30
47
|
GPX = '.gpx'
|
|
31
48
|
GPKG = '.gpkg'
|
|
32
49
|
GeoJSON = '.geojson'
|
|
33
|
-
GeoTIFF = '.tiff'
|
|
50
|
+
# GeoTIFF = '.tiff'
|
|
34
51
|
|
|
35
52
|
# Image Formats
|
|
36
53
|
JPG = '.jpg'
|
geobox/file.py
CHANGED
|
@@ -6,7 +6,7 @@ import requests
|
|
|
6
6
|
import sys
|
|
7
7
|
|
|
8
8
|
from .base import Base
|
|
9
|
-
from .enums import
|
|
9
|
+
from .enums import FileFormat, PublishFileType, InputGeomType, FileType
|
|
10
10
|
from .utils import clean_data
|
|
11
11
|
from .task import Task
|
|
12
12
|
|
|
@@ -46,7 +46,7 @@ class File(Base):
|
|
|
46
46
|
Returns:
|
|
47
47
|
str: A string representation of the File object.
|
|
48
48
|
"""
|
|
49
|
-
return f"File(uuid={self.uuid}, file_name={self.name}, file_type={self.file_type})"
|
|
49
|
+
return f"File(uuid={self.uuid}, file_name={self.name}, file_type={self.file_type.value})"
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
@property
|
|
@@ -66,6 +66,23 @@ class File(Base):
|
|
|
66
66
|
return self.data.get('layers', {}).get('layers', [])
|
|
67
67
|
|
|
68
68
|
|
|
69
|
+
@property
|
|
70
|
+
def file_type(self) -> 'FileType':
|
|
71
|
+
"""
|
|
72
|
+
Get the file type
|
|
73
|
+
|
|
74
|
+
Returns:
|
|
75
|
+
FileType: the file type enumeration
|
|
76
|
+
|
|
77
|
+
Example:
|
|
78
|
+
>>> from geobox import GeoboxClient
|
|
79
|
+
>>> client = GeoboxClient()
|
|
80
|
+
>>> file = File.get_file(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
81
|
+
>>> file.file_type
|
|
82
|
+
"""
|
|
83
|
+
return FileType(self.data.get('file_type'))
|
|
84
|
+
|
|
85
|
+
|
|
69
86
|
@classmethod
|
|
70
87
|
def upload_file(cls, api: 'GeoboxClient', path: str, user_id: int = None, scan_archive: bool = True) -> 'File':
|
|
71
88
|
"""
|
|
@@ -97,7 +114,7 @@ class File(Base):
|
|
|
97
114
|
raise FileNotFoundError(f"File not found: {path}")
|
|
98
115
|
|
|
99
116
|
# Check if the file type is valid
|
|
100
|
-
|
|
117
|
+
FileFormat(os.path.splitext(path)[1])
|
|
101
118
|
|
|
102
119
|
data = clean_data({
|
|
103
120
|
"user_id": user_id,
|
|
@@ -355,8 +372,8 @@ class File(Base):
|
|
|
355
372
|
|
|
356
373
|
|
|
357
374
|
def publish(self,
|
|
358
|
-
publish_as: 'PublishFileType',
|
|
359
375
|
name: str,
|
|
376
|
+
publish_as: 'PublishFileType' = None,
|
|
360
377
|
input_geom_type: 'InputGeomType' = None,
|
|
361
378
|
input_layer: str = None,
|
|
362
379
|
input_dataset: str = None,
|
|
@@ -370,8 +387,8 @@ class File(Base):
|
|
|
370
387
|
Publishes a file as a layer.
|
|
371
388
|
|
|
372
389
|
Args:
|
|
373
|
-
publish_as (PublishFileType): The type of layer to publish as.
|
|
374
390
|
name (str): The name of the layer.
|
|
391
|
+
publish_as (PublishFileType): The type of layer to publish as.
|
|
375
392
|
input_geom_type (InputGeomType, optional): The geometry type of the layer.
|
|
376
393
|
input_layer (str, optional): The name of the input layer.
|
|
377
394
|
input_dataset (str, optional): The name of the input dataset.
|
|
@@ -401,6 +418,14 @@ class File(Base):
|
|
|
401
418
|
... input_srid=4326,
|
|
402
419
|
... file_encoding='utf-8')
|
|
403
420
|
"""
|
|
421
|
+
if not publish_as:
|
|
422
|
+
if self.file_type.value in ['GeoJSON', 'GPKG', 'DXF', 'GPX', 'Shapefile', 'KML', 'CSV', 'FileGDB']:
|
|
423
|
+
publish_as = PublishFileType.VECTOR
|
|
424
|
+
elif self.file_type.value in ['GeoTIFF']:
|
|
425
|
+
publish_as = PublishFileType.RASTER
|
|
426
|
+
elif self.file_type.value in ['GLB']:
|
|
427
|
+
publish_as = PublishFileType.MODEL3D
|
|
428
|
+
|
|
404
429
|
data = clean_data({
|
|
405
430
|
"publish_as": publish_as.value if isinstance(publish_as, PublishFileType) else publish_as,
|
|
406
431
|
"layer_name": name,
|
|
@@ -5,11 +5,11 @@ geobox/attachment.py,sha256=XbGwfWWuFAMimj4tsjKBvlSLP-rhpNACCtxgRmUvcdY,11631
|
|
|
5
5
|
geobox/base.py,sha256=p0UVZo9CINw0mW9o0nNR_VNCk7V1r-FrLQ_NH39WARE,12299
|
|
6
6
|
geobox/basemap.py,sha256=fDWwkMf-F2NTE1tVLijoxQku55825b6gj8nk69TMOII,4386
|
|
7
7
|
geobox/dashboard.py,sha256=MYyT3YJEGPCbTXHcYoZmn14rFOaut1J3idEA8bCdFgI,11762
|
|
8
|
-
geobox/enums.py,sha256=
|
|
8
|
+
geobox/enums.py,sha256=jGs8GzyCzQMJ5go9owDKMiAwuWjDCpKPaNmQg2eiCaQ,6613
|
|
9
9
|
geobox/exception.py,sha256=jvpnv0M2Ck1FpxHTL_aKYWxGvLnCQ3d9vOrMIktjw1U,1507
|
|
10
10
|
geobox/feature.py,sha256=3Kbc1LjIkBt1YqRAry84BrR7qxx9BexvBB3YQ8D9mGk,18504
|
|
11
11
|
geobox/field.py,sha256=2VxjeYgRwnDxHYpAsK0ASOCz8V0JmfTA3GqHDv3rfgQ,10526
|
|
12
|
-
geobox/file.py,sha256=
|
|
12
|
+
geobox/file.py,sha256=NqN9EoSGMiTev5vo_1QKciofcyoXonLoZz7B8hH_igk,19352
|
|
13
13
|
geobox/log.py,sha256=ZTmVErhyAszf7M5YFxT5mqXNNDGPnRwXPeGLDS1G6PE,3582
|
|
14
14
|
geobox/map.py,sha256=98P1gbB5U_eu71Hu6EQ0kL_ponbPAnoOCitjEa35q4I,31307
|
|
15
15
|
geobox/model3d.py,sha256=qRYCx-q9LpGhdu5oz3av0uUoiDimuk4BvXXwMW5bo9Q,12061
|
|
@@ -30,8 +30,8 @@ geobox/vectorlayer.py,sha256=xnYsJei-bpKgM_EJlRbZ-bAIHdmvfU-VZ2t-NEEJCfc,49420
|
|
|
30
30
|
geobox/version.py,sha256=0GLPhxCeEb2bAkdpPJWtXPXc1KP6kQ_TOMwLAL0ldo0,9374
|
|
31
31
|
geobox/view.py,sha256=fRYlzNu4eGl6Zx9gPom47BkVE8DfWLj0bNlW2-u4TOU,37390
|
|
32
32
|
geobox/workflow.py,sha256=6hKnSw4G0_ZlgmUb0g3fxT-UVsFbiYpF2FbEO5fpQv0,11606
|
|
33
|
-
geobox-1.
|
|
34
|
-
geobox-1.
|
|
35
|
-
geobox-1.
|
|
36
|
-
geobox-1.
|
|
37
|
-
geobox-1.
|
|
33
|
+
geobox-1.2.1.dist-info/licenses/LICENSE,sha256=AvFB7W94sJYKLDhBxLRshL3upexCOG8HQY_1JibB96w,1063
|
|
34
|
+
geobox-1.2.1.dist-info/METADATA,sha256=toqzfxiUTgzmI9Vn5BAIN6v1D_4HGsT-naLcNP4F-28,2556
|
|
35
|
+
geobox-1.2.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
36
|
+
geobox-1.2.1.dist-info/top_level.txt,sha256=ppXH8Bu2mlB-pLQ6lsoWEm2Gr6wZx1uzkhetsYA5ins,7
|
|
37
|
+
geobox-1.2.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|