[OSM-dev] Can I get "distance across dry land" with OpenStreetMap
Mayeul Kauffmann
mayeul.kauffmann at free.fr
Tue Jun 14 21:17:56 BST 2011
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,
More information about the dev
mailing list