[GRASS-user] db.? to change column names
Moritz Lennert
mlennert at club.worldonline.be
Fri Aug 31 08:32:44 PDT 2018
On 31/08/18 16:43, Rich Shepard wrote:
> On Fri, 31 Aug 2018, Moritz Lennert wrote:
>
>> Markus gave you the name of a module, but just to make sure: the column
>> content in your attribute table does not change because you reproject, so
>> your columns lat and lon should still contain lat and lon values.
>
> Moritz,
>
> Yes, this is correct: they do.
>
> However, v.out.ascii produced the projected coordinates, not the
> geographic lon/lat; e.g.,
>
> 10332|2324618.93021014|214826.06781179
> 10335|2330789.44861867|202224.65265656
>
> While in the GUI attribute table manager this is seen:
> 10332|-122.7475|45.977544
> 10335|-122.644139|45.466111
>
> and there are no easting/northing columns.
Normal:
The first (v.out.ascii) is an output of the information on the
geometries (the points). The second is the attribute table linked to
those geometries.
>
> Here's the script (line breaks set by MUA; entered on one command line):
>
> Using lon_lat location:
> v.in.ascii in=wrb-stations.dat out=stations text=doublequote skip=1
> columns='site_nbr varchar(5), site_name varchar(64), lon double precision,
> lat double precision' x=3 y=4 z=0
>
> Exit grass, restart and create new location/mapset, then:
> v.proj loc=lon_lat map=PERMANENT in=stations
> v.out.ascii -c in=stations out=stations.dat type=point columns='*' format=point --o
> v.to.db map=stations opt=coor columns='easting,northing'
>
> Closed that map in the GUI and re-loaded it; still no easting/northing
> columns only lon/lat.
To get the data into columns, try this:
v.db.addcolumn stations col="easting double precision, northing double
precision"
v.to.db map=stations opt=coor columns='easting,northing'
Then you should see the easting and northing columns in the attribute
table. Not need to export and reload.
Moritz
More information about the grass-user
mailing list