[Routing] How to load OsmBinDataSet dataset to memory and reuse it during next sessions

Oleg Demchenko oleg.demchenko at gmail.com
Fri Aug 27 18:50:04 BST 2010


Dear all.

I've imported country OSM file to OSM Binary format and more or less
successfully finding a route using travelingsalesman class and osmbin as
dataset.
Performance is much faster than with XML (OSM file), but there are still
some points for improvement.
Well, each time when program call method like .getNearestNode(), I'm getting
exception (warning)

*org.openstreetmap.osm.data.osmbin.FixedRecordFile <init> INFO:
Memory-maping the file failed in org.openstreetmap.osm.data.osmbin.IDIndex
File - using conventional io instead*

and my process reads data from a disk.

My code is:
...
import org.openstreetmap.osm.data.coordinates.LatLon;
import org.openstreetmap.osm.data.osmbin.v1_0.OsmBinDataSetV10;
import java.io.File;
...
       File dbDir = new File("C:\\temp\\osm_binaries");
       OsmBinDataSetV10 map = new OsmBinDataSetV10(dbDir);
...
     LatLon startCoord = new LatLon(TESTSTARTLAT, TESTSTARTLON);
     Node StartNode=null;
     StartNode = map.getNearestNode(startCoord, new Motorcar());
During each program call I need to find several routes (f.e. between points
A and B and between C and D). Class is running as webservice under tomcat
6.0, 64 bit
Questions are:
1) How to load OsmBinDataSet into memory within 1 thread (process) and use
it from a different OsmBinDataSetV10 methods?
2) Does it possible to put loaded to memory iDataSet object to some TomCat
container and use it during  next  webmethod calls? Under IIS/.NET this
could be done with Application object. Sorry, I'm not very experienced with
TomCat threads yet. :-)

Thank you in advance. Probably my library is old, and I need to download
last stable org.openstreetmap.osm.data binaries/sources from  SVN?






-- 
All the best
               Oleg Demchenko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/routing/attachments/20100827/1bcb3354/attachment.html>


More information about the Routing mailing list