-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Am 20.06.2010 21:21, schrieb Oleg Demchenko:
> For bigger distance and bigger number of lines it do not connect
> them all properly while building a graph and
> DijsktraShortestPathFinder can't find a path.
Be careful with Dijkstra and turn-restrictions.
>
> 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.
> / LatLon startCoord = new LatLon(12.180064, 55.470843); Node
> startNode = NodeHelper.findNearestNode(osmData, startCoord);
>
> LatLon targetCoord = new LatLon(12.198208, 55.516831); Node
> targetNode = NodeHelper.findNearestNode(osmData, targetCoord);
>
> TurnRestrictedMultiTargetDijkstraRouter router = new
> TurnRestrictedMultiTargetDijkstraRouter(); Route theRoute =
> router.route(map, targetNode, startNode, mySelector);/ ...
>
You can use the SimpleCarSelector. It selects all roads that a usual car
can drive on.
(I don“t think you want walking people or bicycles or something
special. ;) )
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