Working with today's trunk I spotted an oddity - I can export to
shapefile not existing points.
Work flow: v.in.ogr shapefile with 11183 points; run v.clean with
rmdupl tool and reduce feature count to 10954; v.out.ogr exports to
shapefile 11183 features. WTF?!?
The best one is the output of v.out.ogr:
v.out.ogr -e input=clean_points2@geod_points type=point layer=1
dsn=/home/maris/clean_points2.shp format=ESRI_Shapefile
Exporting 10954 features...
v.out.ogr izpildīts. 11183 features written to <clean_points2> (ESRI_Shapefile).
And here is metadata output for imported and for cleaned vector
datasets (only Number of points differ):
Dirty: Number of points: 11183
Clean2: Number of points: 10954
Sounds like v.out.ogr includes some features in
the output that are marked "dead" but are still in the
dataset. Could you check two things, please:
1) Use another, external application (e.g. ogrinfo
or QGIS) to get an independent count of the number
of points in the output files,
2) and make a copy of the cleaned vector points map
using g.copy vect=, and use v.out.ogr to export
the copy instead of the cleaned original?
Ben
--
Benjamin Ducke
{*} Geospatial Consultant
{*} GIS Developer
benducke AT fastmail.fm
On Tue, Dec 13, 2011, at 21:21, Maris Nartiss wrote:
Working with today's trunk I spotted an oddity - I can export to
shapefile not existing points.
Work flow: v.in.ogr shapefile with 11183 points; run v.clean with
rmdupl tool and reduce feature count to 10954; v.out.ogr exports to
shapefile 11183 features. WTF?!?
The best one is the output of v.out.ogr:
v.out.ogr -e input=clean_points2@geod_points type=point layer=1
dsn=/home/maris/clean_points2.shp format=ESRI_Shapefile
Exporting 10954 features...
v.out.ogr izpildīts. 11183 features written to <clean_points2>
(ESRI_Shapefile).
And here is metadata output for imported and for cleaned vector
datasets (only Number of points differ):
Dirty: Number of points: 11183
Clean2: Number of points: 10954
Hello,
yes, I used QGIS to verify count of exported features in Shapefile and
indeed count matched with one reported by v.out.ogr as "written
feature count".
And now comes the best - g.copy and v.extract both had NO effect on
result -> resulting dataset still was exported with ALL points present
before v.clean. I run both ways twice to avoid PEBKAC.
And now the worst thing - GRASS 6.4.2 is also affected. I'm opening
ticket and blocking release till we will figure out what's exactly
wrong. If somebody has an idea, I can send dataset off-list for
testing.
Maris.
2011/12/14 Hamish <hamish_b@yahoo.com>:
Benjamin wrote:
Sounds like v.out.ogr includes some
features in
the output that are marked "dead" but are still in the
dataset. Could you check two things, please:
...
2) and make a copy of the cleaned vector points map
using g.copy vect=, and use v.out.ogr to export
the copy instead of the cleaned original?
OK. When creating a new test dataset I understood where's the problem:
v.clean rmdupl will remove duplicate geometries and will merge
categories resulting in single geometry, multiple categories
(acceptable in GRASS)
v.out.ogr can not export multiple categories to Shapefile as it
doesn't support such construct. v.out.ogr "fixes" it by duplicating
geometry and assigning one of categries (+ rest of attributes) to
cloned geometry thus one geometry = two cats turn to two geometries =
single cat for each.
It makes sense from data preservation point, still it might be
confusing to see that v.out.ogr can export more features than are
present in vector dataset (needs a warning here!) and it might totally
ruin cleaned data as I was using GRASS only to remove duplicate
features from the data set.
Sometimes GRASS vector model is too powerful...
Sorry for noise,
Maris.
2011/12/14 Maris Nartiss <maris.gis@gmail.com>:
Hello,
yes, I used QGIS to verify count of exported features in Shapefile and
indeed count matched with one reported by v.out.ogr as "written
feature count".
And now comes the best - g.copy and v.extract both had NO effect on
result -> resulting dataset still was exported with ALL points present
before v.clean. I run both ways twice to avoid PEBKAC.
And now the worst thing - GRASS 6.4.2 is also affected. I'm opening
ticket and blocking release till we will figure out what's exactly
wrong. If somebody has an idea, I can send dataset off-list for
testing.
Maris.
2011/12/14 Hamish <hamish_b@yahoo.com>:
Benjamin wrote:
Sounds like v.out.ogr includes some
features in
the output that are marked "dead" but are still in the
dataset. Could you check two things, please:
...
2) and make a copy of the cleaned vector points map
using g.copy vect=, and use v.out.ogr to export
the copy instead of the cleaned original?
On Wed, Dec 14, 2011 at 8:16 AM, Maris Nartiss <maris.gis@gmail.com> wrote:
OK. When creating a new test dataset I understood where's the problem:
v.clean rmdupl will remove duplicate geometries and will merge
categories resulting in single geometry, multiple categories
(acceptable in GRASS)
v.out.ogr can not export multiple categories to Shapefile as it
doesn't support such construct. v.out.ogr "fixes" it by duplicating
geometry and assigning one of categries (+ rest of attributes) to
cloned geometry thus one geometry = two cats turn to two geometries =
single cat for each.
It makes sense from data preservation point, still it might be
confusing to see that v.out.ogr can export more features than are
present in vector dataset (needs a warning here!) and it might totally
ruin cleaned data as I was using GRASS only to remove duplicate
features from the data set.
BTW, the reverse can also be true: a shapefile with, say, 5 polygons
may end up as a GRASS vector with much more than 5 areas, if the 5
polygons are multipolygons.
But back to the original problem: how about a new option to v.category
to reduce the number of categories for a given object and layer to 1?
Markus M
Sometimes GRASS vector model is too powerful...
Sorry for noise,
Maris.
2011/12/14 Maris Nartiss <maris.gis@gmail.com>:
Hello,
yes, I used QGIS to verify count of exported features in Shapefile and
indeed count matched with one reported by v.out.ogr as "written
feature count".
And now comes the best - g.copy and v.extract both had NO effect on
result -> resulting dataset still was exported with ALL points present
before v.clean. I run both ways twice to avoid PEBKAC.
And now the worst thing - GRASS 6.4.2 is also affected. I'm opening
ticket and blocking release till we will figure out what's exactly
wrong. If somebody has an idea, I can send dataset off-list for
testing.
Maris.
2011/12/14 Hamish <hamish_b@yahoo.com>:
Benjamin wrote:
Sounds like v.out.ogr includes some
features in
the output that are marked "dead" but are still in the
dataset. Could you check two things, please:
...
2) and make a copy of the cleaned vector points map
using g.copy vect=, and use v.out.ogr to export
the copy instead of the cleaned original?
But back to the original problem: how about a new option to
v.category to reduce the number of categories for a given object
and layer to 1?
but from among the choices which of the categories wins? v.buffer deals
with this by not letting any of them win, at least the result is obviously
right or wrong.
and what about the abandoned DB entries for each non-chosen cat? it is
impossible to merge them into a single record, although maybe creating
multiple layers could be a way around that?
I created a wish item in the tracker where I described how such module
could work.
What to do if attributes differ is a good question.
Maris.
2011/12/14 Hamish <hamish_b@yahoo.com>:
Markus Metz wrote:
But back to the original problem: how about a new option to
v.category to reduce the number of categories for a given object
and layer to 1?
but from among the choices which of the categories wins? v.buffer deals
with this by not letting any of them win, at least the result is obviously
right or wrong.
and what about the abandoned DB entries for each non-chosen cat? it is
impossible to merge them into a single record, although maybe creating
multiple layers could be a way around that?