[R-sig-Geo] ArcGIS raster/vector to SPATSTATS im image file conversion
Roger Bivand
Roger.Bivand at nhh.no
Wed Mar 5 08:34:31 CET 2008
On Wed, 5 Mar 2008, Liza Koshy wrote:
> Hello,
>
> I would like to convert ArcGIS vector/raster grids to SPATSTATS image
> files (*.im files) and would like to know how this can be done.
Assuming vector is a point shapefile, use readOGR() in the rgdal package -
points do not make im objects (not files) directly. Do you have a plan of
your workflow? Is it something like:
1) read a shapefile of points and convert to a ppp object;
2) read a grid and convert to an im object to use as a window for the
point pattern analysis;
The first one would be:
library(rgdal)
my_pts <- readOGR(dsn=".", layer="my_shp") # for my_shp.shp in current
# directory
plot(my_pts)
library(maptools)
my_ppp <- as(as(my_pts, "SpatialPoints"), "ppp") # coerce to SpatialPoints
# before coercion to ppp
# unless you need marks
plot(my_ppp)
and the second:
my_grd <- readGDAL("my_grid") # for my_grid as full file name
image(my_grd)
plot(my_pts, add=TRUE)
my_im <- as(my_grd, "im") # note that my_grd should only have a single
# column
plot(my_im)
Are you thinking of using the im object values to represent inhomogeneity?
Or are you going to use missing values to define the owin window object
for the point process? If the latter, you may want to say:
summary(my_grd)
names(my_grd)
to see what is inside the object before coercing to an im object. If need
be, set the single column values to NA for areas outside the required
window.
Hope this helps,
Roger
>
> I have not used SPATSTATS before (I use ArcGIS regularly), however I
> would like to try spatial modelling of a point pattern in SPATSTATS,
> using a ArcGIS point pattern (shapefile) with environmental variables of
> climate, land cover, and landscape indicators (ArcGIS raster grids of
> either continuous or categorical data). I can also convert these grids
> to ASCII file formats also if that helps.
>
PS. From your description, it isn't clear that you have a viable work
plan, or that point pattern analysis is appropriate. You have points
(presence of something?) and rasters of environmental variables. Have you
observed a point pattern in which interpoint distances are important, or
just (some) points at which something has been observed? Do you have, for
example, Fortin & Dale to hand, it might help?
>
>
> I would be grateful for any assistance you can provide.
>
>
>
> Kind regards,
>
>
>
> Liza Storey.
>
>
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
--
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