Hi Craig, thanks for you explanation. I had not tried yet to create more than one layer, but now I know what is the situation. I'm sorry that the only solution is to store other coordinates in new nodes.
Regards Rita Il giorno giovedì 18 settembre 2014 16:28:34 UTC+2, Craig Taverner ha scritto: > > Hi, > > The problem is that even though you can control the property names of the > x and y coordinates, you cannot (currently) control the bbox property used > by the index. It is possible to store multiple locations in the same node > using different x and y properties on different layers (different indexes), > but the last index (layer) added to will re-write the bbox property, and > this will mean that searches in any index will return results appropriate > for the last index. > > For example code for this, see > https://github.com/neo4j-contrib/spatial/blob/master/src/test/java/org/neo4j/gis/spatial/TestSimplePointLayer.java#L168. > > In this code I made two layers, one with 'xa' and 'ya' as the property > names, and one with 'xb' and 'yb' as the properties. It is possible to add > two locations (different values) to the same node, but when adding the > nodes to the index, the bbox is set to the last layer (layerB) and therefor > results for the first layer are not correct. See the attached images for > the results of the two searches. The distortion in my-points-A.png is due > to this issue. > > It is better to create two nodes for the two locations, and create a > relationship between them to model your dependency. > > Regards, Craig > > On Thu, Sep 18, 2014 at 1:59 PM, Rita <rita...@gmail.com <javascript:>> > wrote: > >> Hi everybody, >> I ask you if it is possibile for Neo4j-Spatial to create index on nodes >> with more than one couple of coordinate (indexing all of these spatial >> properties). >> I mean, now I have something like this >> >> config = new HashMap<String, String>(); >> config.put(LayerNodeIndex.LAT_PROPERTY_KEY, "la"); >> config.put(LayerNodeIndex.LON_PROPERTY_KEY, "lo"); >> config.put(SpatialIndexProvider.GEOMETRY_TYPE, LayerNodeIndex. >> POINT_PARAMETER); >> layerIndex = new LayerNodeIndex("layerIndex", graph, config); >> ... >> layerIndex.add(node, "", ""); >> ... >> >> >> >> where my node has properties: >> >> la : latitude >> lo: longitude >> >> so till now, I am indexing one couple of coordinate and it's ok. >> >> But now I add another couple of spatial properties: >> la1 : latitude >> lo1: longitude >> >> so how can I index also these? >> >> I've tried specifing the property like this: >> >> ... >> layerIndex.add(node, "la", Double.parseDouble(node.getProperty("la"). >> toString())); >> layerIndex.add(node, "lo", Double.parseDouble(node.getProperty("lo"). >> toString())); >> ... >> layerIndex.add(node, "la1", Double.parseDouble(node.getProperty("la1"). >> toString())); >> layerIndex.add(node, "lo1", Double.parseDouble(node.getProperty("lo1"). >> toString())); >> >> >> >> but I cannot indexing all, I think because constants >> LayerNodeIndex.LAT_PROPERTY_KEY and LayerNodeIndex.LON_PROPERTY_KEY are >> unique for an index so they took the value of last definition, but there is >> a way to define a list of them? >> >> Is there a way to solve this case? Could someone suggest the way please? >> >> Many thanks. >> Rita >> >> -- >> 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 neo4j+un...@googlegroups.com <javascript:>. >> 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 neo4j+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.