Adrian.Baddeley | 1 Feb 03:27
Picon
Picon

finding coordinates of points on a dilation contour

Lorenzo Cattarino <l.cattarino <at> uq.edu.au> writes:

 > I have a set of coordinates representing a shape (i.e. a square). I would like to perform an Euclidean
dilation operation,
 >  i.e., find all the point that lie at a distance r from the shape contour. I tried with the dilation function
in the "spatstat" package 
 > but I could not get the coordinates of the points forming the dilated contour, nor the number of those points.

Use the function 'vertices'. You need to ensure that gpclib is enabled. For example:

library(spatstat)
spatstat.options(gpclib=TRUE)
w <- square(1) # or whatever your shape is
r <- 0.1             # Dilation distance
z <- dilation(w, r)
v <- vertices(z)

------
Adrian Baddeley
Roger Bivand | 1 Feb 10:14
Picon

Re: Building Windows binary of rgdal package to include PGeo driver for reading ESRI personal geodatabases.

On Tue, 31 Jan 2012, Obrien, Josh wrote:

> I am a long-time R user, currently working with a team of ArcGIS users. 
> The GIS guys would like to be able pass me data in the form of ESRI 
> personal geodatabases (*.mdb), but the OGR driver that reads such files 
> (PGeo) is not included in the Windows rgdal binary.
>
> Roger Bivand's 2008 book (p 111) and the "README.windows" file located 
> in rgdal's main directory both have the same advice for me. They tell me 
> that "the R Windows binary rgdal package can be built against an FWTools 
> binary, using VC++."

Josh,

Could you please try to install R-devel for Windows:

http://cran.r-project.org/bin/windows/base/rdevel.html

and install the CRAN binary of rgdal? Prof. Brian Ripley and Uwe Ligges 
have been continuing their excellent support for us and the whole 
community, and as part of build train enhancements for forthcoming 2.15 on 
Windows, have built GDAL with more dependencies, including ODBC. For me on 
R-devel, ogrDrivers() now shows:

23   MapInfo File  TRUE
24         Memory  TRUE
25   MSSQLSpatial  TRUE
26           ODBC  TRUE
27        OpenAir FALSE
28         PCIDSK  TRUE
(Continue reading)

Edzer Pebesma | 1 Feb 11:20
Picon
Favicon
Gravatar

changes to SpatialGrid in sp_0.9-94

Dear r-sig-geo-ers,

sp 0.9-94 has been released and will propagate through the CRAN networks.

The class hierarchy in sp has been slightly modified in the upcoming sp
version. In particular, SpatialGrid no longer "is" SpatialPixels, and
the same is true for objects of class SpatialGridDataFrame.

The binary representation also changed, as obsolete slots (coords,
grid.index) could be removed. It seems that saved R data bases will
still work with the new sp versions, as only slots disappeared. The
reverse is not true (saved 0.9-94 objects will create errors when run
with sp 0.9-93).

The main reason for this change is a strong performance improvement when
large images are read (e.g. by rgdal::readGDAL) into
SpatialGridDataFrame objects.

This change may affect the working of scripts that depend on the old sp
behaviour. If so, an explicit coercion of a SpatialGridDataFrame object
x needs to be added, as in:

x = as(x, "SpatialPixelsDataFrame")

or, equivalently:

fullgrid(x) = FALSE

before you pass on the object to the routine that assumes x to be a
SpatialPixels. And there may be other issues that I missed, of course.
(Continue reading)

Johannes Radinger | 1 Feb 11:33
Picon
Picon

transform spatial points into data.frame

Hello,

probably this is a very simple task:

How can I transform spatial points (assigned coordinates with rgdal)  
into a ordinary data.frame
where the first column is name of the point and the second and third  
columns are
X and Y?

/johannes
Edzer Pebesma | 1 Feb 11:38
Picon
Favicon
Gravatar

Re: transform spatial points into data.frame

did you try

as.data.frame(x)

?

On 02/01/2012 11:33 AM, Johannes Radinger wrote:
> Hello,
> 
> probably this is a very simple task:
> 
> How can I transform spatial points (assigned coordinates with rgdal)
> into a ordinary data.frame
> where the first column is name of the point and the second and third
> columns are
> X and Y?
> 
> /johannes
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo <at> r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

--

-- 
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763  http://ifgi.uni-muenster.de
http://www.52north.org/geostatistics      e.pebesma <at> wwu.de
(Continue reading)

pgalpern | 1 Feb 13:51
Picon

Re: finding distance from a patch

I have not found a function in an existing package that will do this 
exactly, although there may be one.  However, here is an approach that 
will find the minimum distance from a point to a class based on 
functions in the raster package.  Note that this uses the grid distance 
and not the Euclidean distance for efficiency.  (Also, has not been 
thoroughly tested.)

DistancePointToClass <- function(classRaster, pointXY, focalClass) {
     rasterPointXY <- classRaster
     rasterPointXY[] <- NA
      rasterPointXY[cellFromXY(classRaster, pointXY)] <- 1
      distanceFrom <- gridDistance(rasterPointXY, origin = 1)
      minDistance <- min(distanceFrom[classRaster[] == focalClass])
      return(minDistance)
  }

The classRaster parameter can be your patches object.  If you need the 
minimum distance to any patch you can set all the patches to the same 
focalClass:

patches[!is.na(patches)] <- 1

Or if you need minimum distances to each patch, you can iterate through 
all the classes on patches using the focalClass parameter, although this 
will be very inefficient on large rasters.

You can find examples of usage of this function in this tutorial:  
http://nricaribou.cc.umanitoba.ca/R/RWorkshop3.pdf

--

-- 
(Continue reading)

Ken | 1 Feb 14:45
Favicon

Re: transform spatial points into data.frame

Johannes Radinger <JRadinger <at> gmx.at> writes:

> 
> Hello,
> 
> probably this is a very simple task:
> 
> How can I transform spatial points (assigned 
coordinates with rgdal)  
> into a ordinary data.frame
> where the first column is name of the point and the 
second and third  
> columns are
> X and Y?
> 
> /johannes
>
Hi Johannes,

if it is a S3 or S4 object, you can try using the @ symbol:
sp.df = myspatialpts <at> data

where myspatialpts is the object containing your spatial 
points.

HTH,
Ken
Diego Andre | 1 Feb 17:46
Picon

Spatial tobit

Hi,

How I estimate a spatial tobit in R?

--

-- 
Diego André
Doutorando em Economia - CAEN/UFC
lattes: http://lattes.cnpq.br/6480130040427049<http://www.orkut.com.br/Interstitial?u=http://lattes.cnpq.br/6480130040427049&t=AHTo3AFQ4NVkvePimxtMNTLx_98m1wsDHxVF6BHPOhTLLepkcou6qJpV89btnA5JBcIcq4CgFTjFWubyjMexdr4Egu0z4qwcLwAAAAAAAAAA>

	[[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo <at> r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Robert J. Hijmans | 1 Feb 18:18
Picon

Re: finding distance from a patch

Lorenzo,

If I understand you correctly you want the shortest distance from a set of
points to a (the nearest) patch. In that case, compute the patches (as you
have done), then use 'distance', and then use 'extract' to extract the
distances for your point 'xy'.

d = distance(patches)
v <- extract(d, xy)

If, however, you want the distance from each point to each patch you would
need a loop like Paul suggested. How I would do that loop would depend on
the size of the raster and the area covered by the patches therein. For a
smallish dataset you could use rasterToPoints and pointDistance. For larger
datasets you could use reclass and distance to do the same as above but
then patch class by patch class.

Robert

On Wed, Feb 1, 2012 at 4:51 AM, pgalpern <pgalpern <at> gmail.com> wrote:

> I have not found a function in an existing package that will do this
> exactly, although there may be one.  However, here is an approach that will
> find the minimum distance from a point to a class based on functions in the
> raster package.  Note that this uses the grid distance and not the
> Euclidean distance for efficiency.  (Also, has not been thoroughly tested.)
>
> DistancePointToClass <- function(classRaster, pointXY, focalClass) {
>    rasterPointXY <- classRaster
>    rasterPointXY[] <- NA
(Continue reading)

Obrien, Josh | 1 Feb 21:04
Picon

Re: Building Windows binary of rgdal package to include PGeo driver for reading ESRI personal geodatabases.


>> On Tue, 31 Jan 2012, Obrien, Josh wrote:

>> I am a long-time R user, currently working with a team of ArcGIS users. 
>> The GIS guys would like to be able pass me data in the form of ESRI 
>> personal geodatabases (*.mdb), but the OGR driver that reads such files 
>> (PGeo) is not included in the Windows rgdal binary.
>>
>> Roger Bivand's 2008 book (p 111) and the "README.windows" file located 
>> in rgdal's main directory both have the same advice for me. They tell me 
>> that "the R Windows binary rgdal package can be built against an FWTools 
>> binary, using VC++."

> Josh,
> 
> Could you please try to install R-devel for Windows:
> 
> http://cran.r-project.org/bin/windows/base/rdevel.html
> 
> and install the CRAN binary of rgdal? Prof. Brian Ripley and Uwe Ligges 
> have been continuing their excellent support for us and the whole 
> community, and as part of build train enhancements for forthcoming 2.15 on 
> Windows, have built GDAL with more dependencies, including ODBC. For me on 
> R-devel, ogrDrivers() now shows:
> 
> 23   MapInfo File  TRUE
> 24         Memory  TRUE
> 25   MSSQLSpatial  TRUE
> 26           ODBC  TRUE
> 27        OpenAir FALSE
(Continue reading)


Gmane