[R-sig-Geo] error message rgdal: dimensions do not match

karl.sommer at dpi.vic.gov.au karl.sommer at dpi.vic.gov.au
Tue Jul 4 06:33:58 CEST 2006


I am encountering a error message when attempting to do "inverse distance
kriging" or variogram calculations. The error is always the same

ERROR: dimensions do not match: locations 1513600 and data 611452.

What puzzles me is the fact that I am using the same code as I have
successfully
used with 2 other images.

I have tried to reduce the dimensions of the imported image in using
gdal_translate from the command prompt. The same error was still present
but with different "address-numbers" relating to locations and data.

I have tried to find some pointers re error messages under the GDAL
manual but without success.

I am able to plot the imported image as well as the target grid and SPDF
without error.

following is the code:

library(rgdal)
# import image
> t1 <- readGDAL("images/test1.bil", half.cell=c(0.5, 0.5), silent = FALSE)

images/test1.bil has GDAL driver GTiff
and has 860 rows and 880 columns

Closing GDAL dataset handle 0100ACB8...  destroyed ... done.
Closing GDAL dataset handle 00000000... done.

# get shape file of field
> image(t1)
> poly <- locator()
> poly <- do.call("cbind", poly)
> poly <- rbind(poly, poly[1,])
> lines(poly)
> field <- SpatialPolygons(list(Polygons(list(Polygon(poly)), ID="field")))
> grd <- GridTopology(c(599040, 6228570), c(.5,.5), c(880, 860))
> SG <- SpatialGrid(grd)
> x1 <- overlay(SG, field)
> SGDF <- SpatialGridDataFrame(grd, data=AttributeList(list(field=x1)))
> SPDF <- as(SGDF, "SpatialPixelsDataFrame")

# do kriging
> library(gstat)
> t1.idw <- krige(ndvi~1, t1,  SPDF)
Error: dimensions do not match: locations 1513600 and data 611452

Regards

Karl
_________________________________
Karl J Sommer,
Department of Primary Industries,
Catchment & Agriculture Services,
PO Box 905
Mildura, VIC, Australia 3502

Tel: +61 (0)3 5051 4390
Fax +61 (0)3 5051 4534

Email:     karl.sommer at dpi.vic.gov.au




More information about the R-sig-Geo mailing list