@@ -49,14 +49,14 @@ def sources(self):
49
49
50
50
return r .json ()
51
51
52
- def summary (self , const_id = None , date = 'acquired' , part = 'day' , shape = None , geom = None , start_time = None , end_time = None ,
52
+ def summary (self , const_id = None , date = 'acquired' , part = 'day' , place = None , geom = None , start_time = None , end_time = None ,
53
53
params = None , bbox = False , direct = False ):
54
54
"""Get a summary of the results for the specified spatio-temporal query.
55
55
56
56
:param list(str) const_id: Constellation identifier(s).
57
57
:param str date: The date field to use for search (e.g. `acquired`).
58
58
:param str part: Part of the date to aggregate over (e.g. `day`).
59
- :param str shape : A slug identifier to be used as a region of interest.
59
+ :param str place : A slug identifier to be used as a region of interest.
60
60
:param str geom: A GeoJSON or WKT region of interest.
61
61
:param str start_time: Desired starting date and time (inclusive).
62
62
:param str end_time: Desired ending date and time (inclusive).
@@ -65,7 +65,7 @@ def summary(self, const_id=None, date='acquired', part='day', shape=None, geom=N
65
65
66
66
Example usage::
67
67
68
- >>> metadata.summary(shape ='north-america_united-states_iowa',
68
+ >>> metadata.summary(place ='north-america_united-states_iowa',
69
69
const_id=['L8'], part='year')
70
70
71
71
[{'bytes': 187707322653,
@@ -93,11 +93,15 @@ def summary(self, const_id=None, date='acquired', part='day', shape=None, geom=N
93
93
'pixels': 18087390976}],
94
94
'pixels': 367993294400}]
95
95
"""
96
- if shape :
97
- waldo = Places ()
98
- shape = waldo .shape (shape , geom = 'low' )
96
+ if place :
97
+ places = Places ()
98
+ places .auth = self .auth
99
+ shape = places .shape (place , geom = 'low' )
99
100
geom = json .dumps (shape ['geometry' ])
100
101
102
+ if isinstance (geom , dict ):
103
+ geom = json .dumps (geom )
104
+
101
105
kwargs = {}
102
106
103
107
if date :
@@ -143,14 +147,14 @@ def f(x):
143
147
144
148
return result
145
149
146
- def search (self , const_id = None , date = 'acquired' , shape = None , geom = None , start_time = None , end_time = None , params = None ,
150
+ def search (self , const_id = None , date = 'acquired' , place = None , geom = None , start_time = None , end_time = None , params = None ,
147
151
limit = 100 , offset = 0 , bbox = False , direct = False ):
148
152
"""Search metadata given a spatio-temporal query. All parameters are
149
153
optional. Results are paged using limit/offset.
150
154
151
155
:param list(str) const_id: Constellation identifier(s).
152
156
:param str date: The date field to use for search (e.g. `acquired`).
153
- :param str shape : A slug identifier to be used as a region of interest.
157
+ :param str place : A slug identifier to be used as a region of interest.
154
158
:param str geom: A GeoJSON or WKT region of interest.
155
159
:param str start_time: Desired starting date and time (inclusive).
156
160
:param str end_time: Desired ending date and time (inclusive).
@@ -163,19 +167,21 @@ def search(self, const_id=None, date='acquired', shape=None, geom=None, start_ti
163
167
164
168
Example::
165
169
166
- >>> scenes = metadata.search(shape ='north-america_united-states_iowa', const_id=['L8'],
170
+ >>> scenes = metadata.search(place ='north-america_united-states_iowa', const_id=['L8'],
167
171
start_time='2016-07-01', end_time='2016-07-31 23:59:59')
168
172
len(scenes['features'])
169
173
170
174
34
171
175
"""
172
- if shape :
173
- waldo = Places ()
174
-
175
- shape = waldo .shape (shape , geom = 'low' )
176
-
176
+ if place :
177
+ places = Places ()
178
+ places .auth = self .auth
179
+ shape = places .shape (place , geom = 'low' )
177
180
geom = json .dumps (shape ['geometry' ])
178
181
182
+ if isinstance (geom , dict ):
183
+ geom = json .dumps (geom )
184
+
179
185
kwargs = {}
180
186
181
187
kwargs ['limit' ] = limit
@@ -215,14 +221,14 @@ def f(x):
215
221
216
222
return result
217
223
218
- def keys (self , const_id = None , date = 'acquired' , shape = None , geom = None , start_time = None , end_time = None , params = None ,
224
+ def keys (self , const_id = None , date = 'acquired' , place = None , geom = None , start_time = None , end_time = None , params = None ,
219
225
limit = 100 , offset = 0 , bbox = False , direct = False ):
220
226
"""Search metadata given a spatio-temporal query. All parameters are
221
227
optional. Results are paged using limit/offset.
222
228
223
229
:param list(str) const_id: Constellation identifier(s).
224
230
:param str date: The date field to use for search (e.g. `acquired`).
225
- :param str shape : A slug identifier to be used as a region of interest.
231
+ :param str place : A slug identifier to be used as a region of interest.
226
232
:param str geom: A GeoJSON or WKT region of interest.
227
233
:param str start_time: Desired starting date and time (inclusive).
228
234
:param str end_time: Desired ending date and time (inclusive).
@@ -235,7 +241,7 @@ def keys(self, const_id=None, date='acquired', shape=None, geom=None, start_time
235
241
236
242
Example::
237
243
238
- >>> metadata.keys(shape ='north-america_united-states_iowa', const_id=['L8'],
244
+ >>> metadata.keys(place ='north-america_united-states_iowa', const_id=['L8'],
239
245
start_time='2016-07-01', end_time='2016-07-31 23:59:59')
240
246
241
247
[
@@ -245,19 +251,19 @@ def keys(self, const_id=None, date='acquired', shape=None, geom=None, start_time
245
251
...
246
252
]
247
253
"""
248
- result = self .search (const_id , date , shape , geom , start_time , end_time , params , limit , offset , bbox , direct )
254
+ result = self .search (const_id , date , place , geom , start_time , end_time , params , limit , offset , bbox , direct )
249
255
250
256
return [feature ['id' ] for feature in result ['features' ][:limit ]]
251
257
252
- def features (self , const_id = None , date = 'acquired' , shape = None , geom = None , start_time = None , end_time = None ,
258
+ def features (self , const_id = None , date = 'acquired' , place = None , geom = None , start_time = None , end_time = None ,
253
259
params = None , limit = 100 , bbox = False , direct = False ):
254
260
"""Generator that combines summary and search to page through results.
255
261
256
262
:param int limit: Number of features to fetch per request.
257
263
258
264
:return: Generator of GeoJSON ``Feature`` objects.
259
265
"""
260
- result = self .summary (const_id = const_id , date = date , shape = shape , geom = geom , start_time = start_time ,
266
+ result = self .summary (const_id = const_id , date = date , place = place , geom = geom , start_time = start_time ,
261
267
end_time = end_time , params = params , bbox = bbox , direct = direct )
262
268
263
269
for summary in result :
@@ -269,7 +275,7 @@ def features(self, const_id=None, date='acquired', shape=None, geom=None, start_
269
275
270
276
while offset < count :
271
277
272
- features = self .search (const_id = [const_id ], date = date , shape = shape , geom = geom , start_time = start_time ,
278
+ features = self .search (const_id = [const_id ], date = date , place = place , geom = geom , start_time = start_time ,
273
279
end_time = end_time , params = params , limit = limit , offset = offset , bbox = bbox ,
274
280
direct = direct )
275
281
0 commit comments