geoserver-shell
geoserver-shell copied to clipboard
Question: How to publish new layer for type "neo4j"
I was wondering if it is possible to create a new layer for a neo4j datastore. By now I am able to create the workspace and the datastore for neo4j (and I am also able to activate it)... but when it comes to layer creation I still need the webgui.
There I can easily click "create new layer" select my "Neo4J datastore" and publish my datafile (which looks something like "/opt/ibk-20131101.osm"). After that I can give the published layer a name, select the EPSG:4326 as reference system and activate the layer with line style.
How would I do that with geoserver-shell?
I plan on updating the docs this weekend, but you will need to
- Create datastore
datastore create --workspace topp --name h2test --connectionParams "dbtype=h2 database=test.db"
- Publish a featuretype
featuretype publish --workspace postgis --datastore tables --featuretype table
I hope this helps!
This seems to work for postgis, but not for neo4j I always get a "false" as result
Is there any log (or something similar) where I can get some more details?
Sorry, if you are getting false it means something is not working correctly. I just added some verbose logging to the feature type commands. Turn verbose logging on
geoserver verbose set --value true
and then give it a try. I don't have Neo4J set up and have never used it before (but it looks pretty cool) so it's hard to debug. I would suggest using curl form the command line using the correct url and xml doc
http://docs.geoserver.org/stable/en/user/rest/api/featuretypes.html
and then looking at the raw response and maybe looking at the geoserver logs. I really appreciate your help and persistence.
Thanks to the verbose mode my understanding of geoserver's rest interface is a bit better now :+1:
However, I still can not create the layer I want to create. My call looks like this:
featuretype publish --workspace isochrone --datastore Neo4J --featuretype /opt/innsbruck-131101-filtered.osm
My response looks like this
URL: http://localhost:8080/geoserver/rest/workspaces/isochrone/datastores/Neo4J/featuretypes.xml
Data: <featureType><name>/opt/innsbruck-131101-filtered.osm</name></featureType>
Response: null
As I got interested in the xml format I also tried to create the layer I want in the geoserver's webinterface and to see what happened. After creating the layer I can do the following:
featuretype list --workspace isochrone --datastore Neo4J
The reponse for this command is:
URL: http://localhost:8080/geoserver/rest/workspaces/isochrone/datastores/Neo4J/featuretypes.xml?list=configured
Response: <featureTypes>
<featureType>
<name>/opt/innsbruck-131101-filtered.osm</name>
<atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://localhost:8080/geoserver/rest/workspaces/isochrone/datastores/Neo4J/featuretypes/%2Fopt%2Finnsbruck-131101-filtered.osm.xml" type="application/xml"/>
</featureType>
<featureType>
<name>ibk_neo4j</name>
<atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://localhost:8080/geoserver/rest/workspaces/isochrone/datastores/Neo4J/featuretypes/ibk_neo4j.xml" type="application/xml"/>
</featureType>
</featureTypes>
/opt/innsbruck-131101-filtered.osm
ibk_neo4j
Interesting is that the following command leads to a NullPointerException (not sure why):
featuretype get --workspace isochrone --datastore Neo4J --featuretype ibk_neo4j
I fixed the NullPointerException when using "featuretype get" (see my pull request #5), but I am still not sure where the problem is...
...when creating the featuretype the geoserver's log contains a "schema creation not supported" so I guess my specified schema is not correct... ...when using "featuretype publish" without the create before I get a file not found (which I guess is related to the name of the featuretype "/opt/innsbruck-131101-filtered.osm" and that it contains slashes)