Skip to content

Commit

Permalink
PB-800 : simplify GPXs geometry
Browse files Browse the repository at this point in the history
so that we diminish, or totally avoid, the coastal paradox we've encounter so far with GPX that contains points close together, following a steep mountain (with the GPS error, that would mean it would jump back and forth on the hill, creating fake height distance, and thus giving a very VERY poor hiking time estimation)
  • Loading branch information
pakb committed Aug 5, 2024
1 parent 1428f4f commit 09bd3f8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/utils/gpxUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ export function parseGpx(gpxData, projection) {
featureProjection: projection.epsg,
})
features.forEach((feature) => {
feature.setStyle(gpxStyles[feature.getGeometry().getType()])
const geom = feature.getGeometry()
// PB-800 : to avoid a coastline paradox we simplify the geometry of GPXs
// 12.5 meters is what was used in the old viewer, see https://github.com/geoadmin/mf-geoadmin3/blob/ce24a27b0ca8192a0f78f7b8cc07f4e231031304/src/components/GeomUtilsService.js#L207
feature.setGeometry(geom.simplify(12.5))
feature.setStyle(gpxStyles[geom.getType()])
})
return features
}
Expand Down

0 comments on commit 09bd3f8

Please sign in to comment.