dwins / mapnik2geotools

Using the Scala XML API to translate from Mapnik XML to GeoTools' SLD dialect
64 stars 22 forks source link

Error running converter with GeoServer REST URL and datadir #39

Open hhundal opened 10 years ago

hhundal commented 10 years ago

NOTE: I have posted this query to the Google group mailing list for this GitHub project as well. Apologies for the dual post, but wasn't sure which place was more appropriate.

Anyway, I am trying to re-use the style-sheets from my local installation of OSM/Mapnik within my GeoServer installation (which uses the same OSM PostGIS datasource as my Mapnik installation).

I seem to have successfully completed the first couple of steps as documented on the mapnik2geotools github page. I have been able to install sbt, and generate sld files from my mapnik osm.xml file to a local disk directory using the Mapnik to GeoServer Importer GUI. 81 sld files were generated in all. It also generated a sql file, which I have successfully run against my OpenStreetMap PostGIS database. 86 additional tables were created in the database. (NOTE: I did have to edit my mapnik xml file to change the "minimum-version" tag from 2.0.0 to 0.7.0 to get rid of the error message that required the major version to be 0. I also had to update "TextSymbolizers.scala" in the source to change "fontset_name" to "fontset-name" in a few places for things to work).

However, I am now stuck at the final step to run the converter with a GeoServer REST URL and datadir (after the tables and views are in place). I use "sudo sbt" to start sbt, and then at the sbt prompt I am using:

run-main me.winslow.d.mn2gt.Driver /etc/mapnik-osm-data/osm.xml --rest=http://localhost:8080/geoserver/rest --datadir=/var/lib/tomcat7/webapps/geoserver/data/

However, I am getting the following error:

[error] java.lang.UnsupportedOperationException: empty.tail [error] at scala.collection.TraversableLike$class.tail(TraversableLike.scala:395) [error] at scala.collection.immutable.StringOps.scala$collection$IndexedSeqOptimized$$super$tail(StringOps.scala:31) [error] at scala.collection.IndexedSeqOptimized$class.tail(IndexedSeqOptimized.scala:124) [error] at scala.collection.immutable.StringOps.tail(StringOps.scala:31) [error] at me.winslow.d.mn2gt.Driver$.parseOpts(CommandLine.scala:17) [error] at me.winslow.d.mn2gt.Driver$.parseOpts(CommandLine.scala:26) [error] at me.winslow.d.mn2gt.Driver$.main(CommandLine.scala:58) [error] at me.winslow.d.mn2gt.Driver.main(CommandLine.scala) [error] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [error] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [error] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [error] at java.lang.reflect.Method.invoke(Unknown Source) [error] at scala.tools.nsc.util.ScalaClassLoader$$anonfun$run$1.apply(ScalaClassLoader.scala:78) [error] at scala.tools.nsc.util.ScalaClassLoader$class.asContext(ScalaClassLoader.scala:24) [error] at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.asContext(ScalaClassLoader.scala:88) [error] at scala.tools.nsc.util.ScalaClassLoader$class.run(ScalaClassLoader.scala:78) [error] at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.run(ScalaClassLoader.scala:101) [error] at scala.tools.nsc.ObjectRunner$.run(ObjectRunner.scala:33) [error] at scala.tools.nsc.ObjectRunner$.runAndCatch(ObjectRunner.scala:40) [error] at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:56) [error] at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:80) [error] at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:89) [error] at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala) java.lang.RuntimeException: Nonzero exit code returned from runner: 1 at scala.sys.package$.error(package.scala:27) [error] {file:/home/hhundal/Downloads/mapnik2geotools-master/}default-dcdc12/compile:run-main: Nonzero exit code returned from runner: 1 [error] Total time: 1 s, completed Jan 31, 2014 2:28:25 PM

From the error message it seems that the error is happening in parseOpts() in CommandLine.scala, line:26. It seems that its complaining about the syntax of the command line parameters, however, I do not see what is wrong with my command line call.

Can anyone please shed some light on what may be going wrong here? By the way, my platform is Ubuntu 12.04.

As an aside, is it possible to use the sld files that were successfully created in my previous step directly within Geoserver (if I can't get rid of the error message above). If so, how? I currently have 4 layers from my PostGIS datasource (planet_osm_line, planet_osm_point, planet_osm_polygon, planet_osm_roads). I am not sure how to link the styles from all these sld files generated from mapnik with these layers. My goal is just to be able to get street maps from GeoServer to display reasonably similar to OpenStreetMaps. Additionally, my mapnik folder also has a "symbols" folder with a large number of .png image icons for various map features - will these also be transferred to GeoServer datadir automatically by the final step described for mapnik2geotools (the one thats still giving me errors)?

Thanks, Harv Hundal

jheminghous commented 10 years ago

Here are the steps I had to take to get the OSM properly rendered by GeoServer on RedHat 6.5. This assumes you have already imported your data into a postgres database name osm using osm2pgsql, have a postgres user geoserver (password geoserver) that can connect to that database, and the stand alone version of geoserver is located at ./geoserver-2.5.2.

svn co http://svn.openstreetmap.org/applications/rendering/mapnik/ cd mapnik sudo ln -s /usr/bin/bunzip2 /bin/bunzip2 ./get-coastlines.sh cp -r world_boundaries ../geoserver-2.5.2/data_dir/data python generate_xml.py --dbname osm --host localhost --port 5432 --user geoserver --password geoserver --accept-none vim osm.xml

wget https://dl.bintray.com/sbt/rpm/sbt-0.13.6.rpm sudo rpm -ivh sbt-0.13.6.rpm git clone https://github.com/dwins/mapnik2geotools.git cd mapnik2geotools vim src/main/scala/me/winslow/d/mn2gt/TextSymbolizers.scala