Skip to content

Commit b853a2f

Browse files
Merge branch 'main' into data-asset-download-507
2 parents 60057a0 + c7721cc commit b853a2f

20 files changed

+1604
-279
lines changed

design-docs/CLI-Subscriptions.md

Lines changed: 67 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -184,40 +184,91 @@ planet subscriptions request [OPTIONS]
184184
185185
Generate a subscriptions request.
186186
187-
This command provides support for building the subscription request JSON used to create or
187+
This command provides support for building the subscription request JSON used to create or
188188
update a subscription. It outputs the subscription request.
189189
190190
Options:
191191
--name TEXT Subscription name. Does not need to be unique.
192192
[required]
193-
--asset-types TEXT One or more comma-separated asset types [required]
194-
--item-types TEXT One or more comma-separated item-types [required]
195-
--geometry JSON GeoJSON of area to deliver subscription to. Use
196-
--clip only deliver pixels that match this area.
197-
Can be a json string, filename, or '-' for stdin.
198-
--clip Use the geometry GeoJSON as the clip geometry for
199-
the subscription.
200-
--start-time DATETIME Start date and time to begin subscription.
201-
--end-time DATETIME Date and time to end the subscription.
202-
--rrule TEXT iCalendar recurrance rule to specify recurrances.
203-
--filter JSON A search filter can be specified a json string,
204-
filename, or '-' for stdin.
193+
--source Source JSON. Can be a json string,
194+
filename, or '-' for stdin.
205195
--tools JSON Toolchain JSON. Can be a json string,
206196
filename, or '-' for stdin.
207-
--cloudconfig JSON Credentials for cloud storage provider to
197+
--delivery JSON Credentials for cloud storage provider to
208198
enable cloud delivery of data. Can be a json
209199
string, filename, or '-' for stdin.
210200
--notifications JSON Notification JSON to specify webhook topics.
201+
Can be a json string, filename, or '-' for
202+
stdin.
203+
--pretty Format JSON output.
204+
--help Show this message and exit.
205+
```
206+
207+
### Usage Examples
208+
209+
```
210+
planet subscription request \
211+
--name test \
212+
--source source.json \
213+
--delivery delivery.json | planet subscriptions create -
214+
```
215+
216+
## Request-catalog
217+
218+
### Interface
219+
220+
```
221+
planet subscriptions request-catalog [OPTIONS]
222+
223+
Generate a subscriptions request source JSON for a catalog.
224+
225+
Options:
226+
--asset-types TEXT One or more comma-separated asset types. Required.
227+
--item-types TEXT One or more comma-separated item-types. Required.
228+
--geometry JSON geometry of the area of interest of the subscription that will be used to determine matches.
229+
Can be a json string, filename, or '-' for stdin.
230+
--start-time DATETIME Start date and time to begin subscription.
231+
--end-time DATETIME Date and time to end the subscription.
232+
--rrule TEXT iCalendar recurrance rule to specify recurrances.
233+
--filter JSON A search filter can be specified a json string,
234+
filename, or '-' for stdin.
211235
--pretty Format JSON output.
212236
--help Show this message and exit.
213237
```
214238

215239
### Usage Examples
216240

217241
```
218-
planet subscription request --item-type PSScene --asset-types ortho_analytic_8b_sr,ortho_udm2 --geom JSON --clip --start-time 05/01/2022 --cloudconfig delivery.json | planet subscriptions create -
242+
planet subscriptions request-catalog \
243+
--item-types PSScene \
244+
--asset-types ortho_analytic_8b_sr,ortho_udm2 \
245+
--geometry aoi.geojson \
246+
--start-time 2022-01-01) \
247+
--delivery delivery.json > source.json
248+
```
249+
250+
## Request-other
251+
252+
### Interface
253+
254+
```
255+
planet subscriptions request-other [OPTIONS]
256+
257+
Generate a subscriptions request source JSON for another product.
258+
259+
Options:
260+
--type Type.
261+
--id Id.
262+
--geometry JSON geometry of the area of interest of the subscription that will be used to determine matches.
263+
Can be a json string, filename, or '-' for stdin.
264+
--start-time DATETIME Start date and time to begin subscription.
265+
--end-time DATETIME Date and time to end the subscription.
266+
--rrule TEXT iCalendar recurrance rule to specify recurrances.
267+
--pretty Format JSON output.
268+
--help Show this message and exit.
219269
```
220270

271+
221272
## Update
222273

223274
Edit a subscription, such as one with a future start date, before it starts running.
@@ -278,4 +329,4 @@ API response, verbatim.
278329

279330
In the case of invalid options, print an error message (stderr) and set the exit
280331
code to 2. In the case of an API error response, print the response JSON and set
281-
code to 1.
332+
code to 1.

docs/cli/cli-data.md

Lines changed: 41 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@ At this point you should have completed [Step 5](../get-started/quick-start-guid
1717
of the quick start guide, and run your first full data search command:
1818

1919
```
20-
planet data search PSScene filter.json > recent-psscene.json
20+
planet data search PSScene --filter filter.json > recent-psscene.json
2121
```
2222

23-
This saves the latest 100 scenes in a file, that you can open and look at.
23+
This saves the descriptions of the latest 100 standard-quality scenes you have permissions to download in a file, that you can open and look at.
2424

2525
### Pretty printing
2626

2727
You will likely notice that this file is quite wide, with one very long line for each Planet
2828
item returned. You can make for a more readable file by using the `--pretty` flag:
2929

3030
```
31-
planet data search --pretty PSScene filter.json > recent-psscene.json
31+
planet data search --pretty PSScene --filter filter.json > recent-psscene.json
3232
```
3333

3434
The `--pretty` flag is built into most of the CLI calls. But you can also achieve the
@@ -38,7 +38,7 @@ piping any JSON output through it prints it in a more readable form. So the foll
3838
command will do the same thing as the previous one:
3939

4040
```
41-
planet data search PSScene filter.json | jq > recent-psscene.json
41+
planet data search PSScene --filter filter.json | jq > recent-psscene.json
4242
```
4343

4444
You can read a bit [more about jq]((cli-intro.md#jq) in the CLI intro.
@@ -49,14 +49,14 @@ You also don't have to save the output to a file. If you don't redirect it into
4949
it will just print out on the console.
5050

5151
```
52-
planet data search PSScene filter.json
52+
planet data search PSScene --filter filter.json
5353
```
5454

5555
If you enter this command you'll see the output stream by. Here you can use jq again, and
5656
it'll often give you nice syntax highlighting in addition to formatting.
5757

5858
```
59-
planet data search PSScene filter.json | jq
59+
planet data search PSScene --filter filter.json | jq
6060
```
6161

6262
### Create filter and search in one call
@@ -66,14 +66,25 @@ passing the output of the `data filter` command directly to be the input of the
6666
command:
6767

6868
```
69-
planet data filter | planet data search --pretty PSScene -
69+
planet data filter --permission --std-quality | planet data search --pretty PSScene --filter -
7070
```
7171

7272
Note the dash (`-`), which explicitly tells the CLI to use the output from the call that is piped into it.
7373

7474
You can learn more about the pipe command, as well as the `>` command above in the
7575
[Piping & redirection section](cli-intro.md#piping-redirection) of the CLI Introduction.
7676

77+
### Search without filtering
78+
79+
If no filtering is required, the search command can be called directly:
80+
81+
```
82+
planet data search PSScene
83+
```
84+
85+
This outputs the last 100 scenes.
86+
87+
7788
### Search on Item Type
7889

7990
These first searches were done on the [PSScene](https://developers.planet.com/docs/data/psscene/) 'item type', but you
@@ -82,7 +93,7 @@ its catalog. The item type is the first argument of the `search` command, follow
8293
you can specify any number of item types here:
8394

8495
```
85-
planet data filter | planet data search PSScene,Sentinel2L1C,Landsat8L1G,SkySatCollect -
96+
planet data search PSScene,Sentinel2L1C,Landsat8L1G,SkySatCollect
8697
```
8798

8899
This will search for all the most recent images captured by PlanetScope, SkySat, Sentinel 2 and Landsat 8 satellites.
@@ -96,7 +107,7 @@ By default the `search` command returns only the 100 first scenes. But with the
96107
under the hood will automatically page through all the results from the API.
97108

98109
```
99-
planet data filter | planet data search --limit 3000 PSScene
110+
planet data search --limit 3000 PSScene
100111
```
101112

102113
Note you can also do a call with no limits if you set the limit to `0`. Though don't use this haphazardly, or you'll be
@@ -111,13 +122,13 @@ the `planet collect` method to transform the output from the Data API to valid G
111122
output to it:
112123

113124
```console
114-
planet data filter | planet data search PSScene - | planet collect -
125+
planet data search PSScene | planet collect -
115126
```
116127

117128
If you want to visualize this you can save it as a file:
118129

119130
```console
120-
planet data filter | planet data search PSScene - | planet collect - > planet-search.geojson
131+
planet data search PSScene | planet collect - > planet-search.geojson
121132
```
122133

123134
This you can then open with your favorite GIS program, or see this
@@ -138,13 +149,13 @@ descending order. The options are are:
138149
The lets you do things like get the id of the most recent skysat image taken (that you have download access to):
139150

140151
```console
141-
planet data filter | planet data search SkySatCollect --sort 'acquired desc' --limit 1 -
152+
planet data search SkySatCollect --sort 'acquired desc' --limit 1
142153
```
143154

144155
And you can also just get the ID, using `jq`
145156

146157
```console
147-
planet data filter | planet data search SkySatCollect --sort 'acquired desc' --limit 1 - | jq -r .id
158+
planet data search SkySatCollect --sort 'acquired desc' --limit 1 - | jq -r .id
148159
```
149160

150161

@@ -202,14 +213,14 @@ of Iowa. You can copy it and save as a file called `geometry.geojson`
202213
And then run it with this command:
203214

204215
```console
205-
planet data filter --geom geometry.geojson | planet data search PSScene -
216+
planet data filter --geom geometry.geojson | planet data search PSScene --filter -
206217
```
207218

208219
Note that by default all searches with the command-line return 100 results, but you can easily increase that with
209220
the `--limit` flag:
210221

211222
```console
212-
planet data filter --geom geometry.geojson | planet data search --limit 500 PSScene -
223+
planet data filter --geom geometry.geojson | planet data search --limit 500 PSScene --filter -
213224
```
214225

215226
Creating geometries for search can be annoying in a command-line workflow, but there are some ideas in the
@@ -220,7 +231,7 @@ Creating geometries for search can be annoying in a command-line workflow, but t
220231
Some of the most common filtering is by date. You could get all imagery acquired before August 2021:
221232

222233
```console
223-
planet data filter --date-range acquired lt 2021-08-01 | planet data search PSScene -
234+
planet data filter --date-range acquired lt 2021-08-01 | planet data search PSScene --filter -
224235
```
225236

226237
The 'operator' in this case is 'less than' (`lt`). The options are:
@@ -236,7 +247,7 @@ do a search for all images in July of 2021:
236247

237248
```console
238249
planet data filter --date-range acquired gte 2021-07-01 --date-range acquired lt 2021-08-01 | \
239-
planet data search PSScene -
250+
planet data search PSScene --filter -
240251
```
241252

242253
The date input understands [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339) and
@@ -246,7 +257,7 @@ on July 1st 2021:
246257

247258
```console
248259
planet data filter --date-range acquired gte 2021-07-01:06:20:10 --date-range acquired lt 2021-07-01:06:20:15 | \
249-
planet data search PSScene -
260+
planet data search PSScene --filter -
250261
```
251262

252263
### Range Filter
@@ -255,7 +266,7 @@ The range filter uses the same operators as the date filter, but works against a
255266
of these tend to be ones about cloudy pixels. For example you can search for data with clear pixels greater than 90%:
256267

257268
```console
258-
planet data filter --range clear_percent gt 90
269+
planet data filter --range clear_percent gt 90 | planet data search PSScene --filter -
259270
```
260271

261272
### String-In Filter
@@ -264,19 +275,20 @@ For properties that are strings you can use the `string-in` filter. For example
264275
with PS2 instrument:
265276

266277
```console
267-
planet data filter --string-in instrument PS2 | planet data search PSScene -
278+
planet data filter --string-in instrument PS2 | planet data search PSScene --filter -
268279
```
269280

270281
You can specify multiple strings to match, with a comma:
271282

272283
```console
273-
planet data filter --string-in instrument PS2,PSB.SD | planet data search PSScene -
284+
planet data filter --string-in instrument PS2,PSB.SD | planet data search PSScene --filter -
285+
274286
```
275287

276288
Another example is to select all data in a single strip:
277289

278290
```console
279-
planet data filter --string-in strip_id 5743640 | planet data search PSScene -
291+
planet data filter --string-in strip_id 5743640 | planet data search PSScene --filter -
280292
```
281293

282294
Note that in all these commands we are piping the results into the search. If you don't include the pipe then you'll
@@ -287,13 +299,13 @@ get the filter output, which can be interested to inspect to see exactly what is
287299
You can limit your search to only data with a particular asset, for example search just for 8-band analytic assets:
288300

289301
```console
290-
planet data filter --asset ortho_analytic_8b_sr | planet data search PSScene -
302+
planet data filter --asset ortho_analytic_8b_sr | planet data search PSScene --filter -
291303
```
292304

293305
Or 8-band assets that also have a UDM.
294306

295307
```console
296-
planet data filter --asset ortho_analytic_8b_sr --asset udm2 | planet data search PSScene -
308+
planet data filter --asset ortho_analytic_8b_sr --asset udm2 | planet data search PSScene --filter -
297309
```
298310

299311
You can find the list of available assets in each Item Type Page, like
@@ -306,14 +318,14 @@ sure you got the asset right, and it's valid for the item-types you're searching
306318

307319
### Permission Filter
308320

309-
The 'permission filter' is set to true by default, since most people want to search only for data they have access to
310-
and are able to download. But if you'd like to just get search Planet's catalog and get a sense of what is out there
311-
you can set the permission filter to false:
321+
By default, no search filters are applied. However, many people want to search only for data they have access to download
322+
that are of standard (aka not test) quality. Therefore, these filters can be easily added with the `--permission` and
323+
`--std-quality` flags. To use the permission and standard quality filters:
312324

313325
```console
314-
planet data filter --permission false --asset ortho_analytic_8b_sr | planet data search PSScene -
326+
planet data filter --permission --std-quality --asset ortho_analytic_8b_sr | planet data search PSScene --filter -
315327
```
316328

317329
## Stats
318330

319-
TODO
331+
TODO

docs/cli/cli-intro.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,13 @@ one command to be the input for the next one. So instead of having to save to a
8484
then referring to it you can just do it all in one call:
8585

8686
```
87-
planet data filter --range cloud_percent lt 10 | planet data search-quick PSScene -
87+
planet data filter --range cloud_percent lt 10 | planet data search PSScene --filter -
8888
```
8989

9090
The pipe says to take the output of the first command and pass it to the input of
9191
the second. You'll notice that the planet command has a dash (`-`), this is a convention
9292
that is often used by different CLI programs to explicitly say 'read from
93-
standard out'. Most Planet CLI commands require it, but one or two will implicitly
94-
read from standard out if it's not explicitly included. Using the dash to mean
93+
standard out'. Using the dash to mean
9594
'read from standard out' is a general convention used by many programs, but it's
9695
not universal, so check the docs of the program you're using as to how it reads
9796
from piped input. For example GDAL/OGR uses a specific `/vsistdin/` convention to
@@ -174,7 +173,7 @@ represent GeoJSON features, the JSON blob is a GeoJSON FeatureCollection.
174173
Otherwise, the JSON blob is a list of the individual results.
175174

176175
```console
177-
$ planet data filter | planet data search PSScene - | planet collect -
176+
$ planet data search PSScene | planet collect -
178177
```
179178

180179
This gives you a fully compliant GeoJSON FeatureCollection, which is

0 commit comments

Comments
 (0)