简体   繁体   中英

Lookup of nodes with Neo4j Spatial

Using the Neo4j Spatial core java api, I have been able to put together code which allows me to lookup nodes within a specific distance from a given point however, I would like to be able to include nodes based on their catchment radius.

For example, if I am located at any given point which pizza companies in my local area or further afield could deliver to me (given their own delivery radius)

Any ideas on how this could be achieved with Neo4j Spatial?

Instead of modelling your Pizza companies as simply points on a map could you model their delivery radius as a related geometry shape? This would give you greater control over the delivery shape as well (not delivering to an island for example).

If you model the deliver area as a WKT Polygon, you can then perform a search in the form:

START loc = node:idx_bounding_location(withinDistance:[<lat>,<lon>,0.0])
MATCH (pz:Pizza:Company)-[:DELIVERY_AREA]->loc
RETURN pz

In this query the lat and lon values are the location of the person requiring pizza delivery.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM