Frederik is right. The big question is: do you need _all_ OSM information of the chosen area? If not, the processing time will decrease a lot - regardless of extracting the 5 x 5 km box from a file or from a database.
Database: You could store only that information you need. If necessary, create a second database for this purpose. I'm not an expert in databases but certainly others will have ideas to improve performance in this case. File: Prepare your file by deleting every OSM object and every tag you do not need. Meanwhile I did some tests - I was curious... I chose a 5 x 5 km area with a lot of data in it: city of Bielefeld. Then I ran some commands on my (weak) computer: $ time osmosis/bin/osmosis --read-pbf file="germany.osm.pbf" --bounding-box left=8.5 bottom=52 right=8.575 top=52.045 cascadingRelations --write-xml file="5x5o.osm" real 6m3.796s user 6m19.484s sys 0m6.788s $ time osmconvert germany.osm.pbf -b=8.5,52,8.575,52.045 >5x5.osm real 2m16.491s user 1m59.091s sys 0m2.868s $ osmconvert germany.osm.pbf --out-o5m >germany.o5m $ time ./osmconvert germany.o5m -b=8.5,52,8.575,52.045 >5x5a.osm real 1m43.370s user 1m22.617s sys 0m3.924s Conclusion: If you decide to extract this 5 x 5 km area form a file, it is better _not_ to take Osmosis and _not_ to use .pbf format. It seems, osmconvert is much faster, especially if you have converted your data into .o5m format. Something else: The file Osmosis has generated seems to be incomplete. E.g, there is a relation 445596 but its parent relation 63226 is missing. http://www.openstreetmap.org/browse/relation/445596 http://www.openstreetmap.org/browse/relation/63226 Did I do something wrong with the option "cascadingRelations"? Can anybody help, please...? Markus -------- Original-Nachricht -------- > Datum: Wed, 01 Jun 2011 19:10:01 +0200 > Von: Benjamin Meier <[email protected]> > An: [email protected] > Betreff: Re: [OSM-dev] Fastest way to extract a bounding box > Hi, you're of course not bothering me :-) > > I didn't expect that the difference is so much depending on those things. > > I don't need relations especially if they dramatically slow down the > process. > > Ways with nodes inside and outside of the bbox shall be included but if > it's faster and/or possible the ways may end at the bbox-border. > > As a rough rule of thumb I can say that I would prefer the fastest way > possible. > > Benjamin > > Am 01.06.2011 18:36, schrieb [email protected]: > >> What I would like to know is if there's a significantly faster way to > do > >> that. > > "That depends..." ;-) > > > > Which option do you need? Do you need relations? Do you need relations > which have relations as members which have ways which have nodes inside the > box? > > > > Example: There is a bus line which crosses the bbox. This and other bus > lines have the same operator which is represented by a relations. Do you > need this information? Do you need the bus line? > > > > What is to be done with ways which have some nodes inside the bbox and > some nodes outside of it? Shall these ways be included? Or excluded? If > included, what to do with the nodes? What do do with the noderefs, if some of > the nodes are not included because they are outside the bbox? > > > > Sorry to bother you with these Questions... but there are a lot of ways > to extract a bounding box, and the time you need depends on the option you > want use. > > > > Markus > > > > -------- Original-Nachricht -------- > >> Datum: Wed, 01 Jun 2011 18:22:12 +0200 > >> Von: Benjamin Meier<[email protected]> > >> An: [email protected] > >> Betreff: [OSM-dev] Fastest way to extract a bounding box > >> Hi, > >> > >> I'm looking for the fastest way to extract a bounding box from > osm-data. > >> The intention is to get a section (a square of about 5km * 5km) > >> around a user's current position in a few seconds. > >> > >> The input-data shall be of the size "germany", "central-europe" or even > >> the whole planet. > >> > >> Up to now I made some experiments with unsatisfying results. > >> > >> I extracted such a bounding-box from "germany.osm.pbf" with osmosis in > >> about > >> 110 seconds. After that I installed a Postgis/Postgresql-DB, filled it > >> with the > >> pbf-file (as described in the wiki: > >> http://wiki.openstreetmap.org/wiki/Osmosis_PostGIS_Setup) > >> and extracted the bounding-box with osmosis from the DB in about 53 > >> seconds. > >> > >> The hardware is a core2duo e7400 with 2GB RAM. > >> > >> What I would like to know is if there's a significantly faster way to > do > >> that. > >> > >> Thanks, > >> Benjamin > >> > >> _______________________________________________ > >> dev mailing list > >> [email protected] > >> http://lists.openstreetmap.org/listinfo/dev > > _______________________________________________ > > dev mailing list > > [email protected] > > http://lists.openstreetmap.org/listinfo/dev > > _______________________________________________ > dev mailing list > [email protected] > http://lists.openstreetmap.org/listinfo/dev _______________________________________________ dev mailing list [email protected] http://lists.openstreetmap.org/listinfo/dev

