[R-sig-Geo] Reading vector data from GRASS GIS.-

Freddy López freddy.vate01 at gmail.com
Fri Jun 17 04:37:10 CEST 2011


Thanks, Christopher, for your attention.

> Are you able to import other point files you have generated in this location?  How about other vectors and rasters (also from this location).

I couldn't do it.

And v.info map=venest3 produces (it is in spanish):

GRASS 6.4.1 (venest3):~ > v.info map=venest3
 +----------------------------------------------------------------------------+
 | Capa:                venest3                                               |
 | Directorio de mapas: PERMANENT                                             |
 | Localización:        venest3                                              |
 | Base de datos:       /home/vate01/grassdata                                |
 | Título:                                                                   |
 | Escala del mapa:     1:1                                                   |
 | Formato del mapa:    native                                                |
 | Nombre del creador:  vate01                                                |
 | Organización:                                                             |
 | Fecha del origen:    Wed Jun 15 21:02:40 2011                              |
 |----------------------------------------------------------------------------|
 |   Tipo de mapa:  vectorial (nivel: 2)                                      |
 |                                                                            |
 |   Número de puntos:        0               Número de áreas:        244  |
 |   Número de líneas:        0               Número de islas:        204  |
 |   Número de contornos:     313             Número de caras:      0       |
 |   Número de centroides:    230             Número de kernels:    0       |
 |                                                                            |
 |   Map is 3D:              No                                               |
 |   Número de enlaces a base de datos:      1                               |
 |                                                                            |
 |         Proyección: Lat/Lon                                               |
 |               N:  15:40:47.245789N    S:   0:39:09.376273N                 |
 |               E:  58:09:55.788574W    W:  73:22:24.396973W                 |
 |                                                                            |
 |   Umbral de digitalización: 0                                             |
 |   Comentarios:                                                             |
 |                                                                            |
 +----------------------------------------------------------------------------+


Thanks again.

On Thu, Jun 16, 2011 at 20:23, Christopher Fusting <cfusting at gmail.com> wrote:
>
> Are you able to import other point files you have generated in this location?  How about other vectors and rasters (also from this location).  Can you post 'v.info map=venest3' command output?
> _Chris
>
> On Thu, Jun 16, 2011 at 12:23 PM, Freddy López <freddy.vate01 at gmail.com> wrote:
>>
>> > you have to be in the location and mapset where the vector is you want to read. In your case location=venest3, mapset=PERMANENT. Then start R, then
>> > library(spgrass6)
>> > readVECT6("yourvector")
>>
>>
>> Thank you Tom, but it is what is not working. I'm of course in
>> venest3/PERMANENT but readVECT6() does not read the vector.
>>
>> I will suppose is a file or data problem because it works for example
>> North Carolina and spearfish60 mapsets and I'm following the same
>> steps with venest3.
>>
>> Cheers.
>>
>> On Thu, Jun 16, 2011 at 11:23, Gottfried, Tom <tom.gottfried at tum.de> wrote:
>> > Hi,
>> >
>> > you have to be in the location and mapset where the vector is you want to read. In your case location=venest3, mapset=PERMANENT. Then start R, then
>> > library(spgrass6)
>> > readVECT6("yourvector")
>> >
>> > regards,
>> > Tom
>> > ________________________________________
>> > Von: Freddy López [freddy.vate01 at gmail.com]
>> > Gesendet: Donnerstag, 16. Juni 2011 14:44
>> > Bis: r-sig-geo at r-project.org
>> > Cc: Gottfried, Tom
>> > Betreff: Re: [R-sig-Geo] Reading vector data from GRASS GIS.-
>> >
>> > Dear Tom,
>> >
>> > Excuse me for the misuse of terms. I create a new location with a
>> > shapefile (using v.in.ogr) and it creates automatically a mapset (am I
>> > wrong?) in /home/vate01/grassdata/venest3/PERMANENT/vector/.
>> >
>> > Just to be nasty: PERMANENT is the (default) mapset.
>> >
>> > When I use the same steps with example datasets, this time North
>> > Carolina data, I get:
>> >
>> > # once inside gisdemo_ncspm location, I run R and...
>> >> 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.0, released 2011/01/12
>> > Path to GDAL shared files: /usr/share/gdal/1.8
>> > Loaded PROJ.4 runtime: Rel. 4.7.1, 23 September 2009
>> > Path to PROJ.4 shared files: (autodetected)
>> > Loading required package: XML
>> > GRASS GIS interface loaded with GRASS version: 6.4.1
>> > and location: gisdemo_ncspm
>> >
>> > # one test...
>> >> plot(readVECT6('geology'))
>> > OGR data source with driver: GRASS
>> > Source: "/home/vate01/grassdata/gisdemo_ncspm/PERMANENT/vector/geology/head",
>> > layer: "1"
>> > with 1832 features and 8 fields
>> > Feature type: wkbPolygon with 2 dimensions
>> >
>> > # another test...
>> >> plot(readVECT6('firestations'))
>> > OGR data source with driver: GRASS
>> > Source: "/home/vate01/grassdata/gisdemo_ncspm/PERMANENT/vector/firestations/head",
>> > layer: "1"
>> > with 71 features and 22 fields
>> > Feature type: wkbPoint with 2 dimensions
>> >
>> > #  idem...
>> >> plot(readVECT6('elev_points'))
>> > OGR data source with driver: GRASS
>> > Source: "/home/vate01/grassdata/gisdemo_ncspm/PERMANENT/vector/elev_points/head",
>> > layer: "1"
>> > with 6000 features and 2 fields
>> > Feature type: wkbPoint with 2 dimensions
>> >
>> > Beautiful maps; but following the same steps with venest3, it reports
>> > the message
>> >
>> > Error en ogrInfo(dsn = dsn, layer = layer, input_field_name_encoding =
>> > input_field_name_encoding) :
>> >  Cannot open layer
>> >
>> > Additionally, when I use readShapePoly() function (with the original
>> > shapefile) there are no problems. I can plot the map perfectly
>> > (indeed, I have used this shape several times from either R or GRASS
>> > but never working one from another).
>> >
>> > Thanks for your attention.
>> >
>> > Cheers.
>> >
>> >
>> > On Thu, Jun 16, 2011 at 02:01, Tom Gottfried <tom.gottfried at tum.de> wrote:
>> >> Hi Freddy,
>> >>
>> >> if, as you have written, venest3 is a location, then you can't read it as
>> >> vector. You have to create a mapset in your location and a vector dataset in
>> >> the mapset. Then you can read the vector dataset.
>> >>
>> >> regards,
>> >> Tom
>> >>
>> >> Am 16.06.2011 04:36, schrieb Freddy López:
>> >>>
>> >>> Hello guys,
>> >>>
>> >>> I think this question is in the border: r-sig-geo or grass-user list...
>> >>>
>> >>> I want to do some interpolation using GRASS' graphical features but
>> >>> using code and libraries written in R and I'm trying to follow section
>> >>> 10.2.1 from 3rd edition GRASS BOOK (Open Source GIS: A GRASS GIS
>> >>> Approach).
>> >>>
>> >>> I create a location into GRASS, venest3, apparently with no problem
>> >>> and I can plot it using d.vect.
>> >>>
>> >>> After starting R and run the readVECT6 function I get
>> >>>
>> >>>> readVECT6('venest3')
>> >>>
>> >>> Error en ogrInfo(dsn = dsn, layer = layer, input_field_name_encoding =
>> >>> input_field_name_encoding) :
>> >>>  Cannot open layer
>> >>>
>> >>> I have experimented using the spearfish60 file and it works perfectly
>> >>> (I selected randomly geology...):
>> >>>
>> >>>> readVECT6('geology'))
>> >>>
>> >>> OGR data source with driver: GRASS
>> >>> Source:
>> >>> "/home/vate01/grassdata/spearfish60/PERMANENT/vector/geology/head",
>> >>> layer: "1"
>> >>> with 422 features and 2 fields
>> >>> Feature type: wkbPolygon with 2 dimensions
>> >>> ...
>> >>>
>> >>>
>> >>> Both locations (venest3 and spearfish60), inside its 'vector'
>> >>> directory have the same six files: cidx, coor, dbln, head, hist, topo.
>> >>>
>> >>> Have you any ideas how can I solve this situation? How to read my vector
>> >>> data?
>> >>>
>> >>> Thanks in advance.-
>> >>>
>> >>>
>> >>> --
>> >>> «But Gwindor answered: 'The doom lies in yourself, not in your name.'»
>> >>>
>> >>> JRR Tolkien
>> >>>
>> >>> _______________________________________________
>> >>> R-sig-Geo mailing list
>> >>> R-sig-Geo at r-project.org
>> >>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>> >>
>> >> --
>> >> Technische Universität München
>> >> Department für Pflanzenwissenschaften
>> >> Lehrstuhl für Grünlandlehre
>> >> Alte Akademie 12
>> >> 85350 Freising / Germany
>> >> Phone: ++49 (0)8161 715324
>> >> Fax:   ++49 (0)8161 713243
>> >> email: tom.gottfried at wzw.tum.de
>> >> http://www.wzw.tum.de/gruenland
>> >>
>> >
>> >
>> >
>> > --
>> > «But Gwindor answered: 'The doom lies in yourself, not in your name.'»
>> >
>> > JRR Tolkien
>>
>>
>>
>> --
>> «But Gwindor answered: 'The doom lies in yourself, not in your name.'»
>>
>> JRR Tolkien
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>
>
> --
> Christopher W. Fusting
>
> Specializing in Geospatial :
> Analysis
> Data Modeling
> Application Development
>
> Cell:
> 828-772-0012



--
«But Gwindor answered: 'The doom lies in yourself, not in your name.'»

JRR Tolkien



More information about the R-sig-Geo mailing list