[OSM-dev] Find a shortest path with OSMOSIS API (Traveling Salesman)

Oleg Demchenko oleg.demchenko at gmail.com
Sun Jun 20 19:57:56 BST 2010


Hi Frederik.
It was an idea to use osm2pgrouting, bus as I know this plugin is for Linux
server.
My client is running on a windows server. :-(

Back to Traveling Salesman. Well I've read osm file to dataset.What should
be a next step? Build a graph or map from a dataset? I have no clue what is
*osmData* mentioned in Traveling Salesman example.

* FileLoader fl = new FileLoader(new
File("C:\\Install\\denmark.osm.highway"));*
* MemoryDataSet map = fl.parseOsm();*
* 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);*
 ...


2010/6/20 Frederik Ramm <frederik at remote.org>
>
> Oleg,
>
> Oleg Demchenko wrote:
>>
>> Later on I was advised I did a wrong job, and I should import OSM format
file to PostgreSQL. It contains ways, nodes and relations between them and
it is possible to build a graph directly from OSMOSIS file (database).
>
> It is correct that you should use the OSM format directly. Whether you
want to load that into PostgreSQL or not is another question, you could also
load it into memory or process it into a proper routing graph right away.
>
>> Question is how is build graph in Java and find way between nodes and it
details? My understanding is Traveling Salesman with Route class should help
me
http://sourceforge.net/apps/mediawiki/travelingsales/index.php?title=TS/Examples
>
> Yes but as far as I know Traveling Salesman does not use the Osmosis
schema, it loads .osm files directly.
>
> If you want something out-of-the-box, you can use osm2pgrouting and try
the PostgreSQL "pgrouting" extension on that but it will not be very fast.
>
> There is also a specialist mailing list called "routing" on the OSM server
where people talk about these things.

Thank you for a good idea.  I will try to get an advise from this list.
>
> Bye
> Frederik
>
> --
> Frederik Ramm  ##  eMail frederik at remote.org  ##  N49°00'09" E008°23'33"



--
All the best
              Oleg Demchenko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20100620/d79e55cb/attachment.html>


More information about the dev mailing list