Thanks Craig, 

What about the case where we have two point nodes, how do we compute the 
length, or when we have a set of points related to a 
polygon, how do we compute the area? Shall we create linestring and polygon 
first and then compute length and area? 

Thanks,
Best,
Alireza 


On Friday, September 19, 2014 9:45:02 PM UTC+2, Craig Taverner wrote:
>
> I'm assuming these are nodes that represent geometries. In that case you 
> should convert them to the JTS Geometry object and get the length and area 
> from that.
>
> For example, if you did a search with the GeoPipeline, you will return a 
> collection of SpatialDatabaseRecord objects, which contain the node and the 
> geometry. You could do something like:
>
> for(SpatialDatabaseRecord record:results) {
> double length = record.getGeometry().getLength();
> double area = record.getGeometry().getArea();
> }
>
> If you no longer have the SpatialDatabaseRecord, but only the node, you 
> can still convert it to a geometry with:
> Geometry geom = layer.getGeometryEncoder().decodeGeometry(node);
>
> And then call the getLength() and getArea() methods. Check the JTS 
> documentation for more details.
>
> On Fri, Sep 19, 2014 at 10:24 AM, Alireza Rezaei Mahdiraji <
> alire...@gmail.com <javascript:>> wrote:
>
>>
>> Hi All, 
>>
>> I need to calculate length and area of given node(s) in two cases:
>>
>> 1- for length either a node with line string geometry is given or two 
>> nodes with point geometry
>>
>> 2- for polygon either a node with polygon geometry is given or the set of 
>> points of the polygon 
>> as separate point geometries.
>>
>> I am aware of GeoPipeline.start( boxesLayer ).calculateLength() but it 
>> seems it computes 
>> for all nodes in a layer while I am interested in given set of nodes (two 
>> cases above).
>>
>>
>> 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