> On 22 Dec 2022, at 6:44 pm, Thierry Florac <[email protected]> wrote: > > My main usage are probably : > - to find objects which are located below a given distance from a reference > points > - to find objects which are contained into a given geometry or overlapping > it. > > I generally use PostGIS or Elasticsearch to handle these queries, but in some > contexts it could be useful to mix these queries with other attributes > queries directly from the catalog…
Hi Thierry, I’m in a similar position and really don’t want to carry around the complexity of PostGIS installs and syncing data between two systems. I’ve been able to get sub ms results when searching for a point in 300,000+ polygons from the all country admin region dataset at https://gadm.org/download_world.html - that is plenty fast enough for my needs... At the moment there is code in a fork installable via: pip install 'git+https://github.com/pfw/hypatia.git@spatial-index#egg=hypatia[spatial]' Which so far passes all my tests. It exposes intersects as a Comparator so you can do things like: from shapely import box spatialindex.intersects(box(151.20699218799413, -33.864564753236095, 151.20729952635648, -33.86439938579896)).execute().all() Or combine as you would normally via: (spatialindex.intersects(box(151.20699218799413, -33.864564753236095, 151.20729952635648, -33.86439938579896)) & otherindex.eq(263)).execute().all() It does support other predicates than ‘intersects’ but doesn’t expose them as Comparators yet - that will come shortly - have a look at test_belgium. The underlying data structure can support a KNN query for finding ’nearest to x’ and I’ll add that as well. It would be great to hear if the current state works for your needs and once the few extra bits are there I’ll clean it up for a PR on the main repo. Peter W. -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/5EFF8574-F3EF-4DCA-A1DD-FBC95CFBD438%40thirdfloor.com.au.
