here-android-sdk-examples icon indicating copy to clipboard operation
here-android-sdk-examples copied to clipboard

How to get current speed limit of the road particularly for the Truck?

Open binod-techindustan opened this issue 4 years ago • 12 comments

Now currently we are calculating speed limit using. Please check wether I am implementing it right or not.

private PositioningManager.OnPositionChangedListener mapPositionHandler = new PositioningManager.OnPositionChangedListener() {
        @Override
        public void onPositionUpdated(PositioningManager.LocationMethod method, GeoPosition position,
                                      boolean isMapMatched) {
            Log.e("PostionChanged", "Called");
       if (position.isValid() && position instanceof MatchedGeoPosition) {
            MatchedGeoPosition mgp = (MatchedGeoPosition) geoPosition;
            float currentSpeedLimit=mgp.getRoadElement().getSpeedLimit();
            }

        }

        @Override
        public void onPositionFixChanged(PositioningManager.LocationMethod method,
                                         PositioningManager.LocationStatus status) {
     

        }
    };

binod-techindustan avatar Mar 27 '20 07:03 binod-techindustan

Hi @binod-techindustan That is correct. Note, that you must use TransportMode.TRUCK for route calculation, and then start navigation with that route, then RoadElement will have truck's speed limit.

Also, you can use NavigationManager.SpeedWarningListener API to notify user that speed was exceeded or otherwise.

NazarKacharaba avatar Mar 27 '20 10:03 NazarKacharaba

Yes @NazarKacharaba I am setting TransportMode.TRUCK while creating route.

binod-techindustan avatar Mar 28 '20 20:03 binod-techindustan

@NazarKacharaba the issue is freeways speed limit in US for truck is 55 mph in most case but we are getting 65 mph. The values in android is not similar in iOS app too.

binod-techindustan avatar Mar 30 '20 06:03 binod-techindustan

@binod-techindustan Could you provide coordinates for routes?

NazarKacharaba avatar Mar 30 '20 09:03 NazarKacharaba

@NazarKacharaba one of our user report it. It was in Highway no 80 California, USA

binod-techindustan avatar Mar 30 '20 10:03 binod-techindustan

@binod-techindustan We are looking into this.

NazarKacharaba avatar Apr 01 '20 11:04 NazarKacharaba

Hi @NazarKacharaba I've faced the same issue. I get car speed limits with applied TransportMode.TRUCK. Route waypoints: Lithuania Kaunas - Lithuania Klaipeda

Also multiple pairs of coordinates for the routes: 52.491701, 13.263713 - 52.437601, 13.19663 55.125229, 23.748323 - 55.147642, 23.709234 52.392454, 13.523472 - 52.377956, 13.543050

VladChernetsky avatar Apr 24 '20 07:04 VladChernetsky

@binod-techindustan Speed values on Highway no 80 California, USA is fixed for truck in the latest map update. Please use MapLoader.performMapDataUpdate() to switch to the latest map version.

@VladChernetsky we will take a look at this routes

NazarKacharaba avatar May 29 '20 15:05 NazarKacharaba

@NazarKacharaba where can I call this method. Should I call this method before loading map? Will there be an issue if I we call during map initialisation. So let me know the best place to perform the map updates.

binod-techindustan avatar Jun 08 '20 09:06 binod-techindustan

You can find some instructions here

NazarKacharaba avatar Jun 09 '20 08:06 NazarKacharaba

@NazarKacharaba I have check the instructions. But I am little confused, performing map data updation during navigation, will it cause lag in UI. Should we need to display progress, like updating Map and display the progress till completion?

binod-techindustan avatar Jun 10 '20 12:06 binod-techindustan

You should perform map data update after you initialized MapEngine, before any route calculation or navigation. Check if new update is available using checkForMapDataUpdate method, and then update map calling performMapDataUpdate .

NazarKacharaba avatar Jun 12 '20 07:06 NazarKacharaba