Hi Mohana, Your understanding of point 1 is correct. You application code would need to create new queries for every start node, replacing the lat/lon part for each start node. The edges in my query were created from the start node to the found node. However, since you consider all nodes, you will get every pair twice, with relationships in both directions. Perhaps you want this, perhaps not. If not, you need to have an extra clause to ignore cases where there already exists a relationship. Right now the use of MERGE would ignore duplicates in the same direction, but not consider the other direction.
For option 2, there is actually a lot more documentation and sample code existing, since we wrote the Java API as the primary API, with the REST API only tacked on later. The most useful references are the test cases, but I'll list a few places you can start looking: - The README <https://github.com/neo4j-contrib/spatial> in the github repo, usually a good place to start, covering a bit of everything - The Neo4j Spatial Manual <http://neo4j-contrib.github.io/spatial/>, if you go down to the 'Examples' near the end you will see mostly Java API examples there. - The example code <https://github.com/neo4j-contrib/spatial/tree/master/src/test/java/org/neo4j/gis/spatial> used for regression testing. This is the best reference, because it covers almost the entire Java API, but can be time consuming to look through. I would guess the best place for you to start might be the TestSimplePointLayer <https://github.com/neo4j-contrib/spatial/blob/master/src/test/java/org/neo4j/gis/spatial/TestSimplePointLayer.java> . For using this code in a server side extension, you should refer to the normal neo4j-server manual for information on writing server extensions <http://docs.neo4j.org/chunked/stable/server-extending.html>. Regards, Craig On Mon, Aug 18, 2014 at 1:02 PM, Mohana Krishna <[email protected]> wrote: > I have few questions: > > 1) Regarding first option > a) Do you mean to loop in REST API code? > b) Do I have to manually replace lat lon with each of the nodes values > and case number (as you have written in query) for every node? (as you said > iterate over all nodes and since dynamic query writing is not possible) > c) It seems even if I loop over all nodes I have to manually replace > lat-lon for all nodes as dynamic query writing is not being is supported > (is my understanding right?) > d) If my understanding is correct the code you wrote will create edges* > from* every node within 10KM distance *to *the node under consideration, > right? > > 2) Regarding second option > a) Can you point to any reference links to use spatial functions using > JAVA API? (It would be of great help as I am a beginner and I don't find > much resources on using neo4j*-spatial* through JAVA API) > b) Need some more clarity on creating relationships(spatial) as needed > in my scenario through JAVA API > > I am newbie to neo4j and especially to spatial component of it. Please > help me out. Thanks a lot Craig. I am learning new things. > > > On Tuesday, 12 August 2014 20:00:01 UTC+5:30, Mohana Krishna wrote: > >> Hello, >> >> I have loaded the spatial data in the attached file using REST API script >> (which is also attached). The nodes are created and I can visualize them on >> DB. >> >> However when I perform the query >> >> "START n=node:geom('withinDistance:[41.8082, -87.7084, 10.0]') RETURN n" >> in CYPHER window , I am getting "Unknown Error" as result. >> >> Please help. >> > -- > 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.
