OSM-Extract - Getting it Working!?

Hi all,

I’ve only recently discovered OpenStreetMap, and am very impressed with what’s been done so far. I’m trying cut a small section from planet.osm - sadly it’s an area bigger than can be exported from the web interface, and not an area that someone has already published as a specific export, so i’m trying to use OSM-Export from the SVN site. But i’m having issues and hope someone can help.

I should start by pointing out that i’ve never used Perl before, and it’s been many years since I last used C - however general programming concepts are fine as I regularly use VB, Matlab and PHP.

I’ve tried both the Perl and C versions of OSM-Extract (planetosm-excerpt-area.pl and extract-polygon-c) and have run into issues with both, all related to (I believe) their dependencies. I’m working from a fresh install of Visual Studio 2008 (for C) and also a fresh install of Active Perl (for the Perl stuff), all on Windows XP, so don’t have many of the libraries that they both seem to expect. For the Perl script i’ve found the first missing library (planet.pm from perl_lib/geo/osm), but then it has another dependency that I can’t find (File/Slurp). Similarly for the C version i’m missing libxml, which i’m not sure what i’m looking for (it’s an unfortunately common name for a library).

So my question is, is there an easy source to download all the necessary libraries required to compile / run these scripts? Ideally the C version as the readme suggests that can work on the .bz file directly, rather than needing to extract it first (which would be very helpful as i’m a bit short on space). Or is there a pre-compiled version that will work on Windows I can download from somewhere or that someone can send me?

Many thanks in advance for any help or guidance.

David

Have you tried Osmxapi? It supports larger areas. Otherwise download Java and use Osmosis. It’s the best tool to make extracts, I would go so long as to say it’s the only real contender.

Have you tried ‘osmosis’ too? It’s a java-based application, but it has good functionality to cut a piece of the planet file into an extract of your choice. It supports bbox and polygon based area selection, too. You need a fairly recent version to fully support API 0.6 based planet files.

@emj: Is xapi already returning current API 0.6 data?

Ldp: not according to the Platform Status page on the wiki.

Yes but xapi is the way to go if you want to use something that will probably work later on…

Thanks guys!

I’ve got Osmosis working on one of my PCs, but it falls over on the other - which is rather unfortunate as the one it doesn’t work on is the only one with enough disk space to extract planet.osm to. I can run it on the other one, but have to use the zipped planet file as the source which is much slower.

I suspect it’s just a java configuration problem - that’s the only thing I can think that’s different between the two. Both are installed in the same folder, both running the same command, both the exact same version of Osmosis. Just been reading some stuff that suggests the java environment variables are probably setup wrong (my error is Exception in thread “main” java.lang.NoClassDefFoundError: and).

Unfortunately I won’t have access to that computer until Tuesday, so i’ll have to wait 'til then to try!

Anyway, Osmosis was a great suggestion and I have got some of the extracts I want now - will just have to leave it running a little longer than i’d like :slight_smile:

David

Are you working with the bzip2 version of the planet file?

Java-based bzip2 functionality is notoriously slow, and you’d be better off doing something like ‘bzcat planet.bz2 | osmosis --rx -’

Hello everyone,

I’m trying to use the currently last version of Osmosis, that is 0.31.2, download in http://cloudmade-osmosis.s3.amazonaws.com/0.31.2 (osmosis-0.31.2-bin.zip) .

I’m having the same problem that Scuby had on your last post. (Exception in thread “main” java.lang.NoClassDefFoundError: and)

The entire error is:

Exception in thread “main” java.lang.NoClassDefFoundError: and
Caused by: java.lang.ClassNotFoundException: and
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Could not find the main class: and. Program will exit.

I’ve already uncompressed the .bz2 file.

Anyone knows what’s going on? Someone could help me?

Regards

Dear Respective Users of this great service!
I found a good opportunity how to use unzipped planet.osm on windows machines readwrite. For those of you who cant allocate 200+ Gb space, do following:

  1. Install Pismo File Mount http://www.pismotechnic.com/;
  2. Create and mount blank folder with compression (for example, “planet.pfo”;
  3. By Using 7Zip or Winrar unpack planet.osm to this folder;
  4. After 5-6 hours you will get entire planet unzipped but hdd usage is same as packed one.

Hope to hear many thanks from you for those lines!

As a thanks i need following: Please give me (but for others as well) a good and detailed notes on how to make osmosis run on windows XP or 7, and detailed tips how to extract bounding box or poly area.
The problem is that osmosis nearly unable to run on windows. They (developers) did nothing to make it run on windows without editing scripts!!! If disagree look at JOSM = same java but runs as a charm. But I need real tool to extract few cities! Waiting for manual.

Thanks in advance! Cheers!

By the way, an extremely valuable thing for everybody on those forums http://forum.openstreetmap.org/viewtopic.php?id=4039:

  1. Portable osmosis configured to run on windows environment.
    This gives give to world opportunity to split large osms to their necessary cities!

Cheers, Fedir

Greetings again to everyone!
No Linux needed. I managed to run osmosis on windows machine (http://forum.openstreetmap.org/viewtopic.php?id=4039). It works directly with compressed planet! And writes to compressed planet. My pc is good enough (2,5 Gb ram) but calculations already lasting 2 days!!! Too bad performance!! Has enyone an idea how to accelerate? So hope one day it will finish writing osm extract that i need. Now who knows exactly how to push extracted data to mysql or postgresql and where to find localhost server to run?
I just need few cities! I want them afterwards to convert to mp or img to be able to open with communicator.
F

So, according to recent calculations it takes 20-48 hours on average pc to extract certain area from entire planet on windows machines. Nevertheless osmosis is a great tool that it can process 207 gb file. Next question is how to convert those extracts to mp files? Perl scripts are bit complicated to me to install.