Hi Markus and All.
Thank you for your help. I've successed to parse OSM data from XML and run
car router from Traveling SalesMan package.

Now I'm trying to optimize my service, reduce memory usage (load to
MemoryDataSet "car" roads from country data (200 Mb in XML) cost me around 1
GB of memory usage) and processing time.

I've met some difficulties to "load" data into H2DataSet from Traveling
Salesman io class.
Well, preliminary I've imported it from XML OSM file using OSMOSIS with
OSMLIB plugin and  --write-osmbin-0.6 option to local directory, There are
the following files within dir C:\temp\osm_export:
attrnames.txt
nodes.id2
nodes.idx
nodes.obm
osmbin.properties
relations.idx
relations.obm
ways.idx
ways.obm

But, when I'm trying from JAVA the following code:

File dbDir = *new* File("C:\\temp\\osm_export");

IDataSet dataSet = *new* H2DataSet(dbDir);

NearestStreetSelector ns = *new* NearestStreetSelector();

LatLon startCoord = *new* LatLon(55.509440, 9.436242);

StartNode = dataSet.getNearestNode(startCoord, ns)

on the last statement I'm getting TS and JDBC exception like:

SEVERE: Cannot get NearestNode
*

org.openstreetmap.osmosis.core.OsmosisRuntimeException*: Unable to establish
a database connection to 'jdbc:h2:C:\temp\osm_export'.

Caused by: *org.h2.jdbc.JdbcSQLException*: Unsupported database file version
or invalid file header in file "C:\temp\osm_export.h2.db" [90048-126]

Does anybody got the same? Probably my JBBC version is not perfect enough?
Which file JDBC/Travelling SalesMan is looking for?

Unfortunatelly H2DataSet is not documented well (link from WIKI to JAVA
documentation is broken). Code examples are missed as well.



2010/6/20 Marcus Wolschon <[email protected]>

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Am 20.06.2010 21:21, schrieb Oleg Demchenko:
>
> >
> > Afterwards GEOTools and OSM developers advised me to use OSM
> > format files, because they already contains nodes, ways, relations,
> > etc. I've load   country highway DB to PostgreSQL using OSMOSIS API
> > v1.6
> >
> > Could you advice, please,  me how to build well connected graph
> > and/or find a route on reliable basis? One of the options I've
> > found is Traveling Salesman with Route class. It is possible to
> > load OSM file from  disk. But how to build a graph afterwards and
> > how mySelector below should be implemented?
> >
> > /FileLoader fl = new FileLoader(new
> > File("C:\\Install\\denmark.osm.highway")); MemoryDataSet map =
> > fl.parseOsm(); /
>
> Import your MemoryDataSet into some database-backed DataSet
> (H2 or implement something yourself for PostGIS) unless you have LOTS
> of memory.
> The current version of H2 sadly has a known but in the geospatial
> indexing that
> shows up for negative lat+lons. The fix is in SVN but not tested yet.
>
Marcus
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwebX8ACgkQf1hPnk3Z0cTpWgCeOqBk2x4yWF88LMjc5vVd0iXP
qtAAn2rpR1l7wE/B7DpSmxFKQ/P70a2k
=TyEN
-----END PGP SIGNATURE-----


> _______________________________________________
> Routing mailing list
> [email protected]
> http://lists.openstreetmap.org/listinfo/routing
>
>


-- 
All the best
              Oleg Demchenko
_______________________________________________
Routing mailing list
[email protected]
http://lists.openstreetmap.org/listinfo/routing

Reply via email to