Rick, this was just an example extension. If you look at the current code the test the plugin (has evolved a bit since last time), https://github.com/neo4j/neo4j-spatial/blob/master/src/test/java/org/neo4j/gis/spatial/ServerPluginTest.java you see there are now two endpoints in the plugin - addLayer and addPointToPayer. Craig has been adding support for configuration of the layer encoder, so that you can define your own property names that contain the lon/lat, but default is "longitude", "latitude" and "bbox" proeprties.
This is far from finished code, so we first need to make sure we have a minimum set of REST plugin calls that enables a meaningfull operation. If you want, you are most welcome to fork and contribute on this to get to a state where the plugin is doing what you want, which should be along these lines (e.g. adding a spatial search endpoint etc). The first version was just creating a layer, and returning the provided node in the result, which is kind of silly, but showed the point that the plugin was loaded into the server and could execute a first Neo4j-Spatial operation, the creation of the layer. Sorry for not pointing out that this code didn't actually do anything useful beside Hello GIS :) So, help in exanding on the Plugin is most welcome! 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://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party. On Wed, Jan 5, 2011 at 10:40 PM, Rick Otten <[email protected]> wrote: > I'm still a little confused on this and am hoping for more clarification, > I'm still on the very steep learning curve side of "newbie", please bear > with me... > > I can start up a neo4j rest server and successfully add nodes and edges. > I can see that I have neo4j spatial installed. > > I can also start up geoserver, and it connects without complaint to my > neo4j database via the "file:" interface. Unfortunately it doesn't see > anything in it. > > I have my raw data in various formats, including a geojson file. I tried > just adding the geojson structure as a node, but that didn't work... > > I'm still really unclear as to how to get my data into a layer in neo4j > (preferably using the REST interface) that will be recognized by > geoserver. > > I'm guessing that first you can create an empty "layer". In your example > below, is that what you are doing? What do you mean by "returns the > original node"? > > I suppose a single neo4j instance can have multiple independent layers in > it. Is that true? > > Your example layer appears to be titled "buildings". Does that mean it > will contain the shapes of buildings, or the point locations of buildings > (or both)? How do you add a 'building' (of either type) to the layer? > I'm assuming your example does not add any buildings because there is no > discernible location information in the data below. > > My locations are all defined by latitude/longitude pairs. At the moment > I'd like to start by adding simple "points" in a layer. Eventually I'd > like to add edges and shapes, but I'd be really happy just to be able to > get points mapped first. > > aTdHvAaNnKcSe ! > > >> Axel, >> I just pushed a first version of a Neo4j Spatial server plugin to github, >> see >> >> https://github.com/neo4j/neo4j-spatial/blob/f9e75ac62867ecd3fc178f01cfc8bbb40abda3ff/src/main/java/org/neo4j/gis/spatial/server/plugin/SpatialPlugin.java >> >> Basically, you copy all dependencies and the neo4j-spatial JARs (get >> them with "mvn dependency:copy-dependencies" into target/dependency) >> into $NEO$J_SERVER/plugins and you should get something like >> >> [~] $curl -H "Accept: application/json" http://localhost:7474/db/data/ >> { >> "extensions-info" : "http://localhost:7474/db/data/ext", >> "node" : "http://localhost:7474/db/data/node", >> "node-index" : "http://localhost:7474/db/data/index/node", >> "relationship-index" : >> "http://localhost:7474/db/data/index/relationship", >> "reference_node" : "http://localhost:7474/db/data/node/0", >> "extensions" : { >> "GetAll" : { >> "get_all_nodes" : >> "http://localhost:7474/db/data/ext/GetAll/graphdb/get_all_nodes", >> "getAllRelationships" : >> "http://localhost:7474/db/data/ext/GetAll/graphdb/getAllRelationships" >> }, >> "SpatialPlugin" : { >> "addPointToLayer" : >> "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addPointToLayer" >> } >> } >> } >> >> And then you add stuff with >> >> >> [~] $curl -H "Accept: application/json" -d >> "node=http://localhost:7474/db/data/node/0&layer=buildings" >> http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addPointToLayer >> [ { >> "outgoing_relationships" : >> "http://localhost:7474/db/data/node/0/relationships/out", >> "data" : { >> "name" : "Fredrik" >> }, >> "traverse" : >> "http://localhost:7474/db/data/node/0/traverse/{returnType}", >> "all_typed_relationships" : >> "http://localhost:7474/db/data/node/0/relationships/all/{-list|&|types}", >> "property" : "http://localhost:7474/db/data/node/0/properties/{key}", >> "self" : "http://localhost:7474/db/data/node/0", >> "properties" : "http://localhost:7474/db/data/node/0/properties", >> "outgoing_typed_relationships" : >> "http://localhost:7474/db/data/node/0/relationships/out/{-list|&|types}", >> "incoming_relationships" : >> "http://localhost:7474/db/data/node/0/relationships/in", >> "extensions" : { >> "ShortestPath" : { >> "shortestPath" : >> "http://localhost:7474/db/data/ext/ShortestPath/node/0/shortestPath" >> }, >> "DepthTwo" : { >> "nodesOnDepthTwo" : >> "http://localhost:7474/db/data/ext/DepthTwo/node/0/nodesOnDepthTwo", >> "relationshipsOnDepthTwo" : >> "http://localhost:7474/db/data/ext/DepthTwo/node/0/relationshipsOnDepthTwo", >> "pathsOnDepthTwo" : >> "http://localhost:7474/db/data/ext/DepthTwo/node/0/pathsOnDepthTwo" >> } >> }, >> "create_relationship" : >> "http://localhost:7474/db/data/node/0/relationships", >> "all_relationships" : >> "http://localhost:7474/db/data/node/0/relationships/all", >> "incoming_typed_relationships" : >> "http://localhost:7474/db/data/node/0/relationships/in/{-list|&|types}" >> } ] >> >> Of course, this just creates the layer and returns the original node, >> but still, looking at the db give us >> >> [~] $neo4j-shell >> :/Users/peterneubauer/program/neo4j-server/lib/geronimo-jta_1.1_spec-1.1.1.jar:/Users/peterneubauer/program/neo4j-server/lib/neo4j-1.2.M06.jar:/Users/peterneubauer/program/neo4j-server/lib/neo4j-examples-1.2.M06.jar:/Users/peterneubauer/program/neo4j-server/lib/neo4j-graph-algo-0.7-1.2.M06.jar:/Users/peterneubauer/program/neo4j-server/lib/neo4j-ha-0.5-1.2.M06.jar:/Users/peterneubauer/program/neo4j-server/lib/neo4j-index-1.2-1.2.M06.jar:/Users/peterneubauer/program/neo4j-server/lib/neo4j-kernel-1.2-1.2.M06.jar:/Users/peterneubauer/program/neo4j-server/lib/neo4j-lucene-index-0.2-1.2.M06.jar:/Users/peterneubauer/program/neo4j-server/lib/neo4j-management-1.2-1.2.M06.jar:/Users/peterneubauer/program/neo4j-server/lib/neo4j-online-backup-0.7-1.2.M06.jar:/Users/peterneubauer/program/neo4j-server/lib/neo4j-remote-graphdb-0.8-1.2.M06.jar:/Users/peterneubauer/program/neo4j-server/lib/neo4j-shell-1.2-1.2.M06.jar:/Users/peterneubauer/program/neo4j-server/lib/neo4j-udc-0.1-1.2.M06-neo4j! > .jar:/Users/peterneubauer/program/neo4j-server/lib/netty-3.2.1.Final.jar:/Users/peterneubauer/program/neo4j-server/lib/org.apache.servicemix.bundles.jline-0.9.94_1.jar:/Users/peterneubauer/program/neo4j-server/lib/org.apache.servicemix.bundles.lucene-3.0.1_2.jar:/Users/peterneubauer/program/neo4j-server/lib/protobuf-java-2.3.0.jar >> NOTE: Remote Neo4j graph database service 'shell' at port 1337 >> Welcome to the Neo4j Shell! Enter 'help' for a list of commands >> >> neo4j-sh (Fredrik,0)$ ls >> *name =[Fredrik] >> (me) --[KNOWS]-> (2) >> (me) --[SPATIAL]-> (34) >> neo4j-sh (Fredrik,0)$ ls 34 >> *type =[spatial] >> (34) --[LAYER]-> (35) >> (34) --[LAYER]-> (38) >> (34) <-[SPATIAL]-- (me) >> neo4j-sh (Fredrik,0)$ ls 38 >> *ctime =[1293647341655] >> *geomencoder =[org.neo4j.gis.spatial.WKBGeometryEncoder] >> *layer =[buildings] >> *layer_class =[org.neo4j.gis.spatial.EditableLayerImpl] >> (38) <-[LAYER]-- (34) >> (38) --[RTREE_METADATA]-> (39) >> (38) --[RTREE_ROOT]-> (40) >> >> So the layer is there :) >> >> Feel free to tinker around with this and add meaningful stuff to it! >> >> 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://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party. >> >> >> >> On Thu, Nov 18, 2010 at 8:57 PM, Peter Neubauer >> <[email protected]> wrote: >>> Alex, >>> sounds great, don't hesitate to get back to the list with question and >>> suggestions! >>> >>> 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://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party. >>> >>> >>> >>> On Wed, Nov 17, 2010 at 6:23 PM, Axel Morgner <[email protected]> wrote: >>>> Currently, I'm still busy with a customer project, but when open >>>> sourcing the software end of the year, I'll document it. >>>> >>>> Am 16.11.2010 00:01, schrieb Peter Neubauer: >>>>> Axel, >>>>> nice it worked out for you! Would be great if you could write up a >>>>> small blog or so on this, and give us some feedback on what to improve >>>>> to make the component more usable. WDYT? >>>>> >>>>> 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://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing >>>>> party. >>>>> >>>>> >>>>> >>>>> On Mon, Nov 15, 2010 at 10:03 PM, Axel Morgner<[email protected]> >>>>> wrote: >>>>>> On 02.11.2010 14:52, Craig Taverner wrote: >>>>>>>> Adding neo4j spatial to the picture should enable the CMS handling >>>>>>>> geo >>>>>>>> data objects without adding to much complexity (I hope). >>>>>>> OK. I think I'm beginning to get an idea of what you want. You have >>>>>>> a CMS, >>>>>>> and some of the data is geolocated, in the sense that you know what >>>>>>> countries it is associated with, and perhaps you even have >>>>>>> relationships to >>>>>>> 'country' nodes (or other nodes) representing locations. Now you >>>>>>> want to use >>>>>>> Neo4j Spatial to perform simple spatial queries on this. >>>>>> Your analysis is correct and brilliant. :-) >>>>>> >>>>>> In my case, the CMS payload data itself (like HTML, Images, Videos, >>>>>> CSS, >>>>>> JS, Blogs etc.) is stored in neo4j nodes. But logging data, too, of >>>>>> course. >>>>>> >>>>>>> I could imagine something like: >>>>>>> >>>>>>> 'give me all countries in the specified region (bounding box) and >>>>>>> include >>>>>>> the number of pages as an attribute of the result set'bute? >>>>>> Right now I'm using the SearchIntersectWindow class to determine >>>>>> which >>>>>> countries are needed to display within a certain global region. The >>>>>> countries data is loaded as a set of GeoJSON files via Javascript >>>>>> (using >>>>>> Polymaps), so neo4j spatial does only provide the country names. >>>>>> >>>>>>> I think you should either use the original shapefiles and the >>>>>>> existing ShapefileImporter or move to OSM data models for connected >>>>>>> topologies. >>>>>>> >>>>>>> A GeoJSON importer is a nice idea, but not worth the effort if you >>>>>>> already >>>>>>> have shapefiles. >>>>>> Indeed! I ended up with using the shapefile importer, using neo4j >>>>>> spatial to serve geodata nodes which are then connected on-the-fly >>>>>> with >>>>>> geo-tagged CMS data. >>>>>> >>>>>> Your comments and suggestions helped me a lot, so I just wanted to >>>>>> say >>>>>> thanks again. >>>>>> >>>>>> Axel >>>>>> >>>>>> >>>> >>>> _______________________________________________ >>>> Neo4j mailing list >>>> [email protected] >>>> https://lists.neo4j.org/mailman/listinfo/user >>>> >>> >> _______________________________________________ >> Neo4j mailing list >> [email protected] >> https://lists.neo4j.org/mailman/listinfo/user >> > > > -- > Rick Otten > [email protected] > O=='=+ > > > _______________________________________________ > Neo4j mailing list > [email protected] > https://lists.neo4j.org/mailman/listinfo/user > _______________________________________________ Neo4j mailing list [email protected] https://lists.neo4j.org/mailman/listinfo/user

