[R-sig-Geo] Topo to raster in R

Rainer M Krug Rainer at krugs.de
Mon Feb 9 13:36:51 CET 2015


Jane Yang <jane.juen.yang at gmail.com> writes:

> Hi all,
>
> Happy Monday! Hoping the collective genius of this listserv can help me. I
> have vector contours data (source:
> http://192.156.137.110/gis/search.asp?id=318) that I would like to convert
> to a surface raster. Two questions:
>
>    1. What are peoples' opinions about the use of spgrass6's r.surf.contour
>    functionality vs raster's rasterize function? My basic understanding is
>    that GRASS has a more robust algorithm for interpolation, but please do
>    correct me if I'm mistaken.
>
>    2. I have been pursuing the r.surf.contour option because initial trials
>    with rasterize hasn't converted the majority of the data in the vector
>    contour file. However, when I try to load the vector file into a temporary
>    GRASS environment, I hit the following error in red, that results in no
>    data being transferred over to the raster.
>
> initGRASS("/Applications/GRASS-6.4.app/Contents/MacOS", home=tempdir(),
>     override = T)
> system("g.region -d")
> execGRASS("v.in.ogr", dsn = "path/to/file,
>     layer = "kenya_rainfall_distribution", output = "rf_raw2",
>     snap = 1e-14)
> Warning message:
> In execGRASS("v.in.ogr", dsn = paste(dd, "rainfall", "ilri", sep = "/"),  :
>   The command:
> v.in.ogr dsn=/VOLUMES/AUSTEN/OAF/KE-exp-extras/data/rainfall/ilri
> layer=kenya_rainfall_distribution output=rf_raw2 snap=1e-14
> produced at least one warning during execution:

> ERROR 4: .shx file is unreadable, or corrupt.

The question is: is your .shx file readable or is it corrupt?

If I understand correctly, this file contains a spatial index, so I
think you can rename it and try again?

The rest should be follow-up errors.

Hope this helps,

Rainer


> ERROR 4: Failed to open file
> /VOLUMES/AUSTEN/OAF/KE-exp-extras/data/rainfall/ilri/._kenya_rainfall_distribution.shp.
> It may be corrupt or read-only file accessed in update mode.
>
> execGRASS("v.to.rast", input = "rf_raw2", output = "rf_rast", column =
> "COLOR",
>     labelcolumn = "TYPE")
> rf.raster <- execGRASS("r.surf.contour", input = "rf_rast",
>     output = "rfraster")
>
> rf.raster
> [1] 0
> attr(,"resOut")
> character(0)
> attr(,"resErr")
> [1] "   0%\b\b\b\b\b 100%\b\b\b\b\b"
>
>
> However, I have no problem plotting the map in base plot. Any suggestions
> on how to work around this would be much appreciated.
>
> Thank you,
> Jane
>
> 	[[alternative HTML version deleted]]

-- 
Rainer M. Krug
email: Rainer<at>krugs<dot>de
PGP: 0x0F52F982
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 494 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20150209/729c5a2e/attachment.bin>


More information about the R-sig-Geo mailing list