[GRASS-SVN] r62658 - grass/branches/releasebranch_7_0/vector/v.in.ogr
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Nov 7 12:56:06 PST 2014
Author: martinl
Date: 2014-11-07 12:56:06 -0800 (Fri, 07 Nov 2014)
New Revision: 62658
Modified:
grass/branches/releasebranch_7_0/vector/v.in.ogr/geom.c
Log:
v.in.ogr: skip polygons with no rings (do not fail)
(merge r62657 from trunk)
Modified: grass/branches/releasebranch_7_0/vector/v.in.ogr/geom.c
===================================================================
--- grass/branches/releasebranch_7_0/vector/v.in.ogr/geom.c 2014-11-07 20:45:33 UTC (rev 62657)
+++ grass/branches/releasebranch_7_0/vector/v.in.ogr/geom.c 2014-11-07 20:56:06 UTC (rev 62658)
@@ -72,6 +72,10 @@
/* Area */
hRing = OGR_G_GetGeometryRef(hGeom, 0);
+ if (hRing == NULL) {
+ G_warning(_("Skipping empty geometry feature %d"), cat);
+ return 0;
+ }
np = OGR_G_GetPointCount(hRing);
Vect_reset_line(Points);
for (j = 0; j < np; j++) {
@@ -254,7 +258,7 @@
if (eType == wkbPoint) {
if ((np = OGR_G_GetPointCount(hGeom)) == 0) {
- G_warning(_("Skipping empty geometry feature"));
+ G_warning(_("Skipping empty geometry feature %d"), cat);
return 0;
}
@@ -268,7 +272,7 @@
}
else if (eType == wkbLineString) {
if ((np = OGR_G_GetPointCount(hGeom)) == 0) {
- G_warning(_("Skipping empty geometry feature"));
+ G_warning(_("Skipping empty geometry feature %d"), cat);
return 0;
}
@@ -296,8 +300,8 @@
/* Area */
hRing = OGR_G_GetGeometryRef(hGeom, 0);
- if ((np = OGR_G_GetPointCount(hRing)) == 0) {
- G_warning(_("Skipping empty geometry feature"));
+ if (hRing == NULL || (np = OGR_G_GetPointCount(hRing)) == 0) {
+ G_warning(_("Skipping empty geometry feature %d"), cat);
return 0;
}
@@ -319,7 +323,7 @@
size = G_area_of_polygon(Points->x, Points->y, Points->n_points);
if (size < min_area) {
- G_debug(2, "\tArea size [%.1e], area not imported", size);
+ G_debug(2, "\tArea size %.1e, area not imported", size);
return 0;
}
@@ -344,7 +348,7 @@
hRing = OGR_G_GetGeometryRef(hGeom, i);
if ((np = OGR_G_GetPointCount(hRing)) == 0) {
- G_warning(_("Skipping empty geometry feature"));
+ G_warning(_("Skipping empty geometry feature %d"), cat);
}
else {
IPoints[valid_isles] = Vect_new_line_struct();
@@ -358,7 +362,7 @@
Vect_line_prune(IPoints[valid_isles]);
if (IPoints[valid_isles]->n_points < 4)
- G_warning(_("Degenerate island ([%d] vertices)"),
+ G_warning(_("Degenerate island (%d vertices)"),
IPoints[i - 1]->n_points);
size =
@@ -366,7 +370,7 @@
IPoints[valid_isles]->y,
IPoints[valid_isles]->n_points);
if (size < min_area) {
- G_debug(2, "\tIsland size [%.1e], island not imported",
+ G_debug(2, "\tIsland size %.1e, island not imported",
size);
}
else {
More information about the grass-commit
mailing list