[ckan-dev] Spatial search for datasets with dataset collection

Tracy Harton tracy at amphibioustech.com
Mon Aug 5 19:08:59 UTC 2013


Thank you very much, Adrià.   The POST requirement and the fq format are what was causing me problems.  
I am now able to geographically query collections just fine.
Thanks,
/tracy

> Hi,
> 
> CKAN 2.X definitely supports spatial queries via the API. As shown on
> the example in the ckanext-spatial documentation the endpoint for the
> action api (v3) is /api/action/package_search.
> 
> Note as well that up to CKAN 2.0.1 the request needs to be a POST
> request, as shown in these working examples on catalog.data.gov:
> 
> * BBox search (5132 results):
> 
> curl -XPOST -d '{"extras":{"ext_bbox":"-121,45,-120,46"}}'
> http://catalog.data.gov/api/action/package_search
> 
> * BBox search within a collection (6 results):
> 
> curl -XPOST -d '{"fq":
> "collection_package_id:b64c5a49-80bf-4fd2-ac7f-c2f7fe474ae6",
> "extras":{"ext_bbox":"-121,45,-120,46"}}'
> http://catalog.data.gov/api/action/package_search
> 
> (Note that the fq parameter is used for defining the collection id,
> this is due to the implementation of this custom option on data.gov)
> 
> 
> Not related to catalog.data.gov, as it uses a slightly older version,
> but starting on CKAN 2.0.1 queries can be done via a GET request in
> the following form:
> 
> curl http://demo.ckan.org/api/action/package_search?ext_bbox=-16.171875,38.8225909761771,12.65625,57.7041472343419
> 
> 
> Hope this helps,
> 
> Adrià



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20130805/51532a41/attachment.html>


More information about the ckan-dev mailing list