[GRASS-user] Categories in new layers of vector maps

Helmut Kudrnovsky hellik at web.de
Mon Oct 13 04:36:39 PDT 2014


Johannes Radinger wrote
> Hi,
> 
> I am slightly confused about creating new layers for vector maps and
> adding
> a category value.
> I want to add a layer and subsequently I want to use v.what.rast to query
> a
> raster map and update
> that layer. Hence, I need categories in the new layer. However, it seems
> that adding a new table and connect it to a specific layer (v.db.addtable)
> does not create/update the category column (in GRASS 71, trunk):
> 
> Here an example for the NC-dataset:
> 
> v.db.addtable map=firestations at PERMANENT layer=2
> 
> DB settings already defined, nothing to do
> Reading features...
> Updating database...
> 0 categories read from vector map (layer 2)
> 0 records updated/inserted (layer 2)
> 
> 
> And when I try to manually update the category I am also not successful:
> v.to.db map=firestations at PERMANENT layer=2 option=cat columns=cat
> 
> Reading features...
> Updating database...
> 0 categories read from vector map (layer 2)
> 0 records updated/inserted (layer 2)
> 
> Maybe I just got something wrong?
> 
> 
> The map "firestations at PERMANENT" has categories (stored in layer 1)
> v.category input=firestations at PERMANENT option=report
> 
> Layer/table: 1/firestations
> type       count        min        max
> point         71          1         71
> line           0          0          0
> boundary       0          0          0
> centroid       0          0          0
> area           0          0          0
> face           0          0          0
> kernel         0          0          0
> all           71          1         71
> v.category complete. 0 features modified.
> 
> 
> 
> Any suggestions?
> 
> 
> best,
> Johannes
> 
> _______________________________________________
> grass-user mailing list

> grass-user at .osgeo

> http://lists.osgeo.org/mailman/listinfo/grass-user

one possible workflow (but maybe not the only one):

g.copy vect=hospitals at PERMANENT,myhospitals 

v.db.addtable map=myhospitals at testnewlayer table=myhospitalslayer2 layer=2      
DB settings already defined, nothing to do
Lese Objekte...
Aktualisiere die Datenbank...
0 Kategorien gelesen von der Vektorkarte (Layer 2).
0 Datensätze aktualisiert/eingefügt (Layer 2).

v.category --verbose input=myhospitals at testnewlayer layer=2
output=myhospitals2layers option=add
Using native format
Verarbeite Objekte...
Kopiere Attributtabelle(n)...
Erstelle Topologie für die Vektorkarte <myhospitals2layers at testnewlayer>...
Registriere Primitive...
160 primitives registered
160 Vertices registriert
Erzeuge Flächen...
0 areas built
0 isles built
Füge Inseln hinzu...
Füge Zentroide hinzu...
Die Topologie wurde erstellt.
Anzahl der Knoten: 0
Anzahl der Primitive: 160
Anzahl der Punkte: 160
Anzahl der Linien: 0
Anzahl der Grenzen: 0
Anzahl der Zentroide: 0
Anzahl der Flächen: 0
Anzahl der Inseln: 0
v.category komplett. 160 features modified.

v.to.db map=myhospitals2layers at testnewlayer layer=2 option=cat columns=cat      
Lese Objekte...
Aktualisiere die Datenbank...
160 Kategorien gelesen von der Vektorkarte (Layer 2).
160 Kategorien gelesen von der Vektorkarte existieren nicht in der Selektion
der Tabelle.
160 Datensätze aktualisiert/eingefügt (Layer 2).

v.db.addcolumn --quiet map=myhospitals2layers at testnewlayer layer=2
columns=testquery double

v.category input=myhospitals2layers at testnewlayer option=report                  
v.category komplett. 0 features modified.
Layer/Tabelle: 1/myhospitals2layers_hospitals
Typ       Anzahl        Min        Max
Punkt        160          1        160
Linie           0          0          0
Grenze       0          0          0
Zentroid       0          0          0
Fläche           0          0          0
Oberfläche           0          0          0
Kernel         0          0          0
Alle          160          1        160
Layer/Tabelle: 2/myhospitals2layers_myhospitalslayer2
Typ       Anzahl        Min        Max
Punkt        160          1        160
Linie           0          0          0
Grenze       0          0          0
Zentroid       0          0          0
Fläche           0          0          0
Oberfläche           0          0          0
Kernel         0          0          0
Alle          160          1        160

g.region -p -a --verbose rast=elevation at PERMANENT align=elevation at PERMANENT   

v.what.rast --verbose map=myhospitals2layers at testnewlayer layer=2
raster=elevation at PERMANENT column=testquery
Reading features from vector map...
WARNING: 158 Punkte außerhalb der Region wurden übersprungen.
Update vector attributes...
2 Kategorien aus dem Vektor geladen.
160 Kategorien aus der Tabelle geladen.
0 Kategorien des Vektors fehlen in der Tabelle.
v.what.rast komplett. 2 records updated.






-----
best regards
Helmut
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Categories-in-new-layers-of-vector-maps-tp5167141p5167194.html
Sent from the Grass - Users mailing list archive at Nabble.com.


More information about the grass-user mailing list