[GRASS-user] Import R point dataframe as points in GRASS
Markus Metz
markus.metz.giswork at googlemail.com
Fri Jun 8 08:37:32 PDT 2012
On Fri, Jun 8, 2012 at 2:44 PM, Johannes Radinger <JRadinger at gmx.at> wrote:
> Hi,
>
> I have a R data.frame containing around 60 columns, two of them are X and Y respectively. What is the recommended way to get these "points" imported into GRASS?
>
> Maybe the simplest way is to save the data.frame as csv and then use v.in.ascii in GRASS. I tried to do that and specified the columns for x and y and skipped the first line (header in the csv). The import works fine and all points are correctly imported but I miss the attribute names in the attribute table (header in the csv). Maybe I have just overseen this feature to use the header from the csv as attribute names... or is this just not possible?
As others mentioned already, you can define column names and types
with v.in.ascii columns=... But you could also open a ticket to
request an enhancement to v.in.ascii. The module can already
automatically determine the column type. It should not be too
difficult to add a new option to read column names from line X, e.g.
names=1 to read column names from line 1.
Markus M
>
> Or is there any other resp. better way to get points from R into GRASS? E.g. I could store them as spatial.points.data.frame in R but is there a native GRASS-format I could use for exporting/saving in R?
>
> any suggestions are welcome!
>
> /Johannes
> --
> NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone!
> Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
More information about the grass-user
mailing list