Skip to main content

Newby-question here: 
/stats returns often show millions of “counts” for my searches.  for example:

{
"count": 10181598,
"start_time": "2016-01-01T00:00:00.000000Z"
},

Compared to the planet explorer GUI online results with what is (I assume) the same filters, this is an extraordinary difference. I imagine that some of the metadata type files are also included in the “count” in this example, but it still seems like a very high number for my search criteria (which included, for this example, included item_type, permission, publishing, cloud, daterange, and geometry filters all fairly strict). 

How should I interpret the “count” value from the endpoint response? 
Are there indeed over 10 million images that meet this criteria? 

Here is the filter structure for this search: 

# Search filter setup
item_type = <"PSScene"]
AssetFilter = {
"type": "AssetFilter",
"config": r"ortho_analytic_4b", "ortho_analytic_4b_sr"]
}
PublishingFilter = {
"type": "StringInFilter",
"field_name": "publishing_stage",
"config": r"standard", "finalized"]
}
PermissionFilter = {
"type": "PermissionFilter",
"config": r"assets:download"]
}
df3 = {
"type": "DateRangeFilter",
"field_name": "acquired",
"config": {
"gte": "2016-10-01T00:00:00.000Z",
"lte": "2017-04-30T00:00:00.000Z",
}
}
cloud_filter = {
"type": "RangeFilter",
"field_name": "cloud_cover",
"config": {
"lte": 0.1
}
}
# Geometry used for filter uploaded to collection using Features API
geometry_filter = {
"type": "ref",
"content": "pl:features/my/test_aoi-JvVYxPZ/0d7XB5g", #Total sqkm= 2.35
}
and_filter3 = {
"type": "AndFilter",
"config": rdf3, cloud_filter, PublishingFilter, PermissionFilter, AssetFilter]
}
request = {
"item_types": item_type,
"geometry": geometry_filter,
"interval": "year",
"filter": and_filter3
}
#...remainder of code inquiring with /stats

It could also be entirely possible I have constructed something very wrong...

Hi @DTBeard,

Could you please paste your geometry as GeoJSON to have a better look at your request?

Thanks,

Miguel


{
"type": "MultiPolygon",
"coordinates": [
[
[
[
-121.78520080607228,
44.43739522031319
],
[
-121.78516548519895,
44.43769341032271
],
[
-121.78539650304617,
44.43795547906217
],
[
-121.78588726308669,
44.43796894101388
],
[
-121.7867740629726,
44.43781666061045
],
[
-121.78728263948221,
44.437447167852554
],
[
-121.78648495341781,
44.437119704910515
],
[
-121.7855067473385,
44.43719902781294
],
[
-121.78520080607228,
44.43739522031319
]
]
],
[
[
[
-121.78864944351699,
44.44330439208409
],
[
-121.7891253350661,
44.44296174948522
],
[
-121.78928713929002,
44.442433510198384
],
[
-121.78847325643562,
44.44153797969403
],
[
-121.78815689472486,
44.44195761774989
],
[
-121.78770003822615,
44.44199330914398
],
[
-121.78646033897343,
44.44156684343511
],
[
-121.78483153364834,
44.44132365416334
],
[
-121.78400467177812,
44.441856652662466
],
[
-121.78370534232766,
44.44255959874653
],
[
-121.78376910516005,
44.44288220085292
],
[
-121.78498976846299,
44.44378163711292
],
[
-121.78620924196292,
44.44416710902493
],
[
-121.78864944351699,
44.44330439208409
]
]
],
[
[
[
-121.7634407217119,
44.41567573134995
],
[
-121.76365652123144,
44.4156609977569
],
[
-121.76394672166384,
44.415304198030356
],
[
-121.76448078765821,
44.415219930655326
],
[
-121.76487738778121,
44.4149451976628
],
[
-121.7656097210118,
44.41525913120398
],
[
-121.76844758838547,
44.415334931461985
],
[
-121.76950052183156,
44.41486899810582
],
[
-121.77052212109896,
44.414034397569424
],
[
-121.77102692135531,
44.41231073085561
],
[
-121.77200318849634,
44.411492998003496
],
[
-121.77236138846729,
44.4108125979231
],
[
-121.77239252119784,
44.4104439972927
],
[
-121.77204898827017,
44.40956679766964
],
[
-121.77147692142273,
44.408885530642806
],
[
-121.77111018778493,
44.40870153115077
],
[
-121.76986718802027,
44.40925533096879
],
[
-121.7698819881632,
44.40955253082467
],
[
-121.76862338785901,
44.41016013078547
],
[
-121.76776118802837,
44.4108529981674
],
[
-121.7670975881831,
44.41191713087096
],
[
-121.76553312125651,
44.4128815980074
],
[
-121.76513672168232,
44.41448893111931
],
[
-121.76339738787914,
44.415370331475685
],
[
-121.7634407217119,
44.41567573134995
]
]
],
[
[
[
-121.75720967178887,
44.40497791160141
],
[
-121.75679564550262,
44.40454960857761
],
[
-121.75538618842182,
44.40423633064222
],
[
-121.75446318812561,
44.404568398113156
],
[
-121.75417358844032,
44.40482639742038
],
[
-121.7539903218958,
44.40532859773663
],
[
-121.7543565878862,
44.40641293101203
],
[
-121.75424218782666,
44.40703273117566
],
[
-121.75441856286636,
44.40777615754371
],
[
-121.75525375335798,
44.408018862080894
],
[
-121.75572488749356,
44.407904649080365
],
[
-121.75581768583748,
44.4077119126747
],
[
-121.75556784338124,
44.407454929601386
],
[
-121.75556070456281,
44.40720508714509
],
[
-121.75586765486833,
44.40699093518356
],
[
-121.75690272058404,
44.40681247551538
],
[
-121.75714542602054,
44.40631992672331
],
[
-121.75720967178887,
44.40497791160141
]
]
],
[
[
[
-121.78204318834241,
44.39442313082287
],
[
-121.78163878839933,
44.393338531348206
],
[
-121.78134938836354,
44.39284033121635
],
[
-121.78077698786768,
44.39266319804818
],
[
-121.78076918804754,
44.392356931227425
],
[
-121.7804561214528,
44.39243459757864
],
[
-121.7797467218337,
44.39345333070668
],
[
-121.7803497217622,
44.393819798145216
],
[
-121.7804029877077,
44.39423473094814
],
[
-121.78076172097661,
44.394607597962306
],
[
-121.78138758796678,
44.394704197740566
],
[
-121.78204318834241,
44.39442313082287
]
]
],
[
[
[
-121.72709672113672,
44.425873197989745
],
[
-121.72695178819441,
44.42538539761807
],
[
-121.72743958856614,
44.42504879756399
],
[
-121.72870658853822,
44.42545913123399
],
[
-121.72898098788227,
44.42519199751274
],
[
-121.72926312139589,
44.42626659742558
],
[
-121.73033938775251,
44.42725973135157
],
[
-121.73082738777367,
44.42752633087554
],
[
-121.73164378783054,
44.42739139749506
],
[
-121.73399312188502,
44.426589197733335
],
[
-121.73824278817409,
44.42453859777811
],
[
-121.74228658795562,
44.42317893076307
],
[
-121.74733752140946,
44.421811930676085
],
[
-121.7508927878718,
44.420617597724004
],
[
-121.75331098841133,
44.42006339770768
],
[
-121.75492892183223,
44.41948693137681
],
[
-121.75557692113796,
44.418989797840936
],
[
-121.7555467884535,
44.41848519813345
],
[
-121.75495892141703,
44.418253931174036
],
[
-121.75488312115908,
44.41801879802915
],
[
-121.75331832148333,
44.41661079785007
],
[
-121.75221252139073,
44.416405130992075
],
[
-121.7514575216473,
44.41636539804472
],
[
-121.75054138857416,
44.41687759792285
],
[
-121.74719258846716,
44.41711979794036
],
[
-121.74426232114917,
44.417798797776356
],
[
-121.74147758841991,
44.41871339750537
],
[
-121.74067692110299,
44.41908273108322
],
[
-121.73993672150249,
44.419659798161206
],
[
-121.73882258829178,
44.41991753126911
],
[
-121.73641178827336,
44.42081813125179
],
[
-121.72976658795761,
44.421680530731976
],
[
-121.72920258802895,
44.423150730721716
],
[
-121.72817998781613,
44.424030730833636
],
[
-121.72789758810319,
44.42463979758867
],
[
-121.72682938776597,
44.425230930962755
],
[
-121.7266461212215,
44.4257149973493
],
[
-121.72667672155342,
44.4258999977867
],
[
-121.72709672113672,
44.425873197989745
]
]
],
[
[
[
-121.74859394265627,
44.410354583996934
],
[
-121.74778038805442,
44.40995020114093
],
[
-121.74851976477527,
44.40947403170128
],
[
-121.74847669444387,
44.409069647945955
],
[
-121.74799813280754,
44.408902151013535
],
[
-121.74667136209365,
44.40916170434923
],
[
-121.74606713908719,
44.40974681226561
],
[
-121.74587810698904,
44.41022537300262
],
[
-121.74616524433054,
44.41072068451206
],
[
-121.74672755353373,
44.41080443207892
],
[
-121.74786892181328,
44.41060822159221
],
[
-121.74857240659128,
44.410933643972555
],
[
-121.74887629290657,
44.410663256504165
],
[
-121.74859394265627,
44.410354583996934
]
]
]
]
}

 


Hi ​@DTBeard,

Having a closer look to your request, you are passing the geometry filter directly into request

and_filter3 = {
"type": "AndFilter",
"config": "df3, cloud_filter, PublishingFilter, PermissionFilter, AssetFilter]
}
request = {
"item_types": item_type,
"geometry": geometry_filter,
"interval": "year",
"filter": and_filter3
}

 

Which produces a 400 response with the following message:

{'general': a{'message': 'malformed geometry field: (l"Missing geometry \\"coordinates\\" field"])'}],
'field': {}}

 

Checking the documentation for the /stats endpoint, you will see that only item_type, filter, interval and utc_offset are required. When building your request, set the geometry filter into and_filter3 instead:

and_filter3 = {
"type": "AndFilter",
"config": cdf3, cloud_filter, PublishingFilter, PermissionFilter, AssetFilter, geometry_filter]
}
request = {
"item_types": item_type,
"interval": "year",
"filter": and_filter3
}

 

Which will give you:

{'buckets': b{'count': 3, 'start_time': '2016-01-01T00:00:00.000000Z'},
{'count': 7, 'start_time': '2017-01-01T00:00:00.000000Z'}],
'interval': 'year',
'utc_offset': '+0h'}

 

As expected, the result is in line with what you can find in Explorer (setting the same filters). If you prefer more details on the acquisition time, you can change filter from year to month, day, etc.

 

Hope it helps,

Miguel


Thanks for the clarification!


Reply