[R-sig-Geo] readVECT6 - Multiple incompatible geometries

Roger Bivand Roger.Bivand at nhh.no
Wed Dec 14 20:39:57 CET 2011


On Wed, 14 Dec 2011, Eric Momsen wrote:

> Hi again,
>
> I'm still having trouble figuring this issue out.  Maybe posting on a
> Friday night in Europe was the wrong time to be asking questions?
> Otherwise I apologize for the repost.
>
> Today I have a possibly related error.  The new scenerio is added below.
> Is there a way to tell if I have an installation issue, data issue, or am
> not entering the commands correctly?

You do need to provide the output of sessionInfo(), and also the messages 
shown when you load spgrass6. Running your initial example with R 2.14.0, 
spgrass6_0.7-4, rgdal_0.7-5, sp_0.9-91, and:

Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 1.8.1, released 2011/07/09
Path to GDAL shared files: /usr/local/share/gdal
Loaded PROJ.4 runtime: Rel. 4.7.1, 23 September 2009, [PJ_VERSION: 470]
Path to PROJ.4 shared files: (autodetected)
Loading required package: XML
GRASS GIS interface loaded with GRASS version: GRASS 6.4.2svn47586 (2011)
and location: spearfish60

> streams <- readVECT6("streams", type = "line,boundary", 
+ remove.duplicates = FALSE)

seems to work OK. The data set in GRASS has both stream lines and islands 
forming boundaries, but is flattened in R to a SpatialLinesDataFrame. I 
suspect that your software versions may playing a role here. You may find 
the smaller volume statgrass list more responsive, although spgrass6 users 
use this list too.

Roger

>
> Thanks for any advice,
> Eric
>
>
> I am trying out Ordinary Kriging, following the example at
> http://casoilresource.lawr.ucdavis.edu/drupal/node/438
> With one minor modification (based on Roger Bivand's suggestions on
> grass.osgeo.org/wiki { I changed  G$cols*G$rows  to   prod(slot(grd,
> "cells.dim"))  }, I was able to successfully execute the procedure and
> write the data back to GRASS.  But when I tried to run the procedure on my
> dataset, I have the following error:
>
>> x.has.na <- readVECT6('nws_precip_1day_observed_20100310')
> Error in ogrInfo(dsn = dsn, layer = layer, input_field_name_encoding =
> input_field_name_encoding) :
> Cannot open layer
>
> I checked with:
>> system("g.list vect")
> ----------------------------------------------
> vector files available in mapset <nws_precip_1day_observed>:
> nws_precip_1day_observed_20100101       nws_precip_1day_observed_20100703
> ...additional vector files for each day...
>
> So I can see the file is available.  I'm not sure how to proceed with
> troubleshooting this.
>
> On Fri, Dec 9, 2011 at 12:56 PM, Eric Momsen <eric.momsen at ndsu.edu> wrote:
>
>> Hello,
>>
>> I'm new to GIS and R and have been working my way along from various
>> sources.  I'm having difficulty getting R to see some data in GRASS.  For
>> troubleshooting, I'm trying out the examples in Applied Spatial Data
>> Analysis with R, chapter 4.
>>
>> I am able to use readVECT6 to read the 'bugsites' but not the 'streams' in
>> the spearfish dataset.  I was able to use vInfo for the 'streams'. Here is
>> the error, more input/output is below.
>>
>>> streams <- readVECT6("streams", type = "line,boundary",
>> remove.duplicates = FALSE)
>> Error in ogrInfo(dsn = dsn, layer = layer, input_field_name_encoding =
>> input_field_name_encoding) :
>>   Multiple incompatible geometries: 2:3
>>
>> I have searched for the phrase "Multiple incompatible geometries" and have
>> not found anything helpful.  Any advice would be appreciated!
>>
>> Thanks,
>> Eric
>>
>> Terminal commands and outputs (with some extraneous lines deleted ?):
>>
>> '/Applications/GRASS-6.4.app/Contents/MacOS/grass.sh'; exit
>> ?
>> Python 2.6.1 found.
>> ?
>> Welcome to GRASS 6.4.1 (2011)
>> ?
>> GRASS 6.4.1 (spearfish60):~ > r64
>>
>> R version 2.13.2 (2011-09-30)
>> Copyright (C) 2011 The R Foundation for Statistical Computing
>> ISBN 3-900051-07-0
>> Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
>> ?
>> [Previously saved workspace restored]
>>
>>> library(spgrass6)
>> Loading required package: sp
>> Loading required package: rgdal
>> Geospatial Data Abstraction Library extensions to R successfully loaded
>> Loaded GDAL runtime: GDAL 1.8.1, released 2011/07/09
>> Path to GDAL shared files:
>> /Library/Frameworks/GDAL.framework/Versions/1.8/Resources/gdal
>> Loaded PROJ.4 runtime: Rel. 4.7.1, 23 September 2009, [PJ_VERSION: 470]
>> Path to PROJ.4 shared files: (autodetected)
>> Loading required package: XML
>> GRASS GIS interface loaded with GRASS version: GRASS 6.4.1 (2011)
>> and location: spearfish60
>>
>>> bugsDF <- readVECT6("bugsites")
>> OGR data source with driver: GRASS
>> Source:
>> "/Users/eric.momsen/grassdata/spearfish60/PERMANENT/vector/bugsites/head",
>> layer: "1"
>> with 90 features and 2 fields
>> Feature type: wkbPoint with 2 dimensions
>>
>>> summary(bugsDF)
>> Object of class SpatialPointsDataFrame
>> Coordinates:
>>               min     max
>> coords.x1  590232  608471
>> coords.x2 4914096 4920512
>> Is projected: TRUE
>> proj4string :
>> [+proj=utm +zone=13 +datum=NAD27 +units=m +no_defs +ellps=clrk66
>> +nadgrids=@conus, at alaska, at ntv2_0.gsb, at ntv1_can.dat]
>> Number of points: 90
>> Data attributes:
>>       cat                 str1
>>  Min.   : 1.00   Beetle site:90
>>  1st Qu.:23.25
>>  Median :45.50
>>  Mean   :45.50
>>  3rd Qu.:67.75
>>  Max.   :90.00
>>
>>> system("g.list vect")
>> ----------------------------------------------
>> vector files available in mapset <user1>:
>> basins    contours  rivers
>>
>> vector files available in mapset <PERMANENT>:
>> ? landuse         streams         t_9961_300_bks  ?
>>
>> ----------------------------------------------
>>
>>> vInfo("streams")
>>      nodes     points      lines boundaries  centroids      areas
>>  islands
>>        139          0        104         12          4          4
>>  4
>>      faces    kernels primitives      map3d
>>          0          0        120          0
>>
>>> streams <- readVECT6("streams", type = "line,boundary",
>> remove.duplicates = FALSE)
>> Error in ogrInfo(dsn = dsn, layer = layer, input_field_name_encoding =
>> input_field_name_encoding) :
>>   Multiple incompatible geometries: 2:3
>>>
>>
>>
>>
>
> 	[[alternative HTML version deleted]]
>
>

-- 
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
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