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

2010-06-20 Thread Oleg Demchenko
Hi Dear All.

I'm quite new in OSM area and hope somebody of you will point me a proper
direction.

I'm developing a server side Java method  which should estimate shortest
vehicle path between any 2 points placed within 1 country.

On the first stage I've downloaded country shape file from CloudsMade,
import it into PostgreSQL database, load it into GEOTolls graph converting
features into LineString and intersect them each other afterwards.
DijsktraShortestPathFinder from GeoTools was not efficient enough. It was
good to calculate path up to 10 000 Lines loaded, but for more lines
(longest distance) it was not able to get a path between nodes. Moreover for
the all country lines loaded (around 1 mln) graph wasn't able connect any
nodes each other.

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).

Well I've loaded denmark.osm.highway.bz2 to my PostgreSQL db with OSMOSIS
API 6.0 configured in advance. Now I have ways, nodes, relation and other
table filled with data.

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

Question is how to load data within Java application to TS dataset? From
dataset types
http://sourceforge.net/apps/mediawiki/travelingsales/index.php?title=ExtensionPoints/IDataSet
I
can't find any to load from PostfreSQL?
Any ideas? Or I should load OSM file from a local file system somehow?
Please,  advise.

Or I don't need Traveling Salesman library to find a shortest path with
OSMOSIS data?


-- 
All the best
  Oleg Demchenko
___
dev mailing list
dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/dev


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

2010-06-20 Thread Oleg Demchenko
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 frede...@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 frede...@remote.org  ##  N49°00'09 E008°23'33



--
All the best
  Oleg Demchenko
___
dev mailing list
dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/dev