Marcin, your approach is quite ok, but you can skip the encoding step and just give the lat/lon properties to the SimplePointEncoder which then will take these as the indexing sources, see the tests in
https://github.com/neo4j/spatial/blob/master/src/test/java/org/neo4j/gis/spatial/TestSimplePointLayer.java Does that help? Cheers, /peter neubauer GTalk: neubauer.peter Skype peter.neubauer Phone +46 704 106975 LinkedIn http://www.linkedin.com/in/neubauer Twitter http://twitter.com/peterneubauer http://www.neo4j.org - Your high performance graph database. http://startupbootcamp.org/ - Öresund - Innovation happens HERE. http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party. On Mon, Oct 10, 2011 at 12:49 PM, Marcin Zpa <[email protected]> wrote: > Hi guys, > i think my question is pretty simple, but since i cannot find anything > in network about it i decided to ask you. I'm using SDG with > cross-store functionality. I have users which are persisted in the > relational database. User has Address and Address is stored in Neo4j. > Going further Address has Coordinates which are saved in neo and > connected with address through ADDRESS_LOCATION. First question is if > this way of persisting objects is correct, perform ok and make sense > (suggestion ware welcomed). In the future i will have also many routes > which i want to save in neo as well. Since i want to give users > possibility to find each others and to finds routes in their > neighborhood i decided to use neo4 spatial (another reason was > curiosity of trying something new ;) and now comes the proper > question. How should i map my address coordinates to be able to use > them for spatial queries. As for now I am using SimplePointEncoder and > EditableLayer. I transform my domain coordinates object to coordinate > object from geotool plus i pass property nodeId with the id value of > coordinate node which has relationship to address. Once I get results > from the search within distance, i transform SpatialDataRecord back to > "my" coordinates using saved nodeId and finding them by id. Once I > have coordinates node i traverse it get Address node. This approach > seems over-complicated to me and i am convinced there is better way of > doing it. I was thinking about creating relationship between domain > coordinates and geo node from neo4j spatial. I tried it out with > changing implementation of EditableLayer and adding one line after > invocation of the method addGeomNode which connect these two but i > guess that geo layer should stay isolated from domain that is why i > resigned from it. How would i do it in the best way? Does whole this > approach with cross-store make sense in this case? > > -- > View this message in context: > http://neo4j-community-discussions.438527.n3.nabble.com/Mapping-domain-graph-to-spatial-layer-tp3409159p3409159.html > Sent from the Neo4j Community Discussions mailing list archive at Nabble.com. > _______________________________________________ > Neo4j mailing list > [email protected] > https://lists.neo4j.org/mailman/listinfo/user > _______________________________________________ Neo4j mailing list [email protected] https://lists.neo4j.org/mailman/listinfo/user

