Hi,

In current Neo4j releases the cypher support is limited to only the legacy
indexes, and as Michael pointed out, the 'withinDistance' type queries you
can use with the legacy index. However, your use case sounds like something
entirely separate from this. I see no distance calculation need at all. You
are only asking about connected edges between airports, correlated to
knowledge about which countries those airports are in. In fact there is no
need for Neo4j Spatial at all, because the knowledge of the country an
airport belongs to is always known about all airports.

Your graph model would have country nodes (no polygons required) and the
airport nodes would be attached to the country nodes to which they belong.
Edges between airports indicate routes. Then the two use cases you asked
about would be solved like this:

   - From what airports in Argentina is it possible to arrive to England

*MATCH (:Country
   
{name:"Argentina"})<-[:IN]-(a:Airport)-[:ROUTE*1..2]-(:Airport)-[:IN]->(:Country
   {name:"England")"}) RETURN a.name <http://a.name/>;*
   - A list of route options that leave a US city, have one stop somewhere
   else and then arrive in Germany


*MATCH (:Country
   {name:"USA"})<-[:IN]-(a:Airport), (b:Airport)-[:IN]->(:Country
   {name:"Germany")"}) MATCH (a)-[:ROUTE]->(x)-[:ROUTE]->(b) RETURN a.name
   <http://a.name/> as depart, x.name <http://x.name/> as transit, b.name
   <http://b.name/> as arrive;*

None of the above requires Neo4j Spatial, or the import of any spatial
information into the database at all.

However, if you are especially interested in using Neo4j Spatial, and want
to have queries that make use of country polygons, you will need to use the
Java embedded API, which allows you to import polygons into the spatial
index and perform queries on those. For your use case I do not see the
need, so I will not describe that option further, unless you also suggest
some use cases that do.

Regards, Craig

On Thu, Feb 12, 2015 at 1:27 PM, fede martinez <[email protected]>
wrote:

> Thanks Michael,
>
> I had already read that link but I wasn't sure if the other operations
> from *jts *were available or not. Aslo, in all the examples the geo
> functions are used with constants. Is it possible to use them with
> attributes from other nodes? I mean something like:
> 'withinDistance:[another_node.x, another_node.y, 100]' instead of
> 'withinDistance:[60.0,15.0, 100.0]'
>
> Fede
>
> El miércoles, 11 de febrero de 2015, 21:34:28 (UTC-3), Michael Hunger
> escribió:
>>
>> you can use withindistance, bbox and within geometry queries from cypher,
>>
>> see the neo4j-spatial docs:
>>
>> http://neo4j-contrib.github.io/spatial/#rest-api-find-
>> geometries-in-a-bounding-box-using-cypher
>>
>> HTH Michael
>>
>> Am 11.02.2015 um 23:06 schrieb fede martinez <[email protected]>:
>>
>> Hello,
>> I'm working on a school project which consists of comparing Neo4j spatial
>> capabilities vs ArangoDB.
>>
>> My idea is to load in Neo4j a list of airports with latitude and long and
>> then a list of countries which would be polygons. The airports have edges
>> if there is a route between them. I'd like to able to extract data such as:
>>
>> * From what airports in Argentina is it possible to arrive to England
>> * A list of route options that leave a US city, have one stop somewhere
>> else and then arrive in Germany
>>
>> What I would like to know is if I should create a layer for the airports
>> and another for the countries or if I should use only one, because I don't
>> know if can do "cross layers" queries. Also I'd like to know, because so
>> far I haven't been able to find the information, if I can use all the
>> operations from the *jts* using Cypher, and if not, which ones are the
>> operations I can do using Cypher?
>>
>> Thanks in advance
>>
>> Federico Martinez
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Neo4j" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to