Skip to content

Commit

Permalink
wip: ignore duplicate points #19
Browse files Browse the repository at this point in the history
  • Loading branch information
robinbourianes-kalisio committed Mar 27, 2023
1 parent f167c69 commit c19bc7b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/elevation.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,13 @@ async function elevation(geojson, query) {
turf_segmentEach(feature, (segment) => {
const [ lon0, lat0 ] = segment.geometry.coordinates[0]
const [ lon1, lat1 ] = segment.geometry.coordinates[1]

// skip null segments
if (lon0 === lon1 && lat0 === lat1) {
debug(`segment ${allSegments.length} ${numPoints} skipped, start point == end point (${lon0},${lat0}) !`)
return
}

const length = turf_length(segment, { units: 'kilometers' }) * 1000

// how many points will we sample on this segment ?
Expand Down

0 comments on commit c19bc7b

Please sign in to comment.