Hi Craig, 

Any idea how to implement the knn in efficient way? We need to specify an 
initial distance and if we do not find k neighbours 
within that distance we need to increase it, which does not seem like very 
efficient approach. 


Thanks,
Alireza

On Tuesday, September 23, 2014 8:17:04 PM UTC+2, Craig Taverner wrote:
>
> I did not answer everything. But the JTS distance method will work for all 
> geometries, so that answers most of your questions.
>
> The GeoPipeline methods also provide ways to find objects within distances 
> of other objects (using the rtree for optimized searches). And it provides 
> sorting too, so you can, for example, search for everything within some 
> maximum bounds, sort by distance and pick the closest 'k' elements.
>
> On Tue, Sep 23, 2014 at 8:14 PM, Craig Taverner <cr...@amanzi.com 
> <javascript:>> wrote:
>
>> The distance is calculated best using JTS. For example:
>> double distance = pointA.distance(pointB)
>>
>> See 
>> http://tsusiatsoftware.net/jts/javadoc/com/vividsolutions/jts/geom/Geometry.html#distance(com.vividsolutions.jts.geom.Geometry)
>>
>> On Tue, Sep 23, 2014 at 3:26 PM, Alireza Rezaei Mahdiraji <
>> alire...@gmail.com <javascript:>> wrote:
>>
>>>
>>> Hi All, 
>>>
>>> Given two geometries how do compute the distance between 
>>> them in neo4j spatial? For instance given two points stored in two nodes?
>>>
>>> What other kind of distance are defined? For instance, is it possible to 
>>> find 
>>> distance between a point and a linestring/polygon or distance between 
>>> two polygons?
>>>
>>> Related to the concept of distance, it is possible to find objects 
>>> within a given distance of a 
>>> given object. But what about computing knn, i.e., finding k elements 
>>> which are closets to the 
>>> given object? Shall we compute all distances and then pick top k or 
>>> there is implemented 
>>> and optimized way to do this?
>>>
>>> Thanks,
>>> Best,
>>> Alireza
>>>
>>> -- 
>>> 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.

Reply via email to