[GRASS-stats] Re: [R-sig-Geo] writing shapefiles / DBF files when input data contains NA

Dylan Beaudette dylan.beaudette at gmail.com
Tue Oct 7 23:55:22 EDT 2008


On Tue, Oct 7, 2008 at 6:26 PM, Hamish <hamish_b at yahoo.com> wrote:
> Dylan:
>> It looks like the limiting factor in this equation is the
>> code used in v.out.ogr.
>
> maybe a silly question, but is a 3rd party format even needed here?
>
> $ ogrinfo --formats | grep -i grass
>  -> "GRASS" (readonly)
>
> at least in the one direction.
>

Excellent question. I had also wondered about this. It looks like
there is a new argument in readVECT():

# read in directly with GDAL/OGR -- no intermediate file:
x <- readVECT6('xxx', plugin=TRUE)

This is quite fast and depends on the GDAL-GRASS plugin... However,
NULL data in a GRASS table is not imported correctly-- character
fields are imported as '', and numeric fields as 0.

So... Is the error in GDAL itself?

I tried inspecting a vector from GRASS with NULL data in some of the
columns from the table, using ogrinfo -al
location/mapset/vector/xxx/head

OGRFeature(1):23
  cat (Integer) = 24
  cat_ (Integer) = 24
  str1 (String) = (null)
  xyz (Real) = (null)
  abc (Integer) = (null)
  POINT (591583 4925280 0)

... which seems to correctly report the NULL values.

This leads me to suspect that something in readOGR() and writeOGR are
at fault in handling of NULL values.

Unfortunately looking at the rgdal source code wasn't very productive
(my fault).

Cheers,

Dylan


More information about the grass-stats mailing list