0

We're trying to use CoreRouter.calculateRoute(List<GeoCoordinate>, RouteOptions, Listener) method as documented here to calculate a route from a list of points. The list of points is from a GPX file exported from Google map.

Please check the origin route on google map here origin route (https://www.google.com/maps/d/u/0/edit?mid=1jlwfml-kg0QLW7vHB4aMw6pDjvTevHU&usp=sharing)

The result we got in HERE MAP is like this: HERE Map result

We compared the route points one by one between Google Map and HERE Map, and found that the point does not sit perfectly on a road on Here map as it does on Google map. Please check the comparison here: Comparison

The list of points:

<trkpt lat="37.3665039" lon="-121.9179512">
        <name>TP0</name>
      </trkpt>
      <trkpt lat="37.3663126" lon="-121.9178105">
        <name>TP1</name>
      </trkpt>
      <trkpt lat="37.3660126" lon="-121.9175858">
        <name>TP2</name>
      </trkpt>
      <trkpt lat="37.3657063" lon="-121.9173579">
        <name>TP3</name>
      </trkpt>
      <trkpt lat="37.3653819" lon="-121.9171101">
        <name>TP4</name>
      </trkpt>
      <trkpt lat="37.3652228" lon="-121.916993">
        <name>TP5</name>
      </trkpt>
      <trkpt lat="37.3653404" lon="-121.9167218">
        <name>TP6</name>
      </trkpt>
      <trkpt lat="37.3657065" lon="-121.9159425">
        <name>TP7</name>
      </trkpt>
      <trkpt lat="37.3659858" lon="-121.9153481">
        <name>TP8</name>
      </trkpt>
      <trkpt lat="37.366333" lon="-121.9146232">
        <name>TP9</name>
      </trkpt>
      <trkpt lat="37.3663824" lon="-121.9145151">
        <name>TP10</name>
      </trkpt>
      <trkpt lat="37.3666919" lon="-121.9139078">
        <name>TP11</name>
      </trkpt>
      <trkpt lat="37.366698" lon="-121.9137683">
        <name>TP12</name>
      </trkpt>
      <trkpt lat="37.3666968" lon="-121.913702">
        <name>TP13</name>
      </trkpt>
      <trkpt lat="37.3666941" lon="-121.9136539">
        <name>TP14</name>
      </trkpt>
      <trkpt lat="37.3666879" lon="-121.9136134">
        <name>TP15</name>
      </trkpt>
      <trkpt lat="37.3666756" lon="-121.913573">
        <name>TP16</name>
      </trkpt>
      <trkpt lat="37.3666331" lon="-121.913451">
        <name>TP17</name>
      </trkpt>
      <trkpt lat="37.3664775" lon="-121.9133349">
        <name>TP18</name>
      </trkpt>
      <trkpt lat="37.3659049" lon="-121.9129044">
        <name>TP19</name>
      </trkpt>
      <trkpt lat="37.3658757" lon="-121.9129628">
        <name>TP20</name>
      </trkpt>

Is there a way to calculate the route more accurate using CoreRouter.calculateRoute(List<GeoCoordinate>, RouteOptions, Listener) method?

The code in our project is like below:

 val TESTING_WAYPOINTS = arrayOf(
            GeoCoordinate(37.3665039, -121.9179512),
            GeoCoordinate(37.3663126, -121.9178105),
            GeoCoordinate(37.3660126, -121.9175858),
            GeoCoordinate(37.3657063, -121.9173579),
            GeoCoordinate(37.3653819, -121.9171101),
            GeoCoordinate(37.3652228, -121.916993),
            GeoCoordinate(37.3653404, -121.9167218),
            GeoCoordinate(37.3657065, -121.9159425),
            GeoCoordinate(37.3659858, -121.9153481),
            GeoCoordinate(37.366333, -121.9146232),
            GeoCoordinate(37.3663824, -121.9145151),
            GeoCoordinate(37.3666919, -121.9139078),
            GeoCoordinate(37.366698, -121.9137683),
            GeoCoordinate(37.3666968, -121.913702),
            GeoCoordinate(37.3666941, -121.9136539),
            GeoCoordinate(37.3666879, -121.9136134),
            GeoCoordinate(37.3666756, -121.913573),
            GeoCoordinate(37.3666331, -121.913451),
            GeoCoordinate(37.3664775, -121.9133349),
            GeoCoordinate(37.3659049, -121.9129044),
            GeoCoordinate(37.366377, -121.9137508), 
            GeoCoordinate(37.3658757, -121.9129628),
        )

    // set route options
    val mRouteOptions = RouteOptions().apply {
        this.transportMode = RouteOptions.TransportMode.CAR
        this.routeCount = navigationOptions.routeCount
        this.routeType = navigationOptions.routeType
        setTunnelsAllowed(navigationOptions.tunnelAllowed)
        setTollRoadsAllowed(navigationOptions.tollAllowed)
        setHighwaysAllowed(navigationOptions.highwaysAllowed)
        setFerriesAllowed(navigationOptions.boatsAllowed)
        setDirtRoadsAllowed(navigationOptions.dirtRoadsAllowed)
        this.locale = Locale("en")
    })

    fun calculateRoute(listener: CoreRouter.Listener) {
        mCoreRouterListener = listener
        // force using the preset waypoints
        val presetWaypoints = TESTING_WAYPOINTS
        for (p in presetWaypoints) {
            Log.d(TAG, "[TRACK]: ${p.latitude} ${p.longitude}")
            mRoutePoints.add(p)
        }

        mCoreRouter.calculateRoute(mRoutePoints, mRouteOptions, this)
    }
Steve Yao
  • 1
  • 1
  • Could you please share the code snippet. We need to check what all things are getting passed to CoreRouter.calculateRoute(List, RouteOptions, Listener) –  Jul 27 '22 at 04:51
  • @HEREDeveloperSupport, I added the code snippet in the question. Could you please take a look? Thank you. – Steve Yao Jul 28 '22 at 16:06

1 Answers1

0

As we see lot of options are used in the request. So the router will try to find the best optimized route based on the options provided in the request. If you want to compare the requests with any other service, just use the plain requests without any restrictions in both services.

// set route options
val mRouteOptions = RouteOptions().apply {
    this.transportMode = RouteOptions.TransportMode.CAR
    this.routeCount = navigationOptions.routeCount
    this.routeType = navigationOptions.routeType
    setTunnelsAllowed(navigationOptions.tunnelAllowed)
    setTollRoadsAllowed(navigationOptions.tollAllowed)
    setHighwaysAllowed(navigationOptions.highwaysAllowed)
    setFerriesAllowed(navigationOptions.boatsAllowed)
    setDirtRoadsAllowed(navigationOptions.dirtRoadsAllowed)
    this.locale = Locale("en")
})
General Grievance
  • 4,555
  • 31
  • 31
  • 45
  • If your account is being shared by multiple users at your company, please make sure they are **all** informed on how our site works. On multiple occasions, this account has submitted answers that have had improper formatting that could have easily been fixed, and others the answers have been fine. – General Grievance Aug 08 '22 at 14:30