diff --git a/src/Lib/Polygon/chop-bin.cxx b/src/Lib/Polygon/chop-bin.cxx index d28d812e..9f93870a 100644 --- a/src/Lib/Polygon/chop-bin.cxx +++ b/src/Lib/Polygon/chop-bin.cxx @@ -229,7 +229,9 @@ void tgChopNormalPolygon( const string& path, AreaType area, // determine horizontal clip line SGBucket b_clip = sgBucketOffset(min.x(), min.y(), 0, mid); double clip_line = b_clip.get_center_lat(); - if ( (clip_line >= -89.0) && (clip_line < 89.0) ) { + if ( (clip_line >= -90.0 + SG_HALF_BUCKET_SPAN) + && (clip_line < 90.0 - SG_HALF_BUCKET_SPAN) ) + { clip_line += SG_HALF_BUCKET_SPAN; } else if ( clip_line < -89.0 ) { clip_line = -89.0; diff --git a/src/Lib/Polygon/names.hxx b/src/Lib/Polygon/names.hxx index 870872e0..ec479df2 100644 --- a/src/Lib/Polygon/names.hxx +++ b/src/Lib/Polygon/names.hxx @@ -38,6 +38,7 @@ SG_USING_STD(string); enum AreaType { SomeSortOfArea = 0, HoleArea, // Leave area completely empty + AirportArea, FreewayArea, RoadArea, RailroadArea, @@ -53,7 +54,6 @@ enum AreaType { GlacierArea, // Any solid ice/snow PackIceArea, // Water with ice packs OceanArea, - AirportArea, UrbanArea, // Densely-populated city or large town TownArea, // Small town or village FloodLandArea, // Land subject to flooding diff --git a/src/Lib/Polygon/polygon.cxx b/src/Lib/Polygon/polygon.cxx index 4a071974..33488bda 100644 --- a/src/Lib/Polygon/polygon.cxx +++ b/src/Lib/Polygon/polygon.cxx @@ -498,14 +498,18 @@ TGPolygon tgPolygonSplitLongEdges( const TGPolygon &poly, double max_len ) { for ( j = 0; j < poly.contour_size(i) - 1; ++j ) { p0 = poly.get_pt( i, j ); p1 = poly.get_pt( i, j + 1 ); + // SG_LOG(SG_GENERAL, SG_DEBUG, " " << p0 << " - " << p1); - double az1, az2, s; - geo_inverse_wgs_84( 0.0, - p0.y(), p0.x(), p1.y(), p1.x(), - &az1, &az2, &s ); - SG_LOG(SG_GENERAL, SG_DEBUG, "distance = " << s); + if ( fabs(p0.y()) < (90.0 - SG_EPSILON) + || fabs(p1.y()) < (90.0 - SG_EPSILON) ) + { + double az1, az2, s; + geo_inverse_wgs_84( 0.0, + p0.y(), p0.x(), p1.y(), p1.x(), + &az1, &az2, &s ); + SG_LOG(SG_GENERAL, SG_DEBUG, "distance = " << s); - if ( s > max_len ) { + if ( s > max_len ) { int segments = (int)(s / max_len) + 1; SG_LOG(SG_GENERAL, SG_DEBUG, "segments = " << segments); @@ -517,9 +521,13 @@ TGPolygon tgPolygonSplitLongEdges( const TGPolygon &poly, double max_len ) { SG_LOG(SG_GENERAL, SG_DEBUG, tmp); result.add_node( i, tmp ); } - } else { + } else { SG_LOG(SG_GENERAL, SG_DEBUG, p0); result.add_node( i, p0 ); + } + } else { + SG_LOG(SG_GENERAL, SG_DEBUG, p0); + result.add_node( i, p0 ); } // end of segment is beginning of next segment