Skip to content

Instantly share code, notes, and snippets.

@karussell
Created December 17, 2021 07:57
Show Gist options
  • Save karussell/b28d5dbaed9dbb62748499226d7f6463 to your computer and use it in GitHub Desktop.
Save karussell/b28d5dbaed9dbb62748499226d7f6463 to your computer and use it in GitHub Desktop.
diff --git a/src/api/Api.ts b/src/api/Api.ts
index 9a56a8b..010d08a 100644
--- a/src/api/Api.ts
+++ b/src/api/Api.ts
@@ -154,7 +154,7 @@ export class ApiImpl implements Api {
optimize: 'false',
points_encoded: true,
snap_preventions: ['ferry'],
- details: ['road_class', 'road_environment', 'surface', 'max_speed', 'average_speed'],
+ details: ['road_class', 'road_environment', /*'surface',*/ 'max_speed', 'average_speed'],
}
if (args.maxAlternativeRoutes > 1) {
diff --git a/src/pathDetails/PathDetails.tsx b/src/pathDetails/PathDetails.tsx
index 8c48d01..70ec46e 100644
--- a/src/pathDetails/PathDetails.tsx
+++ b/src/pathDetails/PathDetails.tsx
@@ -6,6 +6,7 @@ import { Path } from '@/api/graphhopper'
import Dispatcher from '@/stores/Dispatcher'
import { PathDetailsElevationSelected, PathDetailsHover, PathDetailsRangeSelected } from '@/actions/Actions'
import QueryStore, { Coordinate, QueryPointType } from '@/stores/QueryStore'
+import {Position} from "geojson";
interface PathDetailsProps {
selectedPath: Path
@@ -81,11 +82,13 @@ function onElevationSelected(segments: Coordinate[][]) {
}
function buildPathDetailsData(selectedPath: Path) {
+ let points = selectedPath.points.coordinates.map((pos: Position) =>
+ pos.length == 2 ? [...pos, 0] : pos
+ )
const elevation = createFeatureCollection('Elevation [m]', [
- createFeature(selectedPath.points.coordinates, 'elevation'),
+ createFeature(points, 'elevation'),
])
const pathDetails = Object.entries(selectedPath.details).map(([detailName, details]) => {
- const points = selectedPath.points.coordinates
const features = details.map(([from, to, value = 'Undefined']: [number, number, string | number]) =>
createFeature(points.slice(from, to + 1), value)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment