[R-sig-Geo] GRASS with R and distances between polygon edges
Roger Bivand
Roger.Bivand at nhh.no
Mon Oct 30 21:45:53 CET 2006
On Mon, 30 Oct 2006, Duncan Golicher wrote:
> I have a follow up question regarding moving old (R <2.4) sp objects to
> R 2.4. It is indeed easy using GRASS as an intermediary with spgrass6.
> But one of my students has installed GRASS with the QGIS interface
> rather than running GRASS under Cygwin. He wanted to do the same.
>
> I tried with him and quickly got R to communicate with GRASS by simply
> changing the first lines of system to read .....
>
> function (command, intern = FALSE, wait = TRUE, input = NULL,
> show.output.on.console = TRUE, minimized = FALSE, invisible = FALSE)
> {
> command<-paste(Sys.getenv("COMSPEC"),"/c",command)
>
> etc}
>
> But we still couldn't get spgrass6 to import and export raster layers
> even after fiddling with the code to get rid of cygpath etc. Perhaps
> Roger has a fix? It would be useful.
I do not have a stable working version of the winGRASS port (the one
packaged with QGIS), and since it is described on the GRASS-dev list as at
best pre-alpha, will not try it soon.
Since it does come with the circular GDAL plugin fix, you should be able
to read the GRASS rasters using the GRASS driver in readGDAL() in rgdal,
and maybe vectors too. Of course, the driver is read-only, but it ought to
work.
As far as spgrass6 is concerned, GRASS on Windows runs under cygwin. The
number of different GRASS releases in the wild is now substantial, and
even just keeping the Unix/Linux and cygwin ones working and maintainable
is not easy.
If you have usable patches that don't break anything else (cygwin), I
would be interested, but something will have to let Rwin know how to
branch to native winGRASS rather than cygwin.
Roger
>
> Also while posting, can anyone suggest a way of measuring the closest
> distance between disjunct polygons in R (forest fragments)? Its easy to
> use centroids in spdep, but we were interested in the distances between
> the edges.
>
PS. There is a good deal of vector computational geometry in spatstat,
often in the internal functions. For example, ?distpl brings up a list
with many useful possibilities.
> Duncan
>
>
>
--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
More information about the R-sig-Geo
mailing list