[GRASS-SVN] r55920 - grass/trunk/vector/v.in.ogr
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Apr 19 10:00:28 PDT 2013
Author: mmetz
Date: 2013-04-19 10:00:28 -0700 (Fri, 19 Apr 2013)
New Revision: 55920
Modified:
grass/trunk/vector/v.in.ogr/main.c
grass/trunk/vector/v.in.ogr/v.in.ogr.html
Log:
v.in.ogr: improve suggest snap threshold value
Modified: grass/trunk/vector/v.in.ogr/main.c
===================================================================
--- grass/trunk/vector/v.in.ogr/main.c 2013-04-19 13:48:40 UTC (rev 55919)
+++ grass/trunk/vector/v.in.ogr/main.c 2013-04-19 17:00:28 UTC (rev 55920)
@@ -1346,12 +1346,13 @@
Vect_topo_check(&Map, NULL);
if (n_polygons) {
- ncentr = Vect_get_num_primitives(&Map, GV_CENTROID);
+ /* test for topological errors */
/* this test is not perfect:
* small gaps (areas without centroid) are not detected
- * because they may be true gaps */
+ * small gaps may also be true gaps */
+ ncentr = Vect_get_num_primitives(&Map, GV_CENTROID);
if (ncentr != n_polygons || n_overlaps) {
- double new_snap;
+ double min_snap, max_snap;
Vect_get_map_box(&Map, &box);
@@ -1367,20 +1368,39 @@
if (xmax < ymax)
xmax = ymax;
- new_snap = log2(xmax) - 52;
- new_snap = pow(2, new_snap);
- new_snap = log10(new_snap);
- if (new_snap < 0)
- new_snap = (int)new_snap;
+ /* double precision ULP */
+ min_snap = log2(xmax) - 52;
+ min_snap = pow(2, min_snap);
+ /* human readable */
+ min_snap = log10(min_snap);
+ if (min_snap < 0)
+ min_snap = (int)min_snap;
else
- new_snap = (int)new_snap + 1;
- new_snap = pow(10, new_snap);
+ min_snap = (int)min_snap + 1;
+ min_snap = pow(10, min_snap);
- if (snap < new_snap) {
- G_important_message("%s", separator);
- G_warning(_("Errors were encountered during the import"));
- G_important_message(_("Try to import again, snapping with at least %g: 'snap=%g'"), new_snap, new_snap);
+ /* single precision ULP */
+ max_snap = log2(xmax) - 23;
+ max_snap = pow(2, max_snap);
+ /* human readable */
+ max_snap = log10(max_snap);
+ if (max_snap < 0)
+ max_snap = (int)max_snap;
+ else
+ max_snap = (int)max_snap + 1;
+ max_snap = pow(10, max_snap);
+
+ G_important_message("%s", separator);
+ G_warning(_("Errors were encountered during the import"));
+
+ if (snap < min_snap) {
+ G_important_message(_("Try to import again, snapping with at least %g: 'snap=%g'"), min_snap, min_snap);
}
+ else if (snap < max_snap) {
+ min_snap = snap * 10;
+ G_important_message(_("Try to import again, snapping with %g: 'snap=%g'"), min_snap, min_snap);
+ }
+ /* else assume manual cleaning is required */
}
}
Modified: grass/trunk/vector/v.in.ogr/v.in.ogr.html
===================================================================
--- grass/trunk/vector/v.in.ogr/v.in.ogr.html 2013-04-19 13:48:40 UTC (rev 55919)
+++ grass/trunk/vector/v.in.ogr/v.in.ogr.html 2013-04-19 17:00:28 UTC (rev 55920)
@@ -21,9 +21,16 @@
region settings as the spatial bounds
(see <em><a href="g.region.html">g.region</a></em>).
-<p>
+<h3>Topology cleaning</h3>
Topology cleaning on areas is automatically performed, but may fail in
-special cases (then use <em><a href="v.clean.html">v.clean</a></em>).
+special cases. In these cases, a <b>snap</b> threshold value is
+estimated from the imported vector data and printed out at the end. The
+vector data can then be imported again with the suggested <b>snap</b>
+threshold value which is incremented by powers of 10 until either an
+estimated upper limit for the threshold value is reached or the topology
+cleaning on areas was successful. In some cases, manual cleaning might
+be required or areas are truly overlapping, e.g. buffers created with
+non-topological software.
<p>
The <b>min_area</b> threshold value is being specified as area size in
More information about the grass-commit
mailing list