Daniel,
try this:

curl -X POST 
http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addSimplePointLayer
-H "Content-Type:application/json" -d '{"layer":"geom", "lat":"lat",
"lon":"lon"}'
curl -X POST http://localhost:7474/db/data/node -H
"Content-Type:application/json" -H "Accept:application/json" -d
'{"lon": 15.2, "lat": 60.1}'
curl -X POST -H "Content-Type:application/json" -d
'{"layer":"geom","node":"http://localhost:7474/db/data/node/5"}'
http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addNodeToLayer
curl -X POST -H "Content-Type:application/json" -d
'{"layer":"geom","minx":15.0,"maxx":15.3,"miny":60.0,"maxy":60.2}'
http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/findGeometriesInLayer

Does that work?

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              - NOSQL for the Enterprise.
http://startupbootcamp.org/    - Öresund - Innovation happens HERE.



On Wed, Nov 23, 2011 at 12:30 PM, danielb <danielbercht...@gmail.com> wrote:
> Hi Peter,
>
> I am more stuck today than yesterday oO I can't get the index to appear in
> the indexmanager any more. First I dropped the database and started from
> zero:
>
> C:\neo4j-community-1.5\bin>Neo4j.bat start
>
> SERVICE_NAME: Neo4j-Server
>        TYPE               : 10  WIN32_OWN_PROCESS
>        STATE              : 2  START_PENDING
>                                (NOT_STOPPABLE, NOT_PAUSABLE,
> IGNORES_SHUTDOWN)
>        WIN32_EXIT_CODE    : 0  (0x0)
>        SERVICE_EXIT_CODE  : 0  (0x0)
>        CHECKPOINT         : 0x0
>        WAIT_HINT          : 0x7d0
>        PID                : 2132
>        FLAGS              :
>
> C:\neo4j-community-1.5\bin>b:
>
> B:\>curl http://localhost:7474/db/data/
> {
>  "relationship_index" : "http://localhost:7474/db/data/index/relationship";,
>  "node" : "http://localhost:7474/db/data/node";,
>  "relationship_types" : "http://localhost:7474/db/data/relationship/types";,
>  "neo4j_version" : "1.5",
>  "batch" : "http://localhost:7474/db/data/batch";,
>  "extensions_info" : "http://localhost:7474/db/data/ext";,
>  "node_index" : "http://localhost:7474/db/data/index/node";,
>  "reference_node" : "http://localhost:7474/db/data/node/0";,
>  "extensions" : {
>    "CypherPlugin" : {
>      "execute_query" :
> "http://localhost:7474/db/data/ext/CypherPlugin/graphdb/execute_query";
>    },
>    "SpatialPlugin" : {
>      "addEditableLayer" :
> "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addEditableLayer";,
>      "addCQLDynamicLayer" :
> "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addCQLDynamicLayer";,
>      "updateGeometryFromWKT" :
> "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/updateGeometryFromWKT";,
>      "findGeometriesInLayer" :
> "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/findGeometriesInLayer";,
>      "addGeometryWKTToLayer" :
> "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addGeometryWKTToLayer";,
>      "getLayer" :
> "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/getLayer";,
>      "addSimplePointLayer" :
> "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addSimplePointLayer";,
>      "addNodeToLayer" :
> "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addNodeToLayer";
>    },
>    "GremlinPlugin" : {
>      "execute_script" :
> "http://localhost:7474/db/data/ext/GremlinPlugin/graphdb/execute_script";
>    }
>  }
> }
> B:\>curl -d "layer=geom&lon=lon&lat=lat"
> http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addSimplePointLayer
> [ {
>  "outgoing_relationships" :
> "http://localhost:7474/db/data/node/2/relationships/out";,
>  "data" : {
>    "layer_class" : "org.neo4j.gis.spatial.EditableLayerImpl",
>    "layer" : "geom",
>    "geomencoder" : "org.neo4j.gis.spatial.encoders.SimplePointEncoder",
>    "geomencoder_config" : "lon:lat",
>    "ctime" : 1322045456422
>  },
>  "traverse" : "http://localhost:7474/db/data/node/2/traverse/{returnType}";,
>  "all_typed_relationships" :
> "http://localhost:7474/db/data/node/2/relationships/all/{-list|&|types}",
>  "property" : "http://localhost:7474/db/data/node/2/properties/{key}";,
>  "self" : "http://localhost:7474/db/data/node/2";,
>  "properties" : "http://localhost:7474/db/data/node/2/properties";,
>  "outgoing_typed_relationships" :
> "http://localhost:7474/db/data/node/2/relationships/out/{-list|&|types}",
>  "incoming_relationships" :
> "http://localhost:7474/db/data/node/2/relationships/in";,
>  "extensions" : {
>  },
>  "create_relationship" :
> "http://localhost:7474/db/data/node/2/relationships";,
>  "paged_traverse" :
> "http://localhost:7474/db/data/node/2/paged/traverse/{returnType}{?pageSize,leaseTime}";,
>  "all_relationships" :
> "http://localhost:7474/db/data/node/2/relationships/all";,
>  "incoming_typed_relationships" :
> "http://localhost:7474/db/data/node/2/relationships/in/{-list|&|types}"
> } ]
> B:\>curl -X POST http://localhost:7474/db/data/index/node/ -H "Content-Type:
> application/json" -d '{"name":"geom", "config":{"provider":"spatial"}}'
> {
>  "message" : "Unexpected character (''' (code 39)): expected a valid value
> (number, String, array, object, 'true', 'false' or 'null')\n at [Source:
> java.io.StringReader@78d10502; line: 1, column: 2]",
>  "exception" : "org.neo4j.server.rest.repr.BadInputException: Unexpected
> character (''' (code 39)): expected a valid value (number, String, array,
> object, 'true', 'false' or 'null')\n at [Source:
> java.io.StringReader@78d10502; line: 1, column: 2]",
>  "stacktrace" : [
> "org.neo4j.server.rest.repr.formats.JsonFormat.readMap(JsonFormat.java:91)",
> "org.neo4j.server.rest.web.RestfulGraphDatabase.jsonCreateNodeIndex(RestfulGraphDatabase.java:594)",
> "sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)",
> "sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)",
> "sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)",
> "java.lang.reflect.Method.invoke(Method.java:597)",
> "com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)",
> "com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)",
>
> "com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)",
> "com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)",
> "com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)",
> "com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)",
> "com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)",
> "com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)",
> "com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)",
> "com.sun.jersey.server.impl.application.WebAp
> plicationImpl._handleRequest(WebApplicationImpl.java:1400)",
> "com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)",
> "com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)",
> "com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)",
> "com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)",
> "com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)",
> "javax.servlet.http.HttpServlet.service(HttpServlet.java:820)",
> "org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)",
> "org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHan
> dler.java:1166)",
> "org.neo4j.server.statistic.StatisticFilter.doFilter(StatisticFilter.java:62)",
> "org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)",
> "org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)",
> "org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)",
> "org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)",
> "org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)",
> "org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)",
> "org.mortbay.jetty.Server.handle(Server.java:326)",
> "org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)",
> "org.mortbay.jetty.HttpConnection$RequestHandler
> .content(HttpConnection.java:943)",
> "org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)",
> "org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)",
> "org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)",
> "org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)",
> "org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)"
> ]
> }curl: (3) [globbing] unmatched close brace/bracket at pos 26
>
> When I switch to the HTTP console in the web administration page:
> http> POST /db/data/index/node/ {"name":"geom",
> "config":{"provider":"spatial"}}
> ==> 201 Created
> ==> {
> ==>   "template" :
> "http://localhost:7474/db/data/index/node/geom/{key}/{value}";,
> ==>   "provider" : "spatial"
> ==> }
>
> Ok at least now I can see the newly created index 'geom' in the indexmanager
> tab. In the HTTP console I don't know how I can send "curl -d
> "layer=geom&lon=lon&lat=lat"
> http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addSimplePointLayer";
> - so I have different tools for different commands :) Well I have never done
> anything with REST or cURL before.
>
> http> POST /db/data/node/0/properties {"lon": 15.2, "lat": 60.1}
> ==> 405 Method Not Allowed
> ==> <html>
> ==> <head>
> ==> <meta http-equiv="Content-Type" content="text/html;
> charset=ISO-8859-1"/>
> ==> <title>Error 405 Method Not Allowed</title>
> ==> </head>
> ==> <body>
> HTTP ERROR 405
>
> ==> <p>Problem accessing /db/data/node/0/properties. Reason:
> ==> <pre>    Method Not Allowed</pre></p><hr />/<small>Powered by
> Jetty://</small>/<br/>
> ==> <br/>
> ==> <br/>
> ==> <br/>
> ==> <br/>
> ==> <br/>
> ==> <br/>
> ==> <br/>
> ==> <br/>
> ==> <br/>
> ==> <br/>
> ==> <br/>
> ==> <br/>
> ==> <br/>
> ==> <br/>
> ==> <br/>
> ==> <br/>
> ==> <br/>
> ==> <br/>
> ==> <br/>
> ==>
> ==> </body>
> ==> </html>
> ==>
> http> GET /db/data/node/0/properties {"lon": 15.2, "lat": 60.1}
> ==> 204 No Content
>
> B:\>curl -d "layer=geom&node=http://localhost:7474/db/data/node/2";
> http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addNodeToLayer
> [ {
>  "outgoing_relationships" :
> "http://localhost:7474/db/data/node/2/relationships/out";,
>  "data" : {
>    "layer_class" : "org.neo4j.gis.spatial.EditableLayerImpl",
>    "layer" : "geom",
>    "geomencoder" : "org.neo4j.gis.spatial.encoders.SimplePointEncoder",
>    "geomencoder_config" : "lon:lat",
>    "ctime" : 1322045456422
>  },
>  "traverse" : "http://localhost:7474/db/data/node/2/traverse/{returnType}";,
>  "all_typed_relationships" :
> "http://localhost:7474/db/data/node/2/relationships/all/{-list|&|types}",
>  "property" : "http://localhost:7474/db/data/node/2/properties/{key}";,
>  "self" : "http://localhost:7474/db/data/node/2";,
>  "properties" : "http://localhost:7474/db/data/node/2/properties";,
>  "outgoing_typed_relationships" :
> "http://localhost:7474/db/data/node/2/relationships/out/{-list|&|types}",
>  "incoming_relationships" :
> "http://localhost:7474/db/data/node/2/relationships/in";,
>  "extensions" : {
>  },
>  "create_relationship" :
> "http://localhost:7474/db/data/node/2/relationships";,
>  "paged_traverse" :
> "http://localhost:7474/db/data/node/2/paged/traverse/{returnType}{?pageSize,leaseTime}";,
>  "all_relationships" :
> "http://localhost:7474/db/data/node/2/relationships/all";,
>  "incoming_typed_relationships" :
> "http://localhost:7474/db/data/node/2/relationships/in/{-list|&|types}"
> } ]
> B:\>curl -d "layer=geom&minx=15.0&maxx=15.3&miny=60.0&maxy=60.2"
> http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/findGeometriesInLayer
> [ ]
> B:\>curl
> http://localhost:7474/db/data/index/node/test/bbox/%5B15.0%2C%2016.0%2C%2056.0%2C%2061.0%5D
> {
>  "exception" : "org.neo4j.graphdb.NotFoundException",
>  "stacktrace" : [
> "org.neo4j.server.rest.web.DatabaseActions.getIndexedNodes(DatabaseActions.java:855)",
> "org.neo4j.server.rest.web.RestfulGraphDatabase.getIndexedNodes(RestfulGraphDatabase.java:786)",
> "sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)",
> "sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)",
> "sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)",
> "java.lang.reflect.Method.invoke(Method.java:597)",
> "com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)",
> "com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:
> 205)",
> "com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)",
> "com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)",
> "com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)",
> "com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)",
> "com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)",
> "com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)",
> "com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)",
> "com.sun.jersey.server.impl.application
> .WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)",
> "com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)",
> "com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)",
> "com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)",
> "com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)",
> "com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)",
> "javax.servlet.http.HttpServlet.service(HttpServlet.java:820)",
> "org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)",
> "org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(Serv
> letHandler.java:1166)",
> "org.neo4j.server.statistic.StatisticFilter.doFilter(StatisticFilter.java:62)",
> "org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)",
> "org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)",
> "org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)",
> "org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)",
> "org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)",
> "org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)",
> "org.mortbay.jetty.Server.handle(Server.java:326)",
> "org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)",
> "org.mortbay.jetty.HttpConnection$RequestH
> andler.headerComplete(HttpConnection.java:926)",
> "org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)",
> "org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)",
> "org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)",
> "org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)",
> "org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)"
> ]
> }
>
> I guess it goes wrong when trying to set lat and lon. When we now consider
> the OSMImporter, will it work with the index 'geom'? How does the
> OSMImporter know which index to use (maybe I have to adapt the code)? I then
> have done a new OSMImport, in C:\neo4j-community-1.5\data\graph.db\index
> there is only a folder for lucene index.
>
> cypher> start n=node:geom('bbox:[10.0020654, 10.0020654, 48.4126496,
> 48.4126496]')
> cypher> return n
> cypher>
> ==> +---+
> ==> | n |
> ==> +---+
> ==> +---+
> ==> 0 rows, 53 ms
>
> Regards, Daniel
>
>
>
>
>
>
> --
> View this message in context: 
> http://neo4j-community-discussions.438527.n3.nabble.com/Neo4j-Spatial-build-run-problems-tp3515519p3530425.html
> Sent from the Neo4j Community Discussions mailing list archive at Nabble.com.
> _______________________________________________
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>
_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to