Determine SegmentId from lat/lng

  here-api, javascript

Is there a way to retrieve the segmentID from a specific position (lat/lng)? I need the segmentID for the routing API in avoid[segments]

I tried reverse geocoding, but I could not find any information to obtain the segmentID.

this.service.reverseGeocode(
  {
    at: '37.56042131221306,139.9987190961508',
    spans: 'segmentId',
    locationattributes: 'segmentId'
  },
  (result) => {
    console.log(result.items[0])
  },
  this.onError
)

Result:

  {
  title: "..."
  access: [..]
  address: {..}
  distance: 31
  houseNumberType: "PA"
  id: "here:xs1:pointaddress:10039667:CgcIESDz4uQEEAEaATI"
  position: {lat: 37.56069, lng: 139.99863}
  resultType: "houseNumber"
  title: "..."
}

But using spans or locationattributes does not return the segmentID. The call returns an ID like here:xs1:streetsection:1000002351972, but I cannot use that for routing in avoid[segments]

Thank you in advance

Source: Ask Javascript Questions

LEAVE A COMMENT