[OSM-dev] Can I get "distance across dry land" with OpenStreetMap

Mayeul Kauffmann mayeul.kauffmann at free.fr
Wed Jun 15 08:11:48 BST 2011


Depending on your application, an even simpler solution might work.
If you have one single polygon for each land mass, you just need to
check if the id of the departure polygon is the same as that of the
arrival polygon.
To extract islands, polygons with holes etc. from OSM data, you can have
a look at
http://wiki.openstreetmap.org/wiki/Osm2postgresql

(there is an island on the West of the lake on the example of the wiki).

Mayeul

Le mardi 14 juin 2011 à 22:17 +0200, Mayeul Kauffmann a écrit :
> Hi,
> You can do it with open source tools with the gdistance package from R.
> Start with this:
> http://cran.r-project.org/web/packages/gdistance/vignettes/gdistance-vignette.pdf
> 
> (from this page:
> http://cran.r-project.org/web/packages/gdistance/index.html
> )
> 
> 
> You can use the QGIS ManageR plugin to import easily geo data into R.
> I would do it this way: Take the OSM coastline (you need a polygon).
> Rasterize it (0=ocean, 1=earth). Import this into R (use the raster
> package). Define a full conductivity for earth and zero conductivity for
> water. The rest is straightforward (cf. gdistance-vignette.pdf pp.
> 12-15).
> 
> There is a full example for a very similar application (here, the cost
> is related to sloppy terrain, not water; water is simpler as it is
> binary).
> You can use R alone or with QGIS.
> I suggest you read the first 10  pages of one of the "Documents with
> fewer than 100 pages" at http://cran.r-project.org/other-docs.html
> It should be enough to understand the gdistance-vignette.pdf
> 
> Hope this helps,
> Mayeul
> 
> Le mardi 14 juin 2011 à 21:13 +0200, Iván Sánchez Ortega a écrit :
> > On Martes 14 Junio 2011 17:52:08 Ævar Arnfjörð Bjarmason escribió:
> > > The routing libraries I've found seem to all assume that I want to
> > > route across roads, whereas for this task all I need is just a
> > > coastline shapfile of the planet. I'd then find out if A and B are on
> > > different coastlines, or the shortest path between them on land.
> > > 
> > > Is there anything that does this already?
> > 
> > The thing you want is called a "navigation mesh". You might want to search for 
> > libraries to make and transverse them.
> > 
> > Do read:
> > 
> > http://theory.stanford.edu/~amitp/GameProgramming/MapRepresentations.html
> > 
> > 
> > Cheers,
> 
> 
> 
> _______________________________________________
> dev mailing list
> dev at openstreetmap.org
> http://lists.openstreetmap.org/listinfo/dev





More information about the dev mailing list