Closed Alexander-Barth closed 1 year ago
I am wondering if we can make the API nicers by using a macro, any ideas?
I don't think the macro is that much nicer than just using normal syntax. I'm a bit of a macro minimalist though.
Looking at the rather complex query example from the spec, this is what it would look like with regular syntax:, which IMO is quite ok, and doesn't have the mental overhead of trying to guess what a macro is doing.
query = Dict(
"stringAttr1" => Dict("endsWith"=>"xyz", "startsWith"=>"abc"),
"stringAttr2" => Dict("contains"=>"mnop"),
"stringAttr3" => Dict("in"=>["landsat", "modis", "naip"]),
"eo:cloud_cover" => Dict("lte"=>10, "gte"=>0),
)
Thank you for your feedback, this is implemented now using the API as you suggested.
https://github.com/JuliaClimate/STAC.jl/blob/main/test/runtests.jl#L105-L110
Also CQL2 (a bit more verbose) filter work in my tests with the filter
parameter for search.
This is currently a candiate extension:
https://github.com/radiantearth/stac-api-spec/tree/master/fragments/query
As suggested by @visr, we could implemented it here, as it is also implemented in pystac:
https://planetarycomputer.microsoft.com/docs/quickstarts/reading-stac/
I am wondering if we can make the API nicers by using a macro, any ideas?