Yes, look at the ones included in the library. See one I made as a sample
years ago that can encode a LineString as a chain of connected nodes:
https://github.com/neo4j-contrib/spatial/blob/master/src/main/java/org/neo4j/gis/spatial/encoders/SimpleGraphEncoder.java

You could copy this and extent it to handle Point, LineString and Polygon.
The OSMGeometryEncoder is one that can handle those types, but it uses a
more complex graph model you perhaps don't want to be burdened by. I think
the graph model I suggested in my earlier mail, and the sample code linked
to here, are more appropriate for you.

On Thu, Sep 11, 2014 at 3:50 PM, Alireza Rezaei M <alireza...@gmail.com>
wrote:

> Any example on how to build such customized GeometryEncoder?
>
> Alireza
>
> On Thu, Sep 11, 2014 at 3:07 PM, Craig Taverner <cr...@amanzi.com> wrote:
>
>>
>> I want to build a graph out of the result of this query, is there any
>>> such
>>> solution already in Neo4j, i.e., to recieve a query result as yet
>>> another graph not
>>> just a list of node?
>>>
>>
>> This sounds very domain specific. What kind of graph do you want? I would
>> assume you would need to build whatever graph you want yourself.
>>
>> However, if the graph you are talking about is the graph structure of the
>> geometries themselves, then I recommend my previous suggestion, with a
>> custom GeometryEncoder that allows the LineString and Polygon geometries to
>> already be graphs. In that case your data model for a three point Polygon
>> could be (p)-[:points]->(a)-[:first]->(b)->[:next]->(c)-[:last]->(a), where
>> (a), (b) and (c) could all be Point Geometries in your index, and (p) would
>> be the polygon containing those three points. The bbox and gtype for each
>> point is stored on the a,b,c nodes, and the bbox and gtype of the entire
>> polygon is stored on the (p) node, and your GeometryEncoder knows how to
>> convert from graphs to Geometry objects and back.
>>
>> This way you control entirely the data model, while still being able to
>> use the spatial library for geometry searches.
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Neo4j" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/neo4j/svcOw_S0l1A/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> neo4j+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Best Regards
>
> Alireza Rezaei Mahdiraji
>
>  --
> 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.
>

-- 
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