[GRASS-user] Appending a map to another
Markus Metz
markus.metz.giswork at gmail.com
Mon Dec 8 23:24:28 PST 2014
On Mon, Dec 8, 2014 at 2:37 PM, tommaso <tommasodb at googlemail.com> wrote:
> Hello, I'm trying to simply append a map to other map, without any sort of
> geometric operations as merge or intersects, just the original geometries
> with theirs original attributes.
> I'm using grass 6.4 on ubuntu 14.04, sqlite driver
> This is what I already tried:
>
> # input maps are poly2 and poly3
> # First, I change the categories of one of the maps (poly3) to avoid
> categories conflicts:
> # see http://grass.osgeo.org/grass64/manuals/v.patch.html
> v.category in=poly3 option=sum cat=10000 out=poly3_category --overwrite
To be safe, you should specify the feature type: v.category type=centroid.
> g.remove vect=poly3
> g.rename vect=poly3_category,poly3
> # I update the cat column of the table as well (why this is not done
> automatically by v.category??)
> v.db.update poly3 col=cat qcol="cat+10000"
>
> # now the to maps are patched together
> db.droptable -f table=polygons
> v.patch -e input=poly2,poly3 output=polygons --overwrite
>
> # export to result as geojson:
> v.out.ogr in=polygons olayer=polygons format=GeoJSON dsn=/tmp/polygons.json
> type=area
This exports all features, with and without category. That means holes
in areas are converted to true polygons without categories. Use the -c
flag to export only true areas with ctegories.
>
> The geometries of the result map polygons.json look good, but the attributes
> are messy: I can not distinguish which records come from poly2 and which
> ones from poly3.
The records with cat >= 10000 should come from poly3. Is the cat
attribute not available in the json export?
> Many records have only empty attributes. What I'm doing
> wrong?
See above, v.in.ogr -c should help.
Markus M
More information about the grass-user
mailing list