GRASS GIS - Konzistence vektorových dat

Z GeoWikiCZ

< GRASS GIS

Data poskytovaná v netopologických formátech (např. ESRI Shapefile) často obsahují řadu chyb a ve výsledku jsou nekonzistentní. V systémech, které na topologickou čistotu dat nekladou příliš důraz (jako je např. ESRI ArcGIS) se tyto chyby v datech neprojeví. GRASS jako striktně topologický GIS tyto chyby v datech neignoruje. Např. po importu vrstvy 'obce' z balíčku dat pro 3.cvičení předmětu 153GIS1 se chyby v datech projeví při aplikaci funkce 'dissolve' (sjednocení vektorových prvků). Např.

Příklad

Vektorová data naimportuje do GRASSu:

v.in.ogr dsn=obce.shp output=obce
Number of nodes: 30138
Number of primitives: 43577
Number of points: 0
Number of lines: 0
Number of boundaries: 33456
Number of centroids: 10121
Number of areas: 13448
Number of isles: 9
Number of areas without centroid: 3327
-----------------------------------------------------
WARNING: 3742 areas represent more (overlapping) features, because polygons
         overlap in input layer(s). Such areas are linked to more than 1
         row in attribute table. The number of features for those areas is
         stored as category in layer 2
6361 input polygons
Total area: 7.891444e+10 (13448 areas)
Overlapping area: 4.078277e+02 (3742 areas)
Area without category: 3.879863e+02 (3327 areas)

Vzhledem k nekonzistenci dat spojení ploch ('dissolve') nefunguje správně.

v.dissolve input=obce output=cr column=pomoc
Nekonzistence v datech se objeví po spojení ploch

Identifikace chyby v datech

Vektorová mapa obsahuje překrývající se plochy.

v.category input=obce option=report
Layer/table: 1/obce
type       count        min        max
point          0          0          0
line           0          0          0
boundary       0          0          0
centroid   13863          1       6249
area           0          0          0
face           0          0          0
kernel         0          0          0
all        13863          1       6249
Layer: 2
type       count        min        max
point          0          0          0
line           0          0          0
boundary       0          0          0
centroid    3742          2          2
area           0          0          0
face           0          0          0
kernel         0          0          0
all         3742          2          2

Výměru ploch vektorové mapy spočteme ve třetí vrstvě. Nejprve přidáme kategorie všem centroidům.

v.category input=obce output=obce3 layer=3 option=add
v.category input=obce3 option=report
Layer/table: 1/obce3
type       count        min        max
point          0          0          0
line           0          0          0
boundary       0          0          0
centroid   13863          1       6249
area           0          0          0
face           0          0          0
kernel         0          0          0
all        13863          1       6249
Layer: 3
type       count        min        max
point          0          0          0
line           0          0          0
boundary       0          0          0
centroid   10121          1      10121
area           0          0          0
face           0          0          0
kernel         0          0          0
all        10121          1      10121
Layer: 2
type       count        min        max
point          0          0          0
line           0          0          0
boundary       0          0          0
centroid    3742          2          2
area           0          0          0
face           0          0          0
kernel         0          0          0
all         3742          2          2

Třetí vrstvě přiřadíme atributovou tabulku se dvěma sloupci - 'cat' a 'area'.

v.db.addtable map=obce3 layer=3 columns="cat integer, area double precision"

Pro kontrolu si vypíšeme seznam připojených atributových tabulek.

v.db.connect map=obce3 -p
Vector map <obce3@landa> is connected by:
layer <1> table <obce3> in database </home/martin/grassdata/gis1/landa/dbf/> through driver <dbf> with key <cat>
layer <3> table <obce3_3> in database </home/martin/grassdata/gis1/landa/dbf/> through driver <dbf> with key <cat>

Spočteme výměru ploch a hodnotu uložíme do sloupce 'area'.

v.to.db map=obce3 option=area columns=area layer=3

Data zobrazíme.

d.vect map=obce3 type=area
d.vect map=obce3 type=area layer=3 where="area < 10" fcolor=red color=red
Vizualizace vektorové vrstvy 'obce', červeně jsou zvýrazněny plochy s výměrou menší než 10m2

Řešení

v.clean input=obce output=obceX type=area tool=rmarea thresh=10
--------------------------------------------------
Tool: Remove small areas
7087 areas of total size 795.814 removed
--------------------------------------------------

Po vyčištění dat již funkce dissolve funguje.

Spojení ploch na základě zvoleného atributu