How to split the plannet

Hi All,

I am trying to split the OSM of the entire planet into small tiles suitable for generating Garmin maps.

What is the quickest and easiest way to do this?

I read that splitter can’t handle the job unless you have a 64 bit machines with tons of memory. So my plan was to use osmosis to split the planet in smaller chunks that can be handled by splitter. So far I haven’t been able to run osmosis without getting a java exception. I tried to get familiar with osmosis by using a smaller test file and I always get java exceptions. These exceptions have nothing to do with the size of the input file or missing classes. They just seemed to be bugs to me. Does osmosis require a specific java version or other requirement?

Thanks
Jesus

I don’t think osmosis is bugged up to the point of not working at all.
You should post more precisions, like what you are trying, and of course what exception you get. It might ring a bell to someone.

Osmosis has a tendency to throw lots of java exception stuff in your face, if you even make the tiniest mistake in the arguments. Somewhere within the dozens of lines, there usually is a hint of what went wrong according to osmosis. Although sometimes you might not recognize it, unless you’ve seen a lot of this osmosis output.

Care to post the osmosis cmd line arguments and the output you get?

Hi All,

Below is the command line I am executing together with the exceptions it is throwing. In case someone wants to try to reproduce the problem, the input OSM file in.osm can be generated with the following command:

groundtruth getdata -bu “http://www.openstreetmap.org/?lat=37.7509&lon=-121.945&zoom=12&layers=B000FTFT

Thanks
Jesus

$ java -cp “U:\gps\software\osmosis\osmosis.jar;U:\gps\software\osmosis\lib\default\bzip2-20090327.jar;U:\gps\software\osmosis\lib\default\commons-logging-1.0.4.jar;U:\gps\software\osmosis\lib\default\jpf-1.5.jar;U:\gps\software\osmosis\lib\default\mysql-connector-java-5.1.6.jar;U:\gps\software\osmosis\lib\default\postgis-1.3.2.jar;U:\gps\software\osmosis\lib\default\postgresql-8.3-603.jdbc4.jar;U:\gps\software\osmosis\lib\default\stax2-api-3.0.1.jar;U:\gps\software\osmosis\lib\default\woodstox-core-lgpl-4.0.3.jar” org.openstreetmap.osmosis.core.Osmosis --read-xml enableDateParsing=no file=in.osm --bounding-box top=37.75521 left=-121.95669 bottom=37.73016 right=-121.91901 --write-xml file=out.osm
Nov 17, 2009 12:47:32 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Osmosis Version 0.31
Nov 17, 2009 12:47:32 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Preparing pipeline.
Nov 17, 2009 12:47:33 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Launching pipeline execution.
Nov 17, 2009 12:47:33 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Pipeline executing, waiting for completion.
Nov 17, 2009 12:47:34 PM org.openstreetmap.osmosis.core.pipeline.common.ActiveTaskManager waitForCompletion
SEVERE: Thread for task 1-read-xml failed
java.lang.NullPointerException
at org.openstreetmap.osmosis.core.xml.common.ElementWriter.escapeData(ElementWriter.java:112)
at org.openstreetmap.osmosis.core.xml.common.ElementWriter.addAttribute(ElementWriter.java:197)
at org.openstreetmap.osmosis.core.xml.v0_6.impl.RelationMemberWriter.processRelationMember(RelationMemberWriter.java:43)
at org.openstreetmap.osmosis.core.xml.v0_6.impl.RelationWriter.process(RelationWriter.java:75)
at org.openstreetmap.osmosis.core.xml.v0_6.impl.OsmWriter$SubElementWriter.process(OsmWriter.java:165)
at org.openstreetmap.osmosis.core.container.v0_6.RelationContainer.process(RelationContainer.java:60)
at org.openstreetmap.osmosis.core.xml.v0_6.impl.OsmWriter.process(OsmWriter.java:82)
at org.openstreetmap.osmosis.core.xml.v0_6.XmlWriter.process(XmlWriter.java:49)
at org.openstreetmap.osmosis.core.filter.v0_6.AreaFilter.emitFilteredRelation(AreaFilter.java:295)
at org.openstreetmap.osmosis.core.filter.v0_6.AreaFilter.process(AreaFilter.java:244)
at org.openstreetmap.osmosis.core.container.v0_6.RelationContainer.process(RelationContainer.java:60)
at org.openstreetmap.osmosis.core.filter.v0_6.AreaFilter.process(AreaFilter.java:96)
at org.openstreetmap.osmosis.core.xml.v0_6.impl.RelationElementProcessor.end(RelationElementProcessor.java:108)
at org.openstreetmap.osmosis.core.xml.v0_6.impl.OsmHandler.endElement(OsmHandler.java:108)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.openstreetmap.osmosis.core.xml.v0_6.XmlReader.run(XmlReader.java:108)
at java.lang.Thread.run(Unknown Source)
Nov 17, 2009 12:47:34 PM org.openstreetmap.osmosis.core.Osmosis main
SEVERE: Execution aborted.
org.openstreetmap.osmosis.core.OsmosisRuntimeException: One or more tasks failed.
at org.openstreetmap.osmosis.core.pipeline.common.Pipeline.waitForCompletion(Pipeline.java:146)
at org.openstreetmap.osmosis.core.Osmosis.run(Osmosis.java:85)
at org.openstreetmap.osmosis.core.Osmosis.main(Osmosis.java:30)

No no, you need Splitter to split the planet suitable for Garmin maps. Latest splitter versions can handle the whole planet in about 3 GB RAM if you set the max-files parameter to about 100 (and use the cache parameter). Alternatively you can split the planet in half with Osmosis first and then split those halves further with Splitter. This is how it’s done currently on http://garmin.na1400.info/routable.php

Below is a copy of a mail from Chris Miller (who’s done a lot on Splitter):

Hi Lambertus,

Thanks for the useful information on splitter. My plan was in fact to first split the planet with osmosis as you suggested, then run splittler. The small area in my previous post was just for testing purposes while I learned how to use osmosis. As you can see, I haven’t been successful at getting osmosis to work.

Thanks
Jesus

I think you should be using the osmosis.cmd in the osmosis directory. That script calls osmosis properly.

I did use the osmosis script. The command line I posted is the command that the script builds. I posted the resulting command for lack of clarity as to how exactly is osmosis being executed.

Ok, can you try again with a Cloudmade planet extract for the same area? Because a closer look at the error it seems there is a problem with unescaped characters in the XML, but I’m not sure at this point.