ellipsis 3.1.45__py3-none-any.whl → 3.1.46__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.
Potentially problematic release.
This version of ellipsis might be problematic. Click here for more details.
- ellipsis/__init__.py +1 -2
- ellipsis/path/__init__.py +1 -0
- ellipsis/path/bookmark/__init__.py +2 -0
- ellipsis/path/bookmark/root.py +39 -0
- ellipsis/path/pointCloud/timestamp/file/root.py +20 -5
- ellipsis/path/raster/timestamp/__init__.py +1 -3
- ellipsis/path/raster/timestamp/file/root.py +22 -8
- ellipsis/path/raster/timestamp/root.py +41 -91
- ellipsis/path/vector/timestamp/feature/root.py +24 -99
- ellipsis/path/vector/timestamp/file/root.py +24 -8
- ellipsis/path/vector/timestamp/order/root.py +3 -2
- ellipsis/path/vector/timestamp/root.py +10 -11
- ellipsis/util/__init__.py +1 -0
- ellipsis/util/root.py +25 -10
- {ellipsis-3.1.45.dist-info → ellipsis-3.1.46.dist-info}/METADATA +1 -1
- {ellipsis-3.1.45.dist-info → ellipsis-3.1.46.dist-info}/RECORD +19 -19
- ellipsis/view/__init__.py +0 -3
- ellipsis/view/root.py +0 -59
- {ellipsis-3.1.45.dist-info → ellipsis-3.1.46.dist-info}/LICENSE +0 -0
- {ellipsis-3.1.45.dist-info → ellipsis-3.1.46.dist-info}/WHEEL +0 -0
- {ellipsis-3.1.45.dist-info → ellipsis-3.1.46.dist-info}/top_level.txt +0 -0
ellipsis/__init__.py
CHANGED
ellipsis/path/__init__.py
CHANGED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
from ellipsis import apiManager
|
|
2
|
+
from ellipsis import sanitize
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def get(pathId, token=None):
|
|
6
|
+
token = sanitize.validString('token', token, False)
|
|
7
|
+
pathId = sanitize.validUuid('pathId', pathId, True)
|
|
8
|
+
|
|
9
|
+
r = apiManager.get('/path/' + pathId + '/bookmark', {}, token)
|
|
10
|
+
|
|
11
|
+
return r
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def add(name, bookmark, token, parentId = None, publicAccess = None, metadata=None):
|
|
16
|
+
token = sanitize.validString('token', token, True)
|
|
17
|
+
bookmark = sanitize.validObject('bookmark', bookmark, True)
|
|
18
|
+
name = sanitize.validString('pathId', name, False)
|
|
19
|
+
metadata = sanitize.validObject('metadata', metadata, False)
|
|
20
|
+
publicAccess = sanitize.validObject('publicAccess', publicAccess, False)
|
|
21
|
+
parentId = sanitize.validUuid('parentId', parentId, False)
|
|
22
|
+
|
|
23
|
+
r = apiManager.post('/path/bookmark', {'name':name, 'bookmark':bookmark , 'parentId':parentId, 'publicAccess':publicAccess, 'metadata':metadata}, token)
|
|
24
|
+
|
|
25
|
+
return r
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def edit(pathId, token, layers=None, dems=None):
|
|
29
|
+
layers = sanitize.validObject('layers', layers, False)
|
|
30
|
+
dems = sanitize.validObject('dems', dems, False)
|
|
31
|
+
pathId = sanitize.validUuid('pathId', pathId, True)
|
|
32
|
+
|
|
33
|
+
r = apiManager.patch('/path/' + pathId + '/bookmark', {'layers':layers, 'dems':dems}, token)
|
|
34
|
+
|
|
35
|
+
return r
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
@@ -6,19 +6,34 @@ import os
|
|
|
6
6
|
import numpy as np
|
|
7
7
|
import geopandas as gpd
|
|
8
8
|
|
|
9
|
-
def add(pathId, timestampId, filePath,
|
|
9
|
+
def add(pathId, timestampId, token, fileFormat, filePath = None, memFile =None, name=None, epsg = None):
|
|
10
10
|
token = sanitize.validString('token', token, True)
|
|
11
11
|
pathId = sanitize.validUuid('pathId', pathId, True)
|
|
12
12
|
timestampId = sanitize.validUuid('timestampId', timestampId, True)
|
|
13
|
-
filePath = sanitize.validString('filePath', filePath,
|
|
13
|
+
filePath = sanitize.validString('filePath', filePath, False)
|
|
14
14
|
epsg = sanitize.validInt('epsg', epsg, True)
|
|
15
15
|
fileFormat = sanitize.validString('fileFormat', fileFormat, True)
|
|
16
|
+
name = sanitize.validString('name', name, False)
|
|
17
|
+
|
|
18
|
+
if type(memFile) == type(None) and type(filePath) == type(None):
|
|
19
|
+
raise ValueError('You need to specify either a filePath or a memFile')
|
|
20
|
+
|
|
21
|
+
if type(memFile) != type(None) and type(name) == type(None):
|
|
22
|
+
raise ValueError('Parameter name is required when using a memory file')
|
|
23
|
+
|
|
24
|
+
if type(name ) == type(None):
|
|
25
|
+
seperator = os.path.sep
|
|
26
|
+
fileName = filePath.split(seperator)[len(filePath.split(seperator))-1 ]
|
|
27
|
+
else:
|
|
28
|
+
fileName = name
|
|
16
29
|
|
|
17
|
-
seperator = os.path.sep
|
|
18
|
-
fileName = filePath.split(seperator)[len(filePath.split(seperator))-1 ]
|
|
19
30
|
|
|
20
31
|
body = {'name':fileName, 'epsg':epsg, 'format':fileFormat}
|
|
21
|
-
|
|
32
|
+
if type(memFile) == type(None):
|
|
33
|
+
r = apiManager.upload('/path/' + pathId + '/pointCloud/timestamp/' + timestampId + '/file' , filePath, body, token)
|
|
34
|
+
else:
|
|
35
|
+
r = apiManager.upload('/path/' + pathId + '/pointCloud/timestamp/' + timestampId + '/file' , name, body, token, memfile=memFile)
|
|
36
|
+
|
|
22
37
|
return r
|
|
23
38
|
|
|
24
39
|
def get(pathId, timestampId, token, pageStart= None, listAll = True):
|
|
@@ -6,13 +6,11 @@ from ellipsis.path.raster.timestamp.root import deactivate
|
|
|
6
6
|
from ellipsis.path.raster.timestamp.root import getBounds
|
|
7
7
|
from ellipsis.path.raster.timestamp.root import analyse
|
|
8
8
|
from ellipsis.path.raster.timestamp.root import getRaster
|
|
9
|
-
from ellipsis.path.raster.timestamp.root import getDownsampledRaster
|
|
10
9
|
from ellipsis.path.raster.timestamp.root import trash
|
|
11
10
|
from ellipsis.path.raster.timestamp.root import recover
|
|
12
11
|
from ellipsis.path.raster.timestamp.root import getSampledRaster
|
|
13
|
-
from ellipsis.path.raster.timestamp.root import getValuesAlongLine
|
|
14
12
|
from ellipsis.path.raster.timestamp.root import contour
|
|
15
|
-
|
|
13
|
+
from ellipsis.path.raster.timestamp.root import getLocationInfo
|
|
16
14
|
from ellipsis.path.raster.timestamp import file
|
|
17
15
|
from ellipsis.path.raster.timestamp import order
|
|
18
16
|
|
|
@@ -6,21 +6,35 @@ import os
|
|
|
6
6
|
import numpy as np
|
|
7
7
|
import geopandas as gpd
|
|
8
8
|
|
|
9
|
-
def add(pathId, timestampId,
|
|
9
|
+
def add(pathId, timestampId, token, fileFormat, filePath=None, memFile = None, epsg = None, noDataValue = None, mosaicPriority = None, name = None):
|
|
10
10
|
token = sanitize.validString('token', token, True)
|
|
11
11
|
pathId = sanitize.validUuid('pathId', pathId, True)
|
|
12
12
|
timestampId = sanitize.validUuid('timestampId', timestampId, True)
|
|
13
|
-
filePath = sanitize.validString('filePath', filePath,
|
|
14
|
-
|
|
13
|
+
filePath = sanitize.validString('filePath', filePath, False)
|
|
14
|
+
name = sanitize.validString('name', name, False)
|
|
15
|
+
noDataValue = sanitize.validFloat('noDataValue', noDataValue, False)
|
|
15
16
|
epsg = sanitize.validInt('epsg', epsg, False)
|
|
16
17
|
fileFormat = sanitize.validString('fileFormat', fileFormat, True)
|
|
17
18
|
mosaicPriority = sanitize.validString('mosaicPriority', mosaicPriority, False)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
|
|
20
|
+
if type(memFile) == type(None) and type(filePath) == type(None):
|
|
21
|
+
raise ValueError('You need to specify either a filePath or a memFile')
|
|
22
|
+
|
|
23
|
+
if type(memFile) != type(None) and type(name) == type(None):
|
|
24
|
+
raise ValueError('Parameter name is required when using a memory file')
|
|
25
|
+
|
|
26
|
+
if type(name ) == type(None):
|
|
27
|
+
seperator = os.path.sep
|
|
28
|
+
fileName = filePath.split(seperator)[len(filePath.split(seperator))-1 ]
|
|
29
|
+
else:
|
|
30
|
+
fileName = name
|
|
31
|
+
|
|
22
32
|
body = {'name':fileName, 'epsg':epsg, 'noDataValue': noDataValue, 'format':fileFormat, 'mosaicPriority':mosaicPriority}
|
|
23
|
-
|
|
33
|
+
if type(memFile) == type(None):
|
|
34
|
+
r = apiManager.upload('/path/' + pathId + '/raster/timestamp/' + timestampId + '/file' , filePath, body, token)
|
|
35
|
+
else:
|
|
36
|
+
r = apiManager.upload('/path/' + pathId + '/raster/timestamp/' + timestampId + '/file' , name, body, token, memfile = memFile)
|
|
37
|
+
|
|
24
38
|
return r
|
|
25
39
|
|
|
26
40
|
def get(pathId, timestampId, token, pageStart= None, listAll = True):
|
|
@@ -23,42 +23,41 @@ import requests
|
|
|
23
23
|
from skimage.measure import find_contours
|
|
24
24
|
from shapely.geometry import Point, LineString
|
|
25
25
|
|
|
26
|
-
def
|
|
27
|
-
return getSampledRaster(pathId, timestampId, extent, width, height, epsg, style, token)
|
|
28
|
-
|
|
29
|
-
def getSampledRaster(pathId, timestampId, extent, width, height, epsg=4326, style = None, token = None):
|
|
30
|
-
bounds = extent
|
|
26
|
+
def getSampledRaster(pathId, timestampId, extent, width, height, epsg=3857, token = None):
|
|
31
27
|
token = sanitize.validString('token', token, False)
|
|
32
28
|
pathId = sanitize.validUuid('pathId', pathId, True)
|
|
33
29
|
timestampId = sanitize.validUuid('timestampId', timestampId, True)
|
|
34
|
-
|
|
35
|
-
style = sanitize.validObject('style', style, False)
|
|
30
|
+
extent = sanitize.validBounds('extent', extent, True)
|
|
36
31
|
epsg = sanitize.validInt('epsg', epsg, True)
|
|
37
|
-
body = {'pathId':pathId, 'timestampId':timestampId, 'extent':bounds, 'width':width, 'height':height, 'style':style, 'epsg':epsg}
|
|
38
32
|
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
res = getActualExtent(extent['xMin'], extent['xMax'], extent['yMin'], extent['yMax'], 'EPSG:' + str(epsg))
|
|
34
|
+
|
|
35
|
+
if res['status'] == '400':
|
|
36
|
+
raise ValueError('Invalid epsg and extent combination')
|
|
37
|
+
|
|
38
|
+
extentWeb = res['message']
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
body = {'pathId':pathId, 'timestampId':timestampId, 'extent':extentWeb, 'width':width, 'height':height, 'applyStyle':False}
|
|
43
|
+
|
|
41
44
|
|
|
42
45
|
r = apiManager.get('/path/' + pathId + '/raster/timestamp/' + timestampId + '/rasterByExtent', body, token, crash = True, parseJson = False)
|
|
43
46
|
|
|
44
47
|
|
|
45
|
-
|
|
46
|
-
r = tifffile.imread(BytesIO(r.content))
|
|
47
|
-
else:
|
|
48
|
-
r = np.array(Image.open(BytesIO(r.content)))
|
|
49
|
-
#tif also has bands in last channel
|
|
50
|
-
r = np.transpose(r, [2,0,1])
|
|
48
|
+
r = tifffile.imread(BytesIO(r.content))
|
|
51
49
|
|
|
52
|
-
|
|
53
|
-
yMin = bounds['yMin']
|
|
54
|
-
xMax = bounds['xMax']
|
|
55
|
-
yMax = bounds['yMax']
|
|
50
|
+
r = np.transpose(r, [2,0,1])
|
|
56
51
|
|
|
57
52
|
|
|
58
53
|
|
|
59
|
-
trans = rasterio.transform.from_bounds(xMin, yMin, xMax, yMax, r.shape[2], r.shape[1])
|
|
60
54
|
|
|
61
|
-
|
|
55
|
+
if epsg != 3857:
|
|
56
|
+
return reprojectRaster(r=r, sourceExtent=extentWeb, targetExtent=extent, targetWidth=r.shape[2],
|
|
57
|
+
targetHeight=r.shape[1], sourceEpsg=3857, targetEpsg=epsg, interpolation='nearest')
|
|
58
|
+
else:
|
|
59
|
+
trans = rasterio.transform.from_bounds( extent['xMin'], extent['yMin'], extent['xMax'], extent['yMax'], r.shape[2], r.shape[1])
|
|
60
|
+
return {'raster': r, 'transform':trans, 'extent': extent, 'crs':"EPSG:" + str(epsg) }
|
|
62
61
|
|
|
63
62
|
|
|
64
63
|
def contour(pathId, timestampId, extent, interval = None, intervals = None, epsg = 4326, bandNumber = 1, token = None):
|
|
@@ -93,9 +92,11 @@ def contour(pathId, timestampId, extent, interval = None, intervals = None, epsg
|
|
|
93
92
|
if type(intervals) == type(None):
|
|
94
93
|
minVal = np.min(raster[bandNumber-1, raster[-1,:,:] == 1])
|
|
95
94
|
maxVal = np.max(raster[bandNumber-1, raster[-1,:,:] == 1])
|
|
95
|
+
|
|
96
|
+
if type(interval) == type(None):
|
|
97
|
+
interval = (maxVal - minVal) /10
|
|
96
98
|
|
|
97
|
-
|
|
98
|
-
cont = minVal + interval
|
|
99
|
+
cont = minVal
|
|
99
100
|
|
|
100
101
|
conts = []
|
|
101
102
|
while cont < maxVal:
|
|
@@ -114,7 +115,6 @@ def contour(pathId, timestampId, extent, interval = None, intervals = None, epsg
|
|
|
114
115
|
lines = find_contours(raster[bandNumber-1,:,:], mask=raster[-1,:,:] == 1, level = cont)
|
|
115
116
|
|
|
116
117
|
newLines = []
|
|
117
|
-
line = lines[0]
|
|
118
118
|
for line in lines:
|
|
119
119
|
newLine = LineString([ Point( xMinWeb + x[0] * Lx , yMinWeb + x[1] * Ly ) for x in line])
|
|
120
120
|
newLines = newLines + [newLine]
|
|
@@ -130,69 +130,25 @@ def contour(pathId, timestampId, extent, interval = None, intervals = None, epsg
|
|
|
130
130
|
return sh
|
|
131
131
|
|
|
132
132
|
|
|
133
|
-
def
|
|
133
|
+
def getLocationInfo(pathId, timestampId, locations, epsg = 4326, token= None):
|
|
134
134
|
pathId = sanitize.validUuid('pathId', pathId, True)
|
|
135
135
|
timestampId = sanitize.validUuid('timestampId', timestampId, True)
|
|
136
136
|
token = sanitize.validString('token', token, False)
|
|
137
|
-
line = sanitize.validShapely('line', line, True)
|
|
138
137
|
epsg = sanitize.validInt('epsg', epsg, True)
|
|
139
138
|
|
|
140
|
-
if
|
|
141
|
-
|
|
139
|
+
if epsg != 4326:
|
|
140
|
+
points = [Point(l) for l in locations]
|
|
141
|
+
sh = gpd.GeoDataFrame({'geometry':points})
|
|
142
|
+
sh.crs = 'EPSG:' + str(epsg)
|
|
143
|
+
sh.to_crs('EPSG:4326')
|
|
144
|
+
locations = [ l for l in zip(sh.bounds['minx'], sh.bounds['miny'] )]
|
|
145
|
+
body = {'locations':locations}
|
|
142
146
|
|
|
143
|
-
|
|
144
|
-
temp.crs = 'EPSG:' + str(epsg)
|
|
145
|
-
temp = temp.to_crs('EPSG:3857')
|
|
146
|
-
line = temp['geometry'].values[0]
|
|
147
|
-
line = list(line.coords)
|
|
148
|
-
|
|
149
|
-
x_of_line = [p[0] for p in line]
|
|
150
|
-
y_of_line = [p[1] for p in line]
|
|
151
|
-
|
|
152
|
-
#the first action is to cacluate a bounding box for the raster we need to retrieve
|
|
153
|
-
xMin = min(x_of_line)
|
|
154
|
-
xMax = max(x_of_line)
|
|
155
|
-
yMin = min(y_of_line)
|
|
156
|
-
yMax = max(y_of_line)
|
|
157
|
-
|
|
158
|
-
d = (xMax - xMin) * 0.1
|
|
159
|
-
xMax = xMax + d
|
|
160
|
-
xMin = xMin -d
|
|
161
|
-
d = (yMax - yMin) * 0.1
|
|
162
|
-
yMax = yMax + d
|
|
163
|
-
yMin = yMin -d
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
#now we retrieve the needed raster we use epsg = 4326 but we can use other coordinates as well
|
|
168
|
-
extent = {'xMin': xMin, 'xMax':xMax, 'yMin':yMin, 'yMax':yMax}
|
|
169
|
-
|
|
170
|
-
size = 1000
|
|
171
|
-
r = getSampledRaster(pathId = pathId, timestampId = timestampId, extent = extent, width = size, height = size, epsg=3857, token = token)
|
|
172
|
-
raster = r['raster']
|
|
173
|
-
|
|
174
|
-
memfile = MemoryFile()
|
|
175
|
-
dataset = memfile.open( driver='GTiff', dtype='float32', height=size, width=size, count = raster.shape[0], crs= r['crs'], transform=r['transform'])
|
|
176
|
-
dataset.write(raster)
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
values = list(dataset.sample(line))
|
|
181
|
-
|
|
182
|
-
memfile.close()
|
|
183
|
-
return values
|
|
184
|
-
|
|
185
|
-
def getLocationInfo(pathId, timestampId, locations, epsg = 4326, token= None):
|
|
186
|
-
pathId = sanitize.validUuid('pathId', pathId, True)
|
|
187
|
-
timestampId = sanitize.validUuid('timestampId', timestampId, True)
|
|
188
|
-
token = sanitize.validString('token', token, False)
|
|
189
|
-
epsg = sanitize.validInt('epsg', epsg, True)
|
|
190
|
-
body = {'locations':locations,'epsg':epsg}
|
|
191
|
-
r = apiManager.post('/path/' + pathId + '/raster/timestamp/' + timestampId + '/location', body, token)
|
|
147
|
+
r = apiManager.get('/path/' + pathId + '/raster/timestamp/' + timestampId + '/location', body, token)
|
|
192
148
|
return r
|
|
193
149
|
|
|
194
150
|
|
|
195
|
-
def getRaster(pathId, timestampId, extent, token = None, showProgress = True, epsg =
|
|
151
|
+
def getRaster(pathId, timestampId, extent, token = None, showProgress = True, epsg = 3857):
|
|
196
152
|
bounds = extent
|
|
197
153
|
|
|
198
154
|
token = sanitize.validString('token', token, False)
|
|
@@ -200,12 +156,7 @@ def getRaster(pathId, timestampId, extent, token = None, showProgress = True, ep
|
|
|
200
156
|
timestampId = sanitize.validUuid('timestampId', timestampId, True)
|
|
201
157
|
bounds = sanitize.validBounds('bounds', bounds, True)
|
|
202
158
|
showProgress = sanitize.validBool('showProgress', showProgress, True)
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
if type(threads)!= type(None):
|
|
206
|
-
Warning('The parameter threads is deprecated')
|
|
207
|
-
if type(style)!= type(None):
|
|
208
|
-
Warning('The parameter style is deprecated')
|
|
159
|
+
|
|
209
160
|
|
|
210
161
|
xMin = bounds['xMin']
|
|
211
162
|
yMin = bounds['yMin']
|
|
@@ -241,7 +192,6 @@ def getRaster(pathId, timestampId, extent, token = None, showProgress = True, ep
|
|
|
241
192
|
|
|
242
193
|
zoom = t['zoom']
|
|
243
194
|
|
|
244
|
-
body = {"applyStyle":False}
|
|
245
195
|
|
|
246
196
|
LEN = 2.003751e+07
|
|
247
197
|
|
|
@@ -294,7 +244,6 @@ def getRaster(pathId, timestampId, extent, token = None, showProgress = True, ep
|
|
|
294
244
|
|
|
295
245
|
def fetch(tileX, tileY):
|
|
296
246
|
if tarred:
|
|
297
|
-
|
|
298
247
|
cuts = cutOfTilesPerZoom[zoom]
|
|
299
248
|
|
|
300
249
|
zones = [{'name': 'zone0', 'offset':0, 'start':cuts['start'][0] , 'end':cuts['end'][0]}, ]
|
|
@@ -316,8 +265,8 @@ def getRaster(pathId, timestampId, extent, token = None, showProgress = True, ep
|
|
|
316
265
|
frac_w = int(w/2**offset)
|
|
317
266
|
|
|
318
267
|
url = apiManager.baseUrl + '/path/' + pathId + '/raster/timestamp/' + timestampId + '/tarTile/' + str(zoom_c) + '/' + str(tileX_c) + '/' + str(tileY_c)
|
|
319
|
-
|
|
320
|
-
|
|
268
|
+
url = url + '?applyStyle=false'
|
|
269
|
+
|
|
321
270
|
if str(type(token)) == str(type(None)):
|
|
322
271
|
r = requests.get(url)
|
|
323
272
|
else:
|
|
@@ -327,6 +276,7 @@ def getRaster(pathId, timestampId, extent, token = None, showProgress = True, ep
|
|
|
327
276
|
r = requests.get(url, headers={"Authorization": token})
|
|
328
277
|
|
|
329
278
|
else:
|
|
279
|
+
body = {'applyStyle':False}
|
|
330
280
|
r = apiManager.get('/path/' + pathId + '/raster/timestamp/' + timestampId + '/tile/' + str(zoom) + '/' + str(tileX) + '/' + str(tileY), body, token, False)
|
|
331
281
|
|
|
332
282
|
if r.status_code == 403:
|
|
@@ -395,10 +345,10 @@ def getRaster(pathId, timestampId, extent, token = None, showProgress = True, ep
|
|
|
395
345
|
r_total = r_total[:,min_y_index:max_y_index,min_x_index:max_x_index]
|
|
396
346
|
|
|
397
347
|
mercatorExtent = {'xMin' : xMinWeb, 'yMin': yMinWeb, 'xMax': xMaxWeb, 'yMax': yMaxWeb}
|
|
398
|
-
if
|
|
348
|
+
if epsg == 3857:
|
|
399
349
|
trans = rasterio.transform.from_bounds(xMinWeb, yMinWeb, xMaxWeb, yMaxWeb, r_total.shape[2], r_total.shape[1])
|
|
400
350
|
|
|
401
|
-
return {'raster': r_total, 'transform':trans, 'extent':mercatorExtent, '
|
|
351
|
+
return {'raster': r_total, 'transform':trans, 'extent':mercatorExtent, 'crs': 'EPSG:' + str(3857)}
|
|
402
352
|
else:
|
|
403
353
|
return reprojectRaster(r = r_total, sourceExtent = mercatorExtent, targetExtent = extent, targetWidth=r_total.shape[2], targetHeight=r_total.shape[1], sourceEpsg = 3857, targetEpsg= epsg, interpolation = 'nearest')
|
|
404
354
|
|
|
@@ -10,73 +10,8 @@ import json
|
|
|
10
10
|
import geopandas as gpd
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
levelOfDetail2 = sanitize.validGeoSeries('levelOfDetail2', levelOfDetail2, False)
|
|
16
|
-
levelOfDetail3 = sanitize.validGeoSeries('levelOfDetail3', levelOfDetail3, False)
|
|
17
|
-
levelOfDetail4 = sanitize.validGeoSeries('levelOfDetail4', levelOfDetail4, False)
|
|
18
|
-
levelOfDetail5 = sanitize.validGeoSeries('levelOfDetail5', levelOfDetail5, False)
|
|
19
|
-
|
|
20
|
-
if type(levelOfDetail1) != type(None) and len(levelOfDetail1) != features.shape[0]:
|
|
21
|
-
raise ValueError('levelsOfDetail1 must have same length as number of rows in features')
|
|
22
|
-
if type(levelOfDetail2) != type(None) and len(levelOfDetail2) != features.shape[0]:
|
|
23
|
-
raise ValueError('levelsOfDetail2 must have same length as number of rows in features')
|
|
24
|
-
if type(levelOfDetail3) != type(None) and len(levelOfDetail3) != features.shape[0]:
|
|
25
|
-
raise ValueError('levelsOfDetail3 must have same length as number of rows in features')
|
|
26
|
-
if type(levelOfDetail4) != type(None) and len(levelOfDetail4) != features.shape[0]:
|
|
27
|
-
raise ValueError('levelsOfDetail4 must have same length as number of rows in features')
|
|
28
|
-
if type(levelOfDetail5) != type(None) and len(levelOfDetail5) != features.shape[0]:
|
|
29
|
-
raise ValueError('levelsOfDetail5 must have same length as number of rows in features')
|
|
30
|
-
|
|
31
|
-
if type(levelOfDetail2) != type(None) and type(levelOfDetail1) == type(None):
|
|
32
|
-
raise ValueError('If levelOfDetail2 is defined so should levelOfDetail1')
|
|
33
|
-
if type(levelOfDetail3) != type(None) and type(levelOfDetail2) == type(None):
|
|
34
|
-
raise ValueError('If levelOfDetail3 is defined so should levelOfDetail2')
|
|
35
|
-
if type(levelOfDetail4) != type(None) and type(levelOfDetail3) == type(None):
|
|
36
|
-
raise ValueError('If levelOfDetail4 is defined so should levelOfDetail3')
|
|
37
|
-
if type(levelOfDetail5) != type(None) and type(levelOfDetail4) == type(None):
|
|
38
|
-
raise ValueError('If levelOfDetail5 is defined so should levelOfDetail4')
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if type(levelOfDetail1) != type(None):
|
|
42
|
-
levelOfDetail1 = levelOfDetail1.to_json()
|
|
43
|
-
levelOfDetail1 = json.loads(levelOfDetail1)
|
|
44
|
-
levelOfDetail1 = np.array( [ x['geometry'] for x in levelOfDetail1['features'] ])
|
|
45
|
-
if type(levelOfDetail2) != type(None):
|
|
46
|
-
levelOfDetail2 = levelOfDetail2.to_json()
|
|
47
|
-
levelOfDetail2 = json.loads(levelOfDetail2)
|
|
48
|
-
levelOfDetail2 = np.array( [ x['geometry'] for x in levelOfDetail2['features'] ])
|
|
49
|
-
if type(levelOfDetail3) != type(None):
|
|
50
|
-
levelOfDetail3 = levelOfDetail3.to_json()
|
|
51
|
-
levelOfDetail3 = json.loads(levelOfDetail3)
|
|
52
|
-
levelOfDetail3 = np.array( [ x['geometry'] for x in levelOfDetail3['features'] ])
|
|
53
|
-
if type(levelOfDetail4) != type(None):
|
|
54
|
-
levelOfDetail4 = levelOfDetail4.to_json()
|
|
55
|
-
levelOfDetail4 = json.loads(levelOfDetail4)
|
|
56
|
-
levelOfDetail4 = np.array( [ x['geometry'] for x in levelOfDetail4['features'] ])
|
|
57
|
-
if type(levelOfDetail5) != type(None):
|
|
58
|
-
levelOfDetail5 = levelOfDetail5.to_json()
|
|
59
|
-
levelOfDetail5 = json.loads(levelOfDetail5)
|
|
60
|
-
levelOfDetail5 = np.array( [ x['geometry'] for x in levelOfDetail5['features'] ])
|
|
61
|
-
|
|
62
|
-
return levelOfDetail1, levelOfDetail2, levelOfDetail3, levelOfDetail4, levelOfDetail5
|
|
63
|
-
|
|
64
|
-
def zipLevels(levelOfDetail1, levelOfDetail2, levelOfDetail3, levelOfDetail4, levelOfDetail5, indices_sub):
|
|
65
|
-
if type(levelOfDetail5) != type(None):
|
|
66
|
-
levels = list(zip(levelOfDetail1[indices_sub], levelOfDetail2[indices_sub], levelOfDetail3[indices_sub], levelOfDetail4[indices_sub], levelOfDetail5[indices_sub]))
|
|
67
|
-
elif type(levelOfDetail4) != type(None):
|
|
68
|
-
levels = list(zip(levelOfDetail1[indices_sub], levelOfDetail2[indices_sub], levelOfDetail3[indices_sub], levelOfDetail4[indices_sub]))
|
|
69
|
-
elif type(levelOfDetail3) != type(None):
|
|
70
|
-
levels = list(zip(levelOfDetail1[indices_sub], levelOfDetail2[indices_sub], levelOfDetail3[indices_sub]))
|
|
71
|
-
elif type(levelOfDetail2) != type(None):
|
|
72
|
-
levels = list(zip(levelOfDetail1[indices_sub], levelOfDetail2[indices_sub]))
|
|
73
|
-
elif type(levelOfDetail1) != type(None):
|
|
74
|
-
levels = list(zip(levelOfDetail1[indices_sub]))
|
|
75
|
-
else:
|
|
76
|
-
levels = None
|
|
77
|
-
return levels
|
|
78
|
-
|
|
79
|
-
def add(pathId, timestampId, features, token, showProgress = True, levelOfDetail1 = None, levelOfDetail2 = None, levelOfDetail3 = None, levelOfDetail4 = None, levelOfDetail5 = None, cores = 1):
|
|
13
|
+
|
|
14
|
+
def add(pathId, timestampId, features, token, showProgress = True, cores = 1):
|
|
80
15
|
pathId = sanitize.validUuid('pathId', pathId, True)
|
|
81
16
|
timestampId = sanitize.validUuid('timestampId', timestampId, True)
|
|
82
17
|
token = sanitize.validString('token', token, True)
|
|
@@ -84,17 +19,16 @@ def add(pathId, timestampId, features, token, showProgress = True, levelOfDetail
|
|
|
84
19
|
cores = sanitize.validInt('cores', cores, True)
|
|
85
20
|
features = sanitize.validGeopandas('features', features, True, cores = cores)
|
|
86
21
|
|
|
87
|
-
levelOfDetail1, levelOfDetail2, levelOfDetail3, levelOfDetail4, levelOfDetail5 = manageLevels(levelOfDetail1, levelOfDetail2, levelOfDetail3, levelOfDetail4, levelOfDetail5, features)
|
|
88
22
|
features_json = features.to_json(na='drop')
|
|
89
23
|
features_json = json.loads(features_json)
|
|
90
24
|
features_json = np.array(features_json['features'])
|
|
91
|
-
|
|
25
|
+
|
|
92
26
|
#check if first time
|
|
93
27
|
firstTime = apiManager.get('/path/' + pathId, None, token)
|
|
94
28
|
if not 'vector' in firstTime.keys():
|
|
95
29
|
raise ValueError('Can only add features if path is of type vector')
|
|
96
30
|
firstTime = len(firstTime['vector']['properties']) ==0
|
|
97
|
-
|
|
31
|
+
|
|
98
32
|
if firstTime:
|
|
99
33
|
print('no properties known for this timestamp adding them automatically')
|
|
100
34
|
columns = features.columns
|
|
@@ -123,38 +57,33 @@ def add(pathId, timestampId, features, token, showProgress = True, levelOfDetail
|
|
|
123
57
|
indices_sub = indices[i]
|
|
124
58
|
features_sub = features_json[indices_sub]
|
|
125
59
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
if type(levels) != type(None):
|
|
129
|
-
featuresBody = [{'feature': features_sub[i], 'levelsOfDetail': levels[i] } for i in np.arange(len(indices_sub))]
|
|
130
|
-
else:
|
|
131
|
-
featuresBody = [{'feature': features_sub[i] } for i in np.arange(len(indices_sub))]
|
|
60
|
+
|
|
61
|
+
featuresBody = [{'feature': features_sub[i] } for i in np.arange(len(indices_sub))]
|
|
132
62
|
body = {"features":featuresBody}
|
|
133
63
|
r = apiManager.post('/path/' + pathId + '/vector/timestamp/' + timestampId + '/feature', body, token)
|
|
134
64
|
addedIds = addedIds + r
|
|
135
65
|
if showProgress:
|
|
136
66
|
loadingBar(i*3000 + len(indices_sub),features.shape[0])
|
|
137
67
|
i = i+1
|
|
138
|
-
|
|
68
|
+
|
|
139
69
|
return(addedIds)
|
|
140
70
|
|
|
141
71
|
|
|
142
|
-
|
|
143
|
-
def edit(pathId, timestampId, featureIds, token, features
|
|
144
|
-
pathId = sanitize.validUuid('pathId', pathId, True)
|
|
145
|
-
timestampId = sanitize.validUuid('timestampId', timestampId, True)
|
|
72
|
+
|
|
73
|
+
def edit(pathId, timestampId, featureIds, token, features, showProgress = True, cores = 1):
|
|
74
|
+
pathId = sanitize.validUuid('pathId', pathId, True)
|
|
75
|
+
timestampId = sanitize.validUuid('timestampId', timestampId, True)
|
|
146
76
|
token = sanitize.validString('token', token, True)
|
|
147
77
|
featureIds = sanitize.validUuidArray('featureIds', featureIds, True)
|
|
148
78
|
showProgress = sanitize.validBool('showProgress', showProgress, True)
|
|
149
79
|
cores = sanitize.validInt('cores', cores, True)
|
|
150
80
|
features = sanitize.validGeopandas('features', features, False, cores=cores)
|
|
151
81
|
|
|
152
|
-
levelOfDetail1, levelOfDetail2, levelOfDetail3, levelOfDetail4, levelOfDetail5 = manageLevels(levelOfDetail1, levelOfDetail2, levelOfDetail3, levelOfDetail4, levelOfDetail5, features)
|
|
153
82
|
|
|
154
83
|
|
|
155
84
|
if type(features) != type(None) and features.shape[0] != len(featureIds):
|
|
156
85
|
raise ValueError('featureIds must be of same length as the features geopandas dataframe')
|
|
157
|
-
|
|
86
|
+
|
|
158
87
|
|
|
159
88
|
indices = chunks(np.arange(len(featureIds)),1000)
|
|
160
89
|
i=0
|
|
@@ -163,17 +92,13 @@ def edit(pathId, timestampId, featureIds, token, features = None, showProgress =
|
|
|
163
92
|
featureIds_sub = list( np.array(featureIds)[indices_sub])
|
|
164
93
|
|
|
165
94
|
if type(features) != type(None):
|
|
166
|
-
features_sub = features.iloc[indices_sub]
|
|
95
|
+
features_sub = features.iloc[indices_sub]
|
|
167
96
|
features_sub =features_sub.to_json(na='drop')
|
|
168
97
|
features_sub = json.loads(features_sub)
|
|
169
98
|
|
|
170
|
-
levels = zipLevels(levelOfDetail1, levelOfDetail2, levelOfDetail3, levelOfDetail4, levelOfDetail5, indices_sub)
|
|
171
99
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
else:
|
|
175
|
-
changes = [{'featureId':x[0], 'levelsOfDetail': levels , 'newProperties':x[1]['properties'], 'newGeometry':x[1]['geometry']} for x in zip(featureIds_sub, features_sub['features'])]
|
|
176
|
-
|
|
100
|
+
changes = [{'featureId':x[0] , 'newProperties':x[1]['properties'], 'newGeometry':x[1]['geometry']} for x in zip(featureIds_sub, features_sub['features'])]
|
|
101
|
+
|
|
177
102
|
body = {'changes':changes}
|
|
178
103
|
r = apiManager.patch('/path/' + pathId + '/vector/timestamp/' + timestampId + '/feature', body, token)
|
|
179
104
|
|
|
@@ -184,8 +109,8 @@ def edit(pathId, timestampId, featureIds, token, features = None, showProgress =
|
|
|
184
109
|
|
|
185
110
|
|
|
186
111
|
def trash(pathId, timestampId, featureIds, token, showProgress = True):
|
|
187
|
-
pathId = sanitize.validUuid('pathId', pathId, True)
|
|
188
|
-
timestampId = sanitize.validUuid('timestampId', timestampId, True)
|
|
112
|
+
pathId = sanitize.validUuid('pathId', pathId, True)
|
|
113
|
+
timestampId = sanitize.validUuid('timestampId', timestampId, True)
|
|
189
114
|
token = sanitize.validString('token', token, True)
|
|
190
115
|
featureIds = sanitize.validUuidArray('featureIds', featureIds, True)
|
|
191
116
|
showProgress = sanitize.validBool('showProgress', showProgress, True)
|
|
@@ -206,8 +131,8 @@ def trash(pathId, timestampId, featureIds, token, showProgress = True):
|
|
|
206
131
|
|
|
207
132
|
|
|
208
133
|
def recover(pathId, timestampId, featureIds, token, showProgress = True):
|
|
209
|
-
pathId = sanitize.validUuid('pathId', pathId, True)
|
|
210
|
-
timestampId = sanitize.validUuid('timestampId', timestampId, True)
|
|
134
|
+
pathId = sanitize.validUuid('pathId', pathId, True)
|
|
135
|
+
timestampId = sanitize.validUuid('timestampId', timestampId, True)
|
|
211
136
|
token = sanitize.validString('token', token, True)
|
|
212
137
|
featureIds = sanitize.validUuidArray('featureIds', featureIds, True)
|
|
213
138
|
showProgress = sanitize.validBool('showProgress', showProgress, True)
|
|
@@ -229,13 +154,13 @@ def recover(pathId, timestampId, featureIds, token, showProgress = True):
|
|
|
229
154
|
|
|
230
155
|
|
|
231
156
|
def versions(pathId, timestampId, featureId, token = None, pageStart = None, listAll = True):
|
|
232
|
-
pathId = sanitize.validUuid('pathId', pathId, True)
|
|
233
|
-
timestampId = sanitize.validUuid('timestampId', timestampId, True)
|
|
157
|
+
pathId = sanitize.validUuid('pathId', pathId, True)
|
|
158
|
+
timestampId = sanitize.validUuid('timestampId', timestampId, True)
|
|
234
159
|
token = sanitize.validString('token', token, False)
|
|
235
160
|
featureId = sanitize.validUuid('featureId', featureId, True)
|
|
236
161
|
pageStart = sanitize.validUuid('pageStart', pageStart, False)
|
|
237
162
|
listAll = sanitize.validBool('listAll', listAll, True)
|
|
238
|
-
|
|
163
|
+
|
|
239
164
|
body = {'returnType':'all'}
|
|
240
165
|
def f(body):
|
|
241
166
|
return apiManager.get('/path/' + pathId + '/vector/timestamp/' + timestampId + '/feature/' + featureId + '/version', body, token)
|
|
@@ -247,11 +172,11 @@ def versions(pathId, timestampId, featureId, token = None, pageStart = None, lis
|
|
|
247
172
|
usernames = [x['user']['username'] for x in r['result'] ]
|
|
248
173
|
userIds = [x['user']['id'] for x in r['result'] ]
|
|
249
174
|
|
|
250
|
-
sh = gpd.GeoDataFrame.from_features(features)
|
|
175
|
+
sh = gpd.GeoDataFrame.from_features(features)
|
|
251
176
|
sh['username'] = usernames
|
|
252
177
|
sh['userId'] = userIds
|
|
253
178
|
sh['dates'] = dates
|
|
254
|
-
|
|
179
|
+
|
|
255
180
|
sh.crs = {'init': 'epsg:4326'}
|
|
256
181
|
r['result'] = sh
|
|
257
182
|
return(r)
|
|
@@ -5,27 +5,43 @@ from ellipsis.util.root import recurse
|
|
|
5
5
|
import numpy as np
|
|
6
6
|
import geopandas as gpd
|
|
7
7
|
|
|
8
|
-
def add(pathId, timestampId, filePath,
|
|
8
|
+
def add(pathId, timestampId, token, fileFormat, filePath=None, memFile = None, name = None, epsg = None, dateColumns = None, datePatterns = None, method= 'simplify', fastUpload = True):
|
|
9
9
|
token = sanitize.validString('token', token, True)
|
|
10
10
|
pathId = sanitize.validUuid('pathId', pathId, True)
|
|
11
11
|
timestampId = sanitize.validUuid('timestampId', timestampId, True)
|
|
12
|
-
filePath = sanitize.validString('filePath', filePath,
|
|
12
|
+
filePath = sanitize.validString('filePath', filePath, False)
|
|
13
13
|
epsg = sanitize.validInt('epsg', epsg, False)
|
|
14
|
-
|
|
15
|
-
fileFormat = sanitize.validString('fileFormat', fileFormat, True)
|
|
14
|
+
fileFormat = sanitize.validString('fileFormat', fileFormat, True)
|
|
16
15
|
dateColumns = sanitize.validStringArray('dateColumns', dateColumns, False)
|
|
17
16
|
datePatterns = sanitize.validStringArray('datePatterns', datePatterns, False)
|
|
17
|
+
name = sanitize.validString('name', name, False)
|
|
18
18
|
fastUpload = sanitize.validBool('fastUpload', fastUpload, True)
|
|
19
19
|
if fastUpload:
|
|
20
20
|
fastUpload='true'
|
|
21
21
|
else:
|
|
22
22
|
fastUpload = 'false'
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
|
|
25
|
+
if type(memFile) == type(None) and type(filePath) == type(None):
|
|
26
|
+
raise ValueError('You need to specify either a filePath or a memFile')
|
|
27
|
+
|
|
28
|
+
if type(memFile) != type(None) and type(name) == type(None):
|
|
29
|
+
raise ValueError('Parameter name is required when using a memory file')
|
|
30
|
+
|
|
31
|
+
if type(name ) == type(None):
|
|
32
|
+
seperator = os.path.sep
|
|
33
|
+
fileName = filePath.split(seperator)[len(filePath.split(seperator))-1 ]
|
|
34
|
+
else:
|
|
35
|
+
fileName = name
|
|
36
|
+
|
|
37
|
+
|
|
27
38
|
body = {'name':fileName, 'epsg':epsg, 'format':fileFormat, 'dateColumns': dateColumns, 'datePatterns':datePatterns, 'fastUpload':fastUpload}
|
|
28
|
-
|
|
39
|
+
if type(memFile) == type(None):
|
|
40
|
+
r = apiManager.upload('/path/' + pathId + '/vector/timestamp/' + timestampId + '/file' , filePath, body, token)
|
|
41
|
+
else:
|
|
42
|
+
r = apiManager.upload('/path/' + pathId + '/vector/timestamp/' + timestampId + '/file', name, body, token,
|
|
43
|
+
memfile=memFile)
|
|
44
|
+
|
|
29
45
|
return r
|
|
30
46
|
|
|
31
47
|
def get(pathId, timestampId, token, pageStart = None, listAll = True):
|
|
@@ -6,16 +6,17 @@ def get(token):
|
|
|
6
6
|
r = apiManager.get('/path/vector/timestamp/order', None, token)
|
|
7
7
|
return r
|
|
8
8
|
|
|
9
|
-
def add(pathId, timestampId, token, extent = None, fileFormat = 'geojson'):
|
|
9
|
+
def add(pathId, timestampId, token, extent = None, fileFormat = 'geojson', epsg = 4326):
|
|
10
10
|
|
|
11
11
|
token = sanitize.validString('token', token, True)
|
|
12
12
|
pathId = sanitize.validUuid('pathId', pathId, True)
|
|
13
13
|
timestampId = sanitize.validUuid('timestampId', timestampId, True)
|
|
14
14
|
extent = sanitize.validBounds('extent', extent, False)
|
|
15
15
|
fileFormat = sanitize.validString('fileFormat', fileFormat, True)
|
|
16
|
+
epsg = sanitize.validInt('epsg', epsg, True)
|
|
16
17
|
|
|
17
18
|
|
|
18
|
-
body = { 'extent':extent, 'format' :fileFormat}
|
|
19
|
+
body = { 'extent':extent, 'format' :fileFormat, 'epsg':epsg}
|
|
19
20
|
|
|
20
21
|
r = apiManager.post('/path/' + pathId + '/vector/timestamp/' + timestampId + '/order', body, token)
|
|
21
22
|
|
|
@@ -116,21 +116,20 @@ def getChanges(pathId, timestampId, token = None, pageStart = None, listAll = Fa
|
|
|
116
116
|
|
|
117
117
|
|
|
118
118
|
|
|
119
|
-
def getFeaturesByIds(pathId, timestampId, featureIds, token = None, showProgress = True,
|
|
119
|
+
def getFeaturesByIds(pathId, timestampId, featureIds, token = None, showProgress = True, epsg = 4326):
|
|
120
120
|
pathId = sanitize.validUuid('pathId', pathId, True)
|
|
121
121
|
timestampId = sanitize.validUuid('timestampId', timestampId, True)
|
|
122
122
|
token = sanitize.validString('token', token, False)
|
|
123
123
|
featureIds = sanitize.validUuidArray('featureIds', featureIds, True)
|
|
124
124
|
showProgress = sanitize.validBool('showProgress', showProgress, True)
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
|
|
127
126
|
id_chunks = chunks(featureIds, 10)
|
|
128
127
|
|
|
129
128
|
r = {'size': 0 , 'result': [], 'nextPageStart' : None}
|
|
130
129
|
ids = id_chunks[0]
|
|
131
130
|
i=0
|
|
132
131
|
for ids in id_chunks:
|
|
133
|
-
body = {'geometryIds': ids
|
|
132
|
+
body = {'geometryIds': ids}
|
|
134
133
|
r_new = apiManager.get('/path/' + pathId + '/vector/timestamp/' + timestampId + '/featuresByIds' , body, token)
|
|
135
134
|
|
|
136
135
|
r['result'] = r['result'] + r_new['result']['features']
|
|
@@ -147,17 +146,17 @@ def getFeaturesByIds(pathId, timestampId, featureIds, token = None, showProgress
|
|
|
147
146
|
del r['result']['features'][i]['properties']['crs']
|
|
148
147
|
sh = gpd.GeoDataFrame.from_features(r['result']['features'])
|
|
149
148
|
|
|
150
|
-
|
|
149
|
+
sh.crs = 'EPSG:4326'
|
|
150
|
+
sh = sh.to_crs('EPSG:' + str(epsg))
|
|
151
151
|
r['result'] = sh
|
|
152
152
|
return r
|
|
153
153
|
|
|
154
154
|
|
|
155
|
-
def getFeaturesByExtent(pathId, timestampId, extent, propertyFilter = None, token = None, listAll = True, pageStart = None, epsg = 4326, coordinateBuffer = None,
|
|
155
|
+
def getFeaturesByExtent(pathId, timestampId, extent, propertyFilter = None, token = None, listAll = True, pageStart = None, epsg = 4326, coordinateBuffer = None, onlyIfCenterPointInExtent = False):
|
|
156
156
|
pathId = sanitize.validUuid('pathId', pathId, True)
|
|
157
157
|
timestampId = sanitize.validUuid('timestampId', timestampId, True)
|
|
158
158
|
token = sanitize.validString('token', token, False)
|
|
159
159
|
extent = sanitize.validBounds('extent', extent, True)
|
|
160
|
-
levelOfDetail = sanitize.validInt('levelOfDetail', levelOfDetail, False)
|
|
161
160
|
propertyFilter = sanitize.validObject('propertyFilter', propertyFilter, False)
|
|
162
161
|
listAll = sanitize.validBool('listAll', listAll, True)
|
|
163
162
|
epsg = sanitize.validInt('epsg', epsg, True)
|
|
@@ -187,7 +186,7 @@ def getFeaturesByExtent(pathId, timestampId, extent, propertyFilter = None, toke
|
|
|
187
186
|
extent_new['yMax'] = min(85, extent['yMax'] + coordinateBuffer)
|
|
188
187
|
|
|
189
188
|
|
|
190
|
-
body = {'pageStart': pageStart, 'propertyFilter':propertyFilter, 'extent':extent_new
|
|
189
|
+
body = {'pageStart': pageStart, 'propertyFilter':propertyFilter, 'extent':extent_new}
|
|
191
190
|
|
|
192
191
|
def f(body):
|
|
193
192
|
return apiManager.get('/path/' + pathId + '/vector/timestamp/' + timestampId + '/featuresByExtent' , body, token)
|
|
@@ -224,15 +223,14 @@ def getFeaturesByExtent(pathId, timestampId, extent, propertyFilter = None, toke
|
|
|
224
223
|
return r
|
|
225
224
|
|
|
226
225
|
|
|
227
|
-
def listFeatures(pathId, timestampId, token = None, listAll = True, pageStart = None,
|
|
226
|
+
def listFeatures(pathId, timestampId, token = None, listAll = True, pageStart = None, epsg = 4326):
|
|
228
227
|
pathId = sanitize.validUuid('pathId', pathId, True)
|
|
229
228
|
timestampId = sanitize.validUuid('timestampId', timestampId, True)
|
|
230
229
|
token = sanitize.validString('token', token, False)
|
|
231
230
|
listAll = sanitize.validBool('listAll', listAll, True)
|
|
232
231
|
pageStart = sanitize.validObject('pageStart', pageStart, False)
|
|
233
|
-
levelOfDetail = sanitize.validInt('levelOfDetail', levelOfDetail, False)
|
|
234
232
|
|
|
235
|
-
body = {'pageStart': pageStart, '
|
|
233
|
+
body = {'pageStart': pageStart, 'pageSize':10000}
|
|
236
234
|
|
|
237
235
|
|
|
238
236
|
def f(body):
|
|
@@ -258,6 +256,7 @@ def listFeatures(pathId, timestampId, token = None, listAll = True, pageStart =
|
|
|
258
256
|
|
|
259
257
|
|
|
260
258
|
sh.crs = {'init': 'epsg:4326'}
|
|
259
|
+
sh = sh.to_crs('EPSG:' + str(epsg))
|
|
261
260
|
r['result'] = sh
|
|
262
261
|
|
|
263
262
|
return r
|
ellipsis/util/__init__.py
CHANGED
ellipsis/util/root.py
CHANGED
|
@@ -5,7 +5,7 @@ import numpy as np
|
|
|
5
5
|
import pandas as pd
|
|
6
6
|
import math
|
|
7
7
|
import sys
|
|
8
|
-
|
|
8
|
+
from rasterio.io import MemoryFile
|
|
9
9
|
from datetime import datetime
|
|
10
10
|
from shapely import geometry
|
|
11
11
|
import rasterio
|
|
@@ -85,10 +85,6 @@ def plotPointCloud(df, method = 'cloud', width = 800, height = 600, scale = 0.00
|
|
|
85
85
|
|
|
86
86
|
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
88
|
def parseGlb(stream):
|
|
93
89
|
gltf = pygltflib.GLTF2.load_from_bytes(stream)
|
|
94
90
|
binary_blob = gltf.binary_blob()
|
|
@@ -304,7 +300,7 @@ def reprojectRaster(r, sourceExtent, targetExtent, targetWidth, targetHeight, so
|
|
|
304
300
|
resampling=interpolation)
|
|
305
301
|
|
|
306
302
|
|
|
307
|
-
return {'raster':destination, 'transform':dst_transform, 'extent':targetExtent, '
|
|
303
|
+
return {'raster':destination, 'transform':dst_transform, 'extent':targetExtent, 'crs': 'EPSG:' + str(targetEpsg)}
|
|
308
304
|
|
|
309
305
|
|
|
310
306
|
def swapXY(extent):
|
|
@@ -334,8 +330,8 @@ def transformPoint( point, sourceEpsg, targetEpsg):
|
|
|
334
330
|
return(x,y)
|
|
335
331
|
|
|
336
332
|
#funciton to store image given bounds, and raster and crs
|
|
337
|
-
def saveRaster(
|
|
338
|
-
|
|
333
|
+
def saveRaster(r, epsg, targetFile, extent = None, transform = None):
|
|
334
|
+
|
|
339
335
|
if type(extent) == type(None) and type(transform) == type(None):
|
|
340
336
|
raise ValueError('You must provide either an extent or a transform')
|
|
341
337
|
|
|
@@ -352,17 +348,36 @@ def saveRaster(targetFile, r, epsg, extent = None, transform = None):
|
|
|
352
348
|
h = r.shape[1]
|
|
353
349
|
if transform == None:
|
|
354
350
|
transform = rasterio.transform.from_bounds(extent['xMin'], extent['yMin'], extent['xMax'], extent['yMax'], w, h)
|
|
351
|
+
|
|
355
352
|
con = rasterio.open(targetFile , 'w', driver='Gtiff',compress="lzw",
|
|
356
353
|
height = h, width = w,
|
|
357
354
|
count= r.shape[0], dtype=r.dtype,
|
|
358
355
|
crs= crs ,
|
|
359
356
|
transform=transform)
|
|
360
|
-
|
|
357
|
+
|
|
361
358
|
con.write(r)
|
|
362
359
|
con.close()
|
|
360
|
+
if type(targetFile) != type('x'):
|
|
361
|
+
return targetFile
|
|
363
362
|
|
|
364
363
|
def saveVector(targetFile, features):
|
|
365
|
-
features.to_file(targetFile)
|
|
364
|
+
features.to_file(targetFile, driver="GPKG")
|
|
365
|
+
if type(targetFile) != type('x'):
|
|
366
|
+
return targetFile
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
def savePointCloud(targetFile, df):
|
|
370
|
+
import laspy
|
|
371
|
+
las = laspy.create(point_format=2, file_version='1.2')
|
|
372
|
+
las.x = df.x
|
|
373
|
+
las.y = df.y
|
|
374
|
+
las.z = df.z
|
|
375
|
+
las.red = df['red'].values
|
|
376
|
+
las.green = df['green'].values
|
|
377
|
+
las.blue = df['blue'].values
|
|
378
|
+
las.write(targetFile)
|
|
379
|
+
if type(targetFile) != type('x'):
|
|
380
|
+
return targetFile
|
|
366
381
|
|
|
367
382
|
|
|
368
383
|
q_running = multiprocessing.Queue()
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
ellipsis/__init__.py,sha256=
|
|
1
|
+
ellipsis/__init__.py,sha256=R6MNlybVTKLz0IBT7OihsOuFtHSwX6YvXctY1vI5LXg,210
|
|
2
2
|
ellipsis/apiManager.py,sha256=JJ-1nT29BIcVSzMvEdkm1Wq6PsXT7Jq5OmJrRdg7C2o,5463
|
|
3
3
|
ellipsis/sanitize.py,sha256=T5FawJRZ2eqGv0itiMkZ1fuJpahsSyhBMFty9cG-wwA,10194
|
|
4
4
|
ellipsis/account/__init__.py,sha256=K40DMBaUDSxt3rO2WZv63Wmpfy49ocqBxvWqyIYHR24,92
|
|
5
5
|
ellipsis/account/root.py,sha256=tgGAT2BzP3zgAqsevvkeognn5S67T-MrIP52BLN9rbE,1791
|
|
6
6
|
ellipsis/account/accessToken/__init__.py,sha256=ivwhK1eC4g74PAKaeTReb1QhIpKXyvmfdqZV6wDY-EY,66
|
|
7
7
|
ellipsis/account/accessToken/root.py,sha256=TYo8wTyWyzytaqOTsuQC-Vn3y7BhYMC88EItZafpISA,1281
|
|
8
|
-
ellipsis/path/__init__.py,sha256=
|
|
8
|
+
ellipsis/path/__init__.py,sha256=cc03CEyQvWmdaFPo4T8KBeyYiz-04VtzcCDwMrHADmU,470
|
|
9
9
|
ellipsis/path/root.py,sha256=3HaKJhjAeHMqK1rBjcvT92aG6kBWllpu3prUqO3Ov6s,8618
|
|
10
|
+
ellipsis/path/bookmark/__init__.py,sha256=vNrqGcWl5MN_xVAiClP6W6NilmsV-fqYOnJukbYcNwc,56
|
|
11
|
+
ellipsis/path/bookmark/root.py,sha256=knhVIVAJS0jBT6JLdVgnufVRdxIR0VZBYfv292hg6xY,1285
|
|
10
12
|
ellipsis/path/file/__init__.py,sha256=i_KB1S1J9pZjcPTKdyGMnjJf2tCoHFzptLGaxmTi55A,107
|
|
11
13
|
ellipsis/path/file/root.py,sha256=3aqUFHQ7JLZf2arFoxOruOEKU-yOqUooj_LexGdPZ_s,4418
|
|
12
14
|
ellipsis/path/folder/__init__.py,sha256=5keiFbsuXj5bYQHt8NahGkUYvXrJk8C7cQhgHA-4VBc,139
|
|
@@ -23,18 +25,18 @@ ellipsis/path/pointCloud/timestamp/__init__.py,sha256=V5tUr351MX2f9ox7zNQ2UQnlOj
|
|
|
23
25
|
ellipsis/path/pointCloud/timestamp/root.py,sha256=_a8JJN8qx4KnwovNj61Y1AZyu7ddPUGR39Hr2z9cNyg,7009
|
|
24
26
|
ellipsis/path/pointCloud/timestamp/util.py,sha256=eupFFSBp5CaTDIRg6DYnZnfWY61h81JZ7c15NdJ-j5E,2580
|
|
25
27
|
ellipsis/path/pointCloud/timestamp/file/__init__.py,sha256=CyWtj9Q49GatQg0sVyYDp6Lua7ZQCv40BWjP6dvStKo,101
|
|
26
|
-
ellipsis/path/pointCloud/timestamp/file/root.py,sha256=
|
|
28
|
+
ellipsis/path/pointCloud/timestamp/file/root.py,sha256=oRzKt60sQ1UfwYWq6jqMHUCv7q17x944R9G1ENnQgI8,4290
|
|
27
29
|
ellipsis/path/pointCloud/timestamp/order/__init__.py,sha256=DA2mNfP_glsUJZZkUcpN5rAGCOfDMathASWdpZD-PCs,78
|
|
28
30
|
ellipsis/path/pointCloud/timestamp/order/root.py,sha256=ni4lYOmatqLg5NQ1VTLeG9R7nI9dcLpONFp3JUj9LQw,1184
|
|
29
31
|
ellipsis/path/raster/__init__.py,sha256=xWEsdpQxsqnwSdRqmZujS3pEUAmemHmUCtMKCaWLK0M,217
|
|
30
32
|
ellipsis/path/raster/root.py,sha256=-y0SEukHEYUDvyJyDI1x7gtcDm-Wum_Ze7ekSYJr6O4,1749
|
|
31
33
|
ellipsis/path/raster/style/__init__.py,sha256=mxlqVtSd2dsKai3DAVQjtNsh2KnTrZVyF8loRwUNT7E,61
|
|
32
34
|
ellipsis/path/raster/style/root.py,sha256=YFQlGTdgjpwXn4h0ug7LrQZFLmRp2bdJN71A0iqZRFo,1627
|
|
33
|
-
ellipsis/path/raster/timestamp/__init__.py,sha256=
|
|
34
|
-
ellipsis/path/raster/timestamp/root.py,sha256=
|
|
35
|
+
ellipsis/path/raster/timestamp/__init__.py,sha256=brmFXg69CKRcWaAfPbxWfsvHvnn5q8GBQhVzUTVb4_w,842
|
|
36
|
+
ellipsis/path/raster/timestamp/root.py,sha256=qhJALjYVCdNmH3atGNmIe89Zm5xj_EAd8fczHWW4CQg,17257
|
|
35
37
|
ellipsis/path/raster/timestamp/util.py,sha256=eupFFSBp5CaTDIRg6DYnZnfWY61h81JZ7c15NdJ-j5E,2580
|
|
36
38
|
ellipsis/path/raster/timestamp/file/__init__.py,sha256=Ln9_dQ4-PMwb5VP--Qh09IV5zmr-47RShpe0-f_NVh4,97
|
|
37
|
-
ellipsis/path/raster/timestamp/file/root.py,sha256=
|
|
39
|
+
ellipsis/path/raster/timestamp/file/root.py,sha256=KD8E64eZtS62C-WCl3BTeVjsc08BaLXpuLwxfbmnTLI,4545
|
|
38
40
|
ellipsis/path/raster/timestamp/order/__init__.py,sha256=4YEK4XW9TM-HsjoFlFeyGMtI3OKX2VCXfb4NsTsugBo,74
|
|
39
41
|
ellipsis/path/raster/timestamp/order/root.py,sha256=zWcfI_q9KlfevzyvwWY8ni27KCvOyAiaJvohVfasjXg,1176
|
|
40
42
|
ellipsis/path/usage/__init__.py,sha256=2BHmLV9soOYDhyQFH2B86bBjmWXGsfuX4KneEBDo6O4,96
|
|
@@ -46,25 +48,23 @@ ellipsis/path/vector/featureProperty/root.py,sha256=eb2bw4UGO3eYGaYgjwu43pZyA4iA
|
|
|
46
48
|
ellipsis/path/vector/style/__init__.py,sha256=riiDnL4FDq4EFhSYAYHBSe_o5oltRTSrj4sc72F6IVQ,63
|
|
47
49
|
ellipsis/path/vector/style/root.py,sha256=09PsRbCJ35YV8bl8xoWFoeGRpdmf5IBmmqwhRj30OTM,1641
|
|
48
50
|
ellipsis/path/vector/timestamp/__init__.py,sha256=n0ncRxXoQIDX1WeV0lbpJH1BND793CdZ5swGgeu1Kfk,330
|
|
49
|
-
ellipsis/path/vector/timestamp/root.py,sha256=
|
|
51
|
+
ellipsis/path/vector/timestamp/root.py,sha256=kcLdfBWpoqRXWswz-nqrEM0mxw6oEZc5sUFCD_B4JRk,11296
|
|
50
52
|
ellipsis/path/vector/timestamp/feature/__init__.py,sha256=miaLCHkogL9KJ_eUr4K_N15BShAe2ivcppDFJuE_SgI,210
|
|
51
|
-
ellipsis/path/vector/timestamp/feature/root.py,sha256=
|
|
53
|
+
ellipsis/path/vector/timestamp/feature/root.py,sha256=Y_GiT1vBEvZxxvJdUvzhjGqYsfPfi1L6qHBS5jNcnBY,7212
|
|
52
54
|
ellipsis/path/vector/timestamp/feature/message/__init__.py,sha256=XfX3MIa4RjpToFnxNyfxCKTvRlNtJFRQ44j31wDyhGc,100
|
|
53
55
|
ellipsis/path/vector/timestamp/feature/message/root.py,sha256=isLzkITTiluKoIsH0PYT0K5Cr-LBzTA0TSE4-2tZU5M,3949
|
|
54
56
|
ellipsis/path/vector/timestamp/feature/series/__init__.py,sha256=vPi57QdUPTEnQE31abgxzwWU3Gzu-Xxi3ZVD4z5MMwg,107
|
|
55
57
|
ellipsis/path/vector/timestamp/feature/series/root.py,sha256=KCm28pQ8E6WREftuSi4wge_2QpojDW11b55j7_tG7Js,7519
|
|
56
58
|
ellipsis/path/vector/timestamp/file/__init__.py,sha256=qJtOXI9MEv4KifDjMW3zUDKnef8PD69SQmgRc3wDShQ,73
|
|
57
|
-
ellipsis/path/vector/timestamp/file/root.py,sha256=
|
|
59
|
+
ellipsis/path/vector/timestamp/file/root.py,sha256=STswXCVZMtLmYceXKQsLKhyNmWzifDHp084mdS9fYLQ,4736
|
|
58
60
|
ellipsis/path/vector/timestamp/order/__init__.py,sha256=w11nMYDQJzZJU_q8o7ApadV2EOdCX93gNkHZ7PO1gUo,74
|
|
59
|
-
ellipsis/path/vector/timestamp/order/root.py,sha256=
|
|
61
|
+
ellipsis/path/vector/timestamp/order/root.py,sha256=kknhHJSuj91WaRF-qzfovummHwplwyizi5q-V8cA0To,1249
|
|
60
62
|
ellipsis/user/__init__.py,sha256=um_b42pc2otFiQRGqMajcEtONQpC2ei4r-EY3j7bsfQ,43
|
|
61
63
|
ellipsis/user/root.py,sha256=dsMK6wGBdeCmOd3YsbIv9cEcQ6tAiSGr0jmtBhQl5-0,484
|
|
62
|
-
ellipsis/util/__init__.py,sha256=
|
|
63
|
-
ellipsis/util/root.py,sha256=
|
|
64
|
-
ellipsis/
|
|
65
|
-
ellipsis/
|
|
66
|
-
ellipsis-3.1.
|
|
67
|
-
ellipsis-3.1.
|
|
68
|
-
ellipsis-3.1.
|
|
69
|
-
ellipsis-3.1.45.dist-info/top_level.txt,sha256=eG8gfaVDyprKdb-dsGSh_lFMSa3DiZCsJFqze239RjA,9
|
|
70
|
-
ellipsis-3.1.45.dist-info/RECORD,,
|
|
64
|
+
ellipsis/util/__init__.py,sha256=_sNBUXDKJVGffRyt93xdUrJ4gON651Sp-unr7LKVCEc,756
|
|
65
|
+
ellipsis/util/root.py,sha256=Ts7DeaD_X7x-csmq5V2sa_hYrt1mCd59T7-NUQcWj3Y,23980
|
|
66
|
+
ellipsis-3.1.46.dist-info/LICENSE,sha256=7EI8xVBu6h_7_JlVw-yPhhOZlpY9hP8wal7kHtqKT_E,1074
|
|
67
|
+
ellipsis-3.1.46.dist-info/METADATA,sha256=GD17VF-4T2g_Ff-HUy-02yXLnP6eT_YucVKjzYzBhzg,1823
|
|
68
|
+
ellipsis-3.1.46.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
|
69
|
+
ellipsis-3.1.46.dist-info/top_level.txt,sha256=eG8gfaVDyprKdb-dsGSh_lFMSa3DiZCsJFqze239RjA,9
|
|
70
|
+
ellipsis-3.1.46.dist-info/RECORD,,
|
ellipsis/view/__init__.py
DELETED
ellipsis/view/root.py
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
from ellipsis import apiManager
|
|
2
|
-
from ellipsis import sanitize
|
|
3
|
-
from ellipsis.util.root import recurse
|
|
4
|
-
|
|
5
|
-
def listViews(token):
|
|
6
|
-
|
|
7
|
-
token = sanitize.validString('token', token, True)
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
r = apiManager.get('/view', {}, token)
|
|
12
|
-
|
|
13
|
-
return r
|
|
14
|
-
|
|
15
|
-
def get(viewId, token=None):
|
|
16
|
-
token = sanitize.validString('token', token, False)
|
|
17
|
-
viewId = sanitize.validString('viewId', viewId, True)
|
|
18
|
-
|
|
19
|
-
r = apiManager.get('/view/' + viewId, {}, token)
|
|
20
|
-
|
|
21
|
-
return r
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
def add(pathId, layers, name = None, persistent=False, dems=[], token = None):
|
|
26
|
-
token = sanitize.validString('token', token, False)
|
|
27
|
-
pathId = sanitize.validString('pathId', pathId, True)
|
|
28
|
-
layers = sanitize.validObject('layers', layers, True)
|
|
29
|
-
dems = sanitize.validObject('dems', dems, True)
|
|
30
|
-
name = sanitize.validString('pathId', name, False)
|
|
31
|
-
persistent = sanitize.validBool('persistent', persistent, True)
|
|
32
|
-
|
|
33
|
-
r = apiManager.post('/view', {'name':name, 'layers':layers, 'dems':dems, 'pathId':pathId, 'persistent':persistent}, token)
|
|
34
|
-
|
|
35
|
-
return r
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
def edit(viewId, token, layers=None, name=None, dems=None):
|
|
39
|
-
viewId = sanitize.validString('viewId', viewId, True)
|
|
40
|
-
token = sanitize.validString('token', token, False)
|
|
41
|
-
layers = sanitize.validObject('layers', layers, False)
|
|
42
|
-
dems = sanitize.validObject('dems', dems, False)
|
|
43
|
-
name = sanitize.validString('pathId', name, False)
|
|
44
|
-
|
|
45
|
-
r = apiManager.patch('/view/' + viewId, {'layers':layers, 'dems':dems, 'name':name}, token)
|
|
46
|
-
|
|
47
|
-
return r
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
def delete(viewId, token):
|
|
52
|
-
viewId = sanitize.validString('viewId', viewId, True)
|
|
53
|
-
token = sanitize.validString('token', token, False)
|
|
54
|
-
|
|
55
|
-
r = apiManager.delete('/view/' + viewId, {}, token)
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return r
|
|
59
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|