[ckan-dev] ckanext-spatial search modification

Tom Kralidis tomkralidis at gmail.com
Fri Nov 13 13:16:33 UTC 2015


On Fri, Nov 13, 2015 at 7:01 AM, Dominik Kapišinský
<dkapisinsky at gmail.com> wrote:
> Hello,
>
> I would like to modify my ckanext-spatial fork to search for something like
> contains (if package extent is contained by search box) instead of
> intersection between them. Is it doable?
> I think that I need to change the line in ckanext/spatial/lib/init.py :
>
> extents = Session.query(PackageExtent) \
> .filter(PackageExtent.package_id==Package.id) \
> .filter(PackageExtent.the_geom.intersects(input_geometry)) \
> .filter(Package.state==u'active')
>
> Could you help me please?
>

You can update https://github.com/ckan/ckanext-spatial/blob/master/ckanext/spatial/lib/__init__.py#L153
(changing .intersects to .contains).

Having said this, it would be great to expose the spatial predicates
to the UI, so a user can (optionally) select what kind of spatial
query they would like (assuming default=intersects).

..Tom



More information about the ckan-dev mailing list