From 49128edff8d45979cbe6ae3c9e4d060baaaa3f16 Mon Sep 17 00:00:00 2001 From: Mike Barry Date: Tue, 7 May 2024 06:10:23 -0400 Subject: [PATCH 1/2] log more details on feature processing errors --- .../planetiler/FeatureCollector.java | 18 +++++++++--------- .../planetiler/reader/SimpleFeature.java | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/planetiler-core/src/main/java/com/onthegomap/planetiler/FeatureCollector.java b/planetiler-core/src/main/java/com/onthegomap/planetiler/FeatureCollector.java index a136bd8e33..cd60987021 100644 --- a/planetiler-core/src/main/java/com/onthegomap/planetiler/FeatureCollector.java +++ b/planetiler-core/src/main/java/com/onthegomap/planetiler/FeatureCollector.java @@ -80,7 +80,7 @@ public Feature point(String layer) { } return geometry(layer, source.worldGeometry()); } catch (GeometryException e) { - e.log(stats, "feature_point", "Error getting point geometry for " + source.id()); + e.log(stats, "feature_point", "Error getting point geometry for " + source); return new Feature(layer, EMPTY_GEOM, source.id()); } } @@ -100,7 +100,7 @@ public Feature line(String layer) { try { return geometry(layer, source.line()); } catch (GeometryException e) { - e.log(stats, "feature_line", "Error constructing line for " + source.id()); + e.log(stats, "feature_line", "Error constructing line for " + source); return new Feature(layer, EMPTY_GEOM, source.id()); } } @@ -120,7 +120,7 @@ public Feature polygon(String layer) { try { return geometry(layer, source.polygon()); } catch (GeometryException e) { - e.log(stats, "feature_polygon", "Error constructing polygon for " + source.id()); + e.log(stats, "feature_polygon", "Error constructing polygon for " + source); return new Feature(layer, EMPTY_GEOM, source.id()); } } @@ -135,7 +135,7 @@ public Feature centroid(String layer) { try { return geometry(layer, source.centroid()); } catch (GeometryException e) { - e.log(stats, "feature_centroid", "Error getting centroid for " + source.id()); + e.log(stats, "feature_centroid", "Error getting centroid for " + source); return new Feature(layer, EMPTY_GEOM, source.id()); } } @@ -152,7 +152,7 @@ public Feature centroidIfConvex(String layer) { try { return geometry(layer, source.centroidIfConvex()); } catch (GeometryException e) { - e.log(stats, "feature_centroid_if_convex", "Error constructing centroid if convex for " + source.id()); + e.log(stats, "feature_centroid_if_convex", "Error constructing centroid if convex for " + source); return new Feature(layer, EMPTY_GEOM, source.id()); } } @@ -168,7 +168,7 @@ public Feature pointOnSurface(String layer) { try { return geometry(layer, source.pointOnSurface()); } catch (GeometryException e) { - e.log(stats, "feature_point_on_surface", "Error constructing point on surface for " + source.id()); + e.log(stats, "feature_point_on_surface", "Error constructing point on surface for " + source); return new Feature(layer, EMPTY_GEOM, source.id()); } } @@ -190,7 +190,7 @@ public Feature innermostPoint(String layer, double tolerance) { try { return geometry(layer, source.innermostPoint(tolerance)); } catch (GeometryException e) { - e.log(stats, "feature_innermost_point", "Error constructing innermost point for " + source.id()); + e.log(stats, "feature_innermost_point", "Error constructing innermost point for " + source); return new Feature(layer, EMPTY_GEOM, source.id()); } } @@ -205,7 +205,7 @@ public int getMinZoomForPixelSize(double pixelSize) { try { return GeoUtils.minZoomForPixelSize(source.size(), pixelSize); } catch (GeometryException e) { - e.log(stats, "min_zoom_for_size_failure", "Error getting min zoom for size from geometry " + source.id()); + e.log(stats, "min_zoom_for_size_failure", "Error getting min zoom for size from geometry " + source); return config.maxzoom(); } } @@ -217,7 +217,7 @@ public double getPixelSizeAtZoom(int zoom) { return source.size() * (256 << zoom); } catch (GeometryException e) { e.log(stats, "source_feature_pixel_size_at_zoom_failure", - "Error getting source feature pixel size at zoom from geometry " + source.id()); + "Error getting source feature pixel size at zoom from geometry " + source); return 0; } } diff --git a/planetiler-core/src/main/java/com/onthegomap/planetiler/reader/SimpleFeature.java b/planetiler-core/src/main/java/com/onthegomap/planetiler/reader/SimpleFeature.java index cc7eb32137..d147b2c676 100644 --- a/planetiler-core/src/main/java/com/onthegomap/planetiler/reader/SimpleFeature.java +++ b/planetiler-core/src/main/java/com/onthegomap/planetiler/reader/SimpleFeature.java @@ -226,8 +226,8 @@ public int hashCode() { @Override public String toString() { - return "SimpleFeature[" + - "geometry type=" + latLonGeometry().getGeometryType() + ", " + + return "Feature[source=" + getSource() + ", source layer=" + getSourceLayer() + + "id=" + id() + ", geometry type=" + latLonGeometry().getGeometryType() + ", " + "tags=" + tags + ']'; } } From 4d2df2a4e9ac87dbd52219281247ce9506f6342c Mon Sep 17 00:00:00 2001 From: Mike Barry Date: Tue, 7 May 2024 06:20:09 -0400 Subject: [PATCH 2/2] fix toStrings --- .../com/onthegomap/planetiler/reader/SimpleFeature.java | 8 +++++--- .../com/onthegomap/planetiler/reader/SourceFeature.java | 8 ++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/planetiler-core/src/main/java/com/onthegomap/planetiler/reader/SimpleFeature.java b/planetiler-core/src/main/java/com/onthegomap/planetiler/reader/SimpleFeature.java index d147b2c676..995886933f 100644 --- a/planetiler-core/src/main/java/com/onthegomap/planetiler/reader/SimpleFeature.java +++ b/planetiler-core/src/main/java/com/onthegomap/planetiler/reader/SimpleFeature.java @@ -226,8 +226,10 @@ public int hashCode() { @Override public String toString() { - return "Feature[source=" + getSource() + ", source layer=" + getSourceLayer() + - "id=" + id() + ", geometry type=" + latLonGeometry().getGeometryType() + ", " + - "tags=" + tags + ']'; + return "Feature[source=" + getSource() + + ", source layer=" + getSourceLayer() + + ", id=" + id() + + ", geometry type=" + latLonGeometry().getGeometryType() + + ", tags=" + tags + ']'; } } diff --git a/planetiler-core/src/main/java/com/onthegomap/planetiler/reader/SourceFeature.java b/planetiler-core/src/main/java/com/onthegomap/planetiler/reader/SourceFeature.java index bff96599f9..478bedae9c 100644 --- a/planetiler-core/src/main/java/com/onthegomap/planetiler/reader/SourceFeature.java +++ b/planetiler-core/src/main/java/com/onthegomap/planetiler/reader/SourceFeature.java @@ -325,4 +325,12 @@ public boolean hasRelationInfo() { return relationInfos != null && !relationInfos.isEmpty(); } + @Override + public String toString() { + return "Feature[source=" + getSource() + + ", source layer=" + getSourceLayer() + + ", id=" + id() + + ", tags=" + tags + ']'; + } + }