Skip to main content
#BuiltWithHERE 4 min read

Developer Community Insights: HERE SDK

Community SDK

As developers continue to explore the capabilities of the HERE SDK, the Slack Developer Community has become a vibrant space for sharing knowledge, solving challenges, and exchanging tips. With over 150+ questions posted this year and an average response time of 15 hours; this blog post will spotlight some of the most frequently asked questions by developers actively building apps with the HERE SDK. Many of these queries have led to insights that are not readily available in the official documentation—making this community a goldmine for anyone actively developing with HERE SDK. 

Below are the top questions raised by developers, along with practical solutions shared by the community. If you are using HERE SDK, these tips could save you time and effort!

1.   How do you get accurate speed limits for Truck routing with HERE SDK?
For truck routing, effectiveSpeedLimitInMetersPerSecond is always recommended. You can find more information in this guide (Note: this is for Android, but the concept applies to and iOS as well).

2.Can someone please explain offline maps? How do I detect which regions I have downloaded and how much disk space is being used and how big an update will be?
You can retrieve the installed regions and calculate the difference from the already downloaded size to get the remaining storage usage. Here is how you can do it for Android with Java:

Copied
           // Map Downloader initialization
      MapDownloader.fromEngineAsync(sdkNativeEngine, mapDownloader -> {
          this.mapDownloader = mapDownloader;
    });
    // getDownloadedRegions
        public List<InstalledRegion> getInstalledRegionsList() {
   if (mapDownloader == null) {
 String message = "MapDownloader instance not ready. Try again.";
 snackbar.setText(message).show();
 return installedRegionList;
    }
    // Get the list of installed regions
try {
  installedRegionList = mapDownloader.getInstalledRegions();
  } catch (MapLoaderException e) {
   e.printStackTrace();
 }
return installedRegionList;
    }
    // Calculate the current storage usage
    public long calculateStorageUsage() {
List<InstalledRegion> installedRegions = getInstalledRegionsList();
long currentStorageUsage = installedRegions.stream().mapToLong(InstalledRegion::getMapSize).sum();
return currentStorageUsage;
    } 
  

3.How do I create a basic speedlimitwatcher app with HERE SDK?
To create an app that notifies on the current speed limits while driving without following a concrete route, you can do the following:

I would start on the "Navigation" Example App. This example already has SpeedLimits and Warnings implemented. Just strip out the Navigation parts and change the VisualNavigator to "Tracking" mode. Then you have a basic "speedlimitwatcher app."

4.Does the tracing function in the HERE Navigator SDK work like the Premier SDK, downloading road segments to reduce time lag and data use by avoiding continuous server queries?
Yes, this is now possible with the SegmentDataLoader. This loader allows to gather certain map data like SegmentSpeedLimit. Unnecessary queries can only be avoided when using offline maps.

5. I am creating map markers for different addresses with the same coordinates (e.g., stores in a mall), but only the top marker is displayed. How can I avoid overlapping markers and show them all on Flutter SDK?
You can adjust the geo-coordinates of markers that are close to each other. Here's the approach you can use:

Copied
        var radius = 0.00002; // Radius in degrees, adjust as needed
var angleIncrement = 360 / (AppStaticRouteValues.routeWayPointsObjects.length - 1); // Angle for spacing
var angle = 0.0; // Initialize angle
for (int i = 0; i < AppStaticRouteValues.routeWayPointsObjects.length; i++) {
  GeoCoordinates currentCoordinates = AppStaticRouteValues.routeWayPointsObjects[i].geoCoordinates!;
  bool isNearAnotherRoute = false;
  for (int j = 0; j < AppStaticRouteValues.routeWayPointsObjects.length; j++) {
    if (i != j) { // Skip comparing the same point
      GeoCoordinates otherCoordinates = AppStaticRouteValues.routeWayPointsObjects[j].geoCoordinates!;
      double distance = Geolocator.distanceBetween(
        currentCoordinates.latitude, currentCoordinates.longitude,
        otherCoordinates.latitude, otherCoordinates.longitude,
      );
      if (distance <= 100) { // If within 100 meters
        double newLat = 0.0;
        double newLng = 0.0;
        if (currentCoordinates == otherCoordinates) {
          // Adjust overlapping markers
          newLat = otherCoordinates.latitude + radius * math.cos(angle * math.pi / 180);
          newLng = otherCoordinates.longitude + radius * math.sin(angle * math.pi / 180);
        } else {
          newLat = currentCoordinates.latitude;
          newLng = currentCoordinates.longitude;
        }
        GeoCoordinates adjustedCoordinates = GeoCoordinates(newLat, newLng);
        _listNearRouteMarkers.add(MapMarker(adjustedCoordinates, AppStaticMapValues.endRouteMapImage(i)));
        angle += angleIncrement; // Adjust the angle for next marker
        isNearAnotherRoute = true;
        break; // No need to check further
      }
    }
  }
}
  

This approach spaces out markers in a circular pattern around the original coordinates if they are too close. You can also group markers into a cluster if needed to avoid clutter.

Note: We don’t recommend this practice. You can rather use MapMarkerCluster, more information here

6.What is the most efficient way to find the user's current position in the Route Polyline when a deviation occurs in turn-by-turn navigation with Flutter SDK?
You can use the method route.geometry.getNearestIndexTo(routeDeviation.lastLocationOnRoute) to find the index of the closest GeoCoordinate in the route polyline. This method calculates the distance between each point in the polyline and the last location on the route during a deviation. If the information is only needed during rerouting, this method should work efficiently without performance issues.

Note: Since deviation events occur frequently, it's recommended to wait for around three events before determining possible actions. Application should need to execute getNearestIndexTo() only once before deciding to go back to the route.

7.Is it possible to make the route line wider in navigation using the Visual Navigator? I found how to change the color but not the width.
Yes, it is now possible to modify the route line width in navigation using the Visual Navigator by utilizing the visualNavigator.setMeasureDependentWidth(..) method. This method functions similarly to how route preview adjustments are made, as demonstrated in the guide.

8.How can I calculate the distance in meters to each waypoint when building a route with several waypoints with Flutter SDK?
When you have the coordinates, then we would suggest to use coordinates.distanceTo() between all points that are between the two waypoints in question. This can be costly, but we use a similar algorithm in this example 

9. Is it possible to find out the TimeZone Offset of the destination point using GeoCoordinates after building a route in the HERE SDK for Flutter?
Yes, you can access the TimeZone Offset using the LocationTime class. To retrieve the arrival time for the destination, you can get it from the last section of the route. Here’s how you can do it: 

Copied
            int lastSectionIndex = route.getSections().size() - 1;
    Section lastSection = route.getSections().get(lastSectionIndex);
    LocationTime locationTime = lastSection.getArrivalLocationTime();
  

For more information, you can refer to the HERE SDK for iOS (Navigate Edition) documentation. If your question is targeting ETA calculations using the offsets, do check out example shown here

10.Does the HERE SDK for Android have a built-in voice assistant for navigation mode, or how can voice guidance be implemented?
The HERE SDK does not have a built-in text-to-speech (TTS) engine. Instead, it provides string messages for navigation, and it is up to the developer to choose which TTS engine to use. The simplest and free option is to use the Android TextToSpeech API.

11.How can I update the distance to a speed camera in the Android Navigate SDK since the SafetyCameraWarningListener only alerts once?
You can use the route progress data received after the initial warning to calculate the distance travelled since the warning was issued. By subtracting this distance from the total distance to arrival, you can determine the remaining distance to the camera.

12.What are the limitations and recommendations for using AvoidanceOptions in the HERE SDK?
When using AvoidanceOptions, here are the key limitations to keep in mind:

  • Maximum count of polygons and corridors: 20
  • Maximum total count of bounding boxes, polygons, and corridors (including exceptions): 250
  • Minimum count of coordinates in one polygon: 3
  • Minimum count of coordinates in any single corridor: 2
  • Maximum count of coordinates in one polygon or corridor: 100
  • Polygons are automatically closed; there is no need to duplicate the first point as the last one.
  • Self-intersecting polygons are not supported.

For further details, you can refer to the Routing API v8 documentation.

13. Is there a way to scale the displayed safety camera warning icons in the HERE style editor, similar to how other icons are scaled using properties like Traffic.Icon.Size?
Yes, you can scale the safety camera icons by using the property SafetyCamera.Icon.Size. If you are modifying definitions manually, please note that you do so at your own risk. To find this in the base style, you can follow this guide: HERE Developer Documentation. After retrieving the base style, you can print the style to see the definitions by using the following code:

Copied
        var provider = map.getBaseLayer().getProvider();
var style = provider.getStyle();
console.log(style.getConfig());
  

This will help you locate the necessary definitions for the safety camera icons.
 
14. Is there a way of finding weather conditions with Flutter SDK?
The HERE SDK does not currently wrap the weather API, but you can access it via REST. You can find more information in the HERE Weather API documentation.

15. How can we determine if the newly calculated route using the HERE Android Navigate SDK differs from a previously stored polyline, and how long can we expect the saved route to persist?
You can check if two polylines are the same using their geometry by calling mapPolyline.getGeometry().equals(mapPolyline2.getGeometry()). Additionally, it is recommended to save the route itself instead of just the polyline. This allows you to use the importRoute method to import the exact same route, avoiding the overhead of comparing polylines. 
Regarding the persistence of saved routes, they can remain valid unless the customer’s contracts specifically prohibit it. However, specifying a departure time or arrival time in the past will invalidate the route. To maintain the route for a longer duration, it’s advisable to save the Polyline object (not the shape) and use the geocoordinates within it during the import process.

Note: Traffic will highly influence the shape of a route. This can be turned off.

16. How can I create a custom location indicator from a PNG image using the HERE SDK for Flutter? (considering HERE requires both .obj and .png files)
To create a custom location indicator in the HERE SDK for Flutter, you can use the following steps:

Create the .obj File: You can use a simple utility to generate the required .obj file from your PNG image. One example of a basic .obj file for a flat 3D object is:

Copied
            # A 2 x 2 square, centered in 0 0 0
    v -1 1 0.1
    v 1 1 0.1
    v -1 -1 0.1
    v 1 -1 0.1
    # 4 vertices
    vt 0 1
    vt 1 1
    vt 0 0
    vt 1 0
    # 4 texture vertices
    vn 0 0 1
    vn 0 0 1
    vn 0 0 1
    vn 0 0 1
    # 4 vertex normals
    f 1/1/1 3/3/3 2/2/2
    f 3/3/3 4/4/4 2/2/2
  

Place Files in Assets Directory: Save the generated .obj file (e.g., flat_3d_object.obj) and your PNG images (e.g., position_indicator_pedestrian.png, position_indicator_navigation.png, etc.) in your app's assets directory.

Integrate the Custom Location Indicator: Use the following Kotlin code to set up your custom location indicator:

Copied
            private const val PATH_FLAT_3D_OBJECT = "flat_3d_object.obj"
    private const val POSITION_PEDESTRIAN = "position_indicator_pedestrian.png"
    private const val POSITION_NAVIGATION_LIGHT = "position_indicator_navigation.png"
    private const val POSITION_NAVIGATION_DARK = "position_indicator_navigation_dark.png"
    private const val PEDESTRIAN_SCALE = 20.0
    private const val NAVIGATION_SCALE = 33.0
    private val locationIndicator = LocationIndicator().apply {
isAccuracyVisualized = false
locationIndicatorStyle = LocationIndicator.IndicatorStyle.PEDESTRIAN
val pedestrianModel = MapMarker3DModel(PATH_FLAT_3D_OBJECT, POSITION_PEDESTRIAN)
setMarker3dModel(pedestrianModel, PEDESTRIAN_SCALE, LocationIndicator.MarkerType.PEDESTRIAN)
setMarker3dModel(pedestrianModel, PEDESTRIAN_SCALE, LocationIndicator.MarkerType.PEDESTRIAN_INACTIVE)
val navigationModelLight = MapMarker3DModel(PATH_FLAT_3D_OBJECT, POSITION_NAVIGATION_LIGHT)
val navigationModelDark = MapMarker3DModel(PATH_FLAT_3D_OBJECT, POSITION_NAVIGATION_DARK
setMarker3dModel(navigationModelLight, NAVIGATION_SCALE, LocationIndicator.MarkerType.NAVIGATION)
setMarker3dModel(navigationModelDark, NAVIGATION_SCALE, LocationIndicator.MarkerType.NAVIGATION_INACTIVE)
    }
    // Add the location indicator to the map
    mapView.addLifecycleListener(locationIndicator)
    // Update the location indicator position
    locationIndicator.updateLocation(location)
  

This setup allows you to customize the appearance of the location indicator with your PNG images while ensuring it interacts properly with the map. Take a look at this example which shows how to use custom images for the standard marker. If you really want to have a flat (non-3D) marker, then refer to guide which also shows the same .obj definition.

Conclusion:
The Slack Developer Community has played a key role in solving HERE SDK-related challenges, especially with topics that aren't always documented. Whether you are fine-tuning truck routing, building custom location indicators, or handling overlapping markers, these real-world examples and shared insights offer valuable guidance.

If you are working with the HERE SDK, be sure to join the conversation, ask your own questions, and help others. The community is growing, and the shared knowledge is continuously enriching the developer experience!

Piyush Pelagade

Piyush Pelagade

Have your say

Sign up for our newsletter

Why sign up:

  • Latest offers and discounts
  • Tailored content delivered weekly
  • Exclusive events
  • One click to unsubscribe