[R-sig-Geo] Points2grid() from spatial points
Roger Bivand
Roger.Bivand at nhh.no
Wed Jun 13 15:29:16 CEST 2007
On Wed, 13 Jun 2007, Thomas Szegvary wrote:
> Hello, I'm new to R and try to use the geostatistical packages.
> I have a problem making grid from ESRI shapefiles. I imported the shapefile
> (polygon) and projected the coordinates. Then I used spsample() to produce a
> spatial points for the given regions resp. polygons. With points2grid I
> wanted to produce the grid, which should be used for krige(), but a always
> have an error message (see below).
>
> Script:
>> #prepare grid
>> europe <- readShapePoly("R course/country/europePoly.shp")
>> proj4string(europe) = CRS("+init=epsg:4326") europe.tr <-
> spTransform(europe,CRS("+init=epsg:3035"))
>> europe.points <- spsample(europe.tr,type="regular",cellsize=100000)
>> points2grid(europe.points)
> x1 x2
> cellcentre.offset 2735004 1478310
> cellsize 100000 100000
> cells.dim 37 48
> Warning message:
> grid has empty column/rows in dimension 2 in: points2grid(europe.points)
>
This is a warning, not an error, and only means that at least one
column/row in one dimension (so row most likely) has no points after
removing the points not inside the polygons. Try:
plot(europe.tr)
points(europe.points, cex=0.5)
to see where that might be.
Hope this helps,
Roger
>
> Thanks a lot
> Thomas
>
>
>
> __
>
> Thomas Szegvary
> Institute of Environmental Geosciences
> Department of Geosciences
> University of Basel
> Bernoullistrasse 30
> CH - 4056 Basel
>
> Tel. 41-61-267 04 82
> Fax. 41-61-267 04 79
> Email: t.szegvary at unibas.ch
> www.radon.unibas.ch
> www.unibas.ch/environment
>
> _______________________________________________
> 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