Please, describe the error

Found a bug? Helps us fix it by filling in this form

Skobbler Maps

Mark Levkovskiy
Android-developer

This article is about developing using the mapping technology Skobbler. I’ll talk about the applications of Skobbler and the main advantages of using Skobbler under the Android SDK.

Let’s start with some basic information. In addition to Android support, Skobbler has an SDK for iOS and plug-ins for web browsers. Developers have used Open Street Maps (OSM) as a basis for the Skobbler platform. Then, they optimized some algorithms – like determining the actual speed and detecting traffic lanes.

One of the biggest advantages of using OSM is that they’re open source maps. Anyone can edit these maps. Right now, the userbase sits at around 1.5 million people. This means the maps are very detailed and updated regularly. In the photo below, you can see a comparison of the OSM and Google Maps.

сравнение OSM (слева) и Google Maps (справа)

Another key feature of Skobbler is that maps are rendered on the device in real-time using Open GL 2. This means the cache and the size of packets used offline are surprisingly lightweight. To give an example, the packets for most major cities are between 10 and 15MB in size.

Other advantages of Skobbler include built-in navigation tips, a detailed API, and (virtually) free use.

3

How to Work with Skobbler Cards

You can try out Skobbler for yourself in more detail using the sample application Go Beyond along with the official demo applications from Skobbler.

Your first step is to install the SDK for cards. There are two ways to do this:

  1. Download the repository yourself and throw in the right directories for the project.
  2. Prescribe commands in Gradle, in which case everything happens automatically and gets installed where needed.

In addition, the Skobbler instruction manual (found online) explains how to authorize the use of GPS and internet access, as well as the key to the card.

The next step is the map display on the device’s screen. Again, there are two ways to do this: 1) You can establish a standard XML fragment; or 2) You can view from the SDK cards themselves. These modes are initialized further in the code depending on your previously selected method.

Now, we’ll start to interact with the map. The most important application in Go Beyond is the mapping of the route on the map. Set it as all in the cards, using just a few lines of code.

public void initTourWay(ArrayList pois, Context context, boolean isNavigationModeOn, boolean isFirstCoordinateReceived) {
        if (isNavigationModeOn && !isFirstCoordinateReceived) {
            Toast.makeText(context, "Waiting for GPS coordinate", Toast.LENGTH_SHORT).show();
            return;
        }

        if (pois != null && pois.size() >= 2) {
            SKRouteSettings route = new SKRouteSettings();

            route.setStartCoordinate(new SKCoordinate(pois.get(0).getLongitude(), pois.get(0).getLatitude()));
            int poisArrLenght = pois.size() - 1;
            route.setDestinationCoordinate(new SKCoordinate(pois.get(poisArrLenght).getLongitude(),
                    pois.get(poisArrLenght).getLatitude()));

            if (pois.size() > 2) {
                ArrayList tourViaPoints = new ArrayList<>();
                for (int i = 1; i < pois.size() - 1; ++i) {
                    tourViaPoints.add(new SKViaPoint(i - 1, new SKCoordinate(pois.get(i).getLongitude(),
                            pois.get(i).getLatitude())));
                }
                route.setViaPoints(tourViaPoints);
            }
            if (isNavigationModeOn) {
                SKAdvisorSettings advisorSettings = new SKAdvisorSettings();
                setAdvisorSettings(advisorSettings);
            }

            route.setRouteMode(SKRouteSettings.SKRouteMode.PEDESTRIAN);
            setRoute(route);
        }
    }

To construct your required route, use points where the coordinates are latitude and longitude values. Determine which of them is the start, and which of them is the final point. The route is currently in the parameters by which it is calculated. You can build the route for walking, cycling, or driving by car.

4

Additionally, there are settings that permit or forbid certain things – say, for example, the use of water crossings or highways. You can define whether you want to cross these legs of the route by bike or on foot. There are also global parameters: routes can be set to «fast» or «calm», for example, which will affect its overall distance and travel time.

The second point can be set to a marker on the map. In the screenshot above, the marker was around the point. To display this marker, again, you’ll need a point with coordinates to set the position marker and View, which this marker will be. I also used this opportunity to set a marker at the spot where the cursor was on the map.

public void addEndPoint(SKCoordinate coordinate) {
        View view = View.inflate(context, R.layout.poi_search, null);
        SKAnnotation annotation = new SKAnnotation(15);
        annotation.setUniqueID(45);
        setAnnotationView(coordinate, view, annotation);
    }
5

By the way, the cards have a lot of «listeners». Those listeners include a single or double tap, long press, swipe, passing any point, the end of the route, and many others.

@Override
	public void onDoubleTap(SKScreenPoint skScreenPoint) {  }

	@Override
	public void onSingleTap(SKScreenPoint skScreenPoint) {   }

	@Override
	public void onRotateMap() {   }

	@Override
	public void onLongPress(SKScreenPoint skScreenPoint) {   }

	@Override
	public void onInternetConnectionNeeded() {   }

	@Override
	public void onMapActionDown(SKScreenPoint skScreenPoint) {   }

	@Override
	public void onMapActionUp(SKScreenPoint skScreenPoint) {   }

	@Override
	public void onPOIClusterSelected(SKPOICluster skpoiCluster) {   }

	@Override
	public void onMapPOISelected(SKMapPOI skMapPOI) {   }

	@Override
	public void onAnnotationSelected(SKAnnotation skAnnotation) {  }

	@Override
	public void onCustomPOISelected(SKMapCustomPOI skMapCustomPOI) {   }

	@Override
	public void onCompassSelected() {   }

	@Override
	public void onCurrentPositionSelected() {  }

	@Override
	public void onObjectSelected(int i) {  }

	@Override
	public void onInternationalisationCalled(int i) {  }

	@Override
	public void onBoundingBoxImageRendered(int i) {  }

	@Override
	public void onGLInitializationError(String errorMessage) {  }

The card has a widget with a compass. The only advantage of the compass is that it’s able to rotate along with the map. Unfortunately, you can’t customize the compass. You can’t replace the image or even change the size. You can only change the location of the compass on the screen.

Now we’ll look at the most important cards in Skobbler – navigation. Navigation works «out of the box» and uses audio and visual cues to connect to the built route and any leads on it. Audio prompts have two types, including pre-recorded phrases stored in the SDK, or simple text-to-speech prompts. Visual cues display the next direction.

6

Additionally, many more cards are available to give you useful information, including the current street and the next street, the distance to the end of the route, your estimated travel time, the approximate speed of movement, and more.

For navigation you can choose between different modes, including pedestrian, bicycle, and automobile. There’s also simulation mode, which moves the current position of the marker on the route as if it was tracking real movement.

As mentioned earlier, there are offline packages featuring many countries and cities. The downloaded packages are moved to the project, based on the code-prescribed path for it. If you have installed packages offline, they can also be used for offline geocoding that will only work on the packages that are currently installed.

Geocoding is fast, but not quite as fast as we would like. Search runs on only one of the levels: you can search for countries and cities in the country or streets in the city.

private void searchAtCurrentLevel(long parentId, SKListLevel level) {
        // get a search manager object
        SKSearchManager mgr = new SKSearchManager(this);
        // get a multi-step search object
        SKMultiStepSearchSettings searchSettings = new SKMultiStepSearchSettings();
        // set the offline package in which to search
        // the France package in this case needs to be installed
        searchSettings.setOfflinePackageCode("FR");
        // set list level of the search
        searchSettings.setListLevel(level );
        // set maximum number of results to be received
        searchSettings.setMaxSearchResultsNumber(20);
        // set the id of the parent in which to search
        searchSettings.setParentIndex(parentId);
        // set a filter for the results
        searchSettings.setSearchTerm("P");
        // initiate the search
        mgr.multistepSearch(searchSettings);
    }

    private void startSearch() {
        // this will start a search at country level (for city results) in France
        searchAtCurrentLevel(-1, listLevel );
    }

Other features I did not use, but I believe are worth mentioning include all of the following.

The cards have 4 styles, including standard, night, street, and black and white.

7

REALREACH. You set the travel time and one of the three modes of transportation we mentioned above. Then, the map shows the approximate area that can be covered based on that information.

8

HEATMAP. You can use the HeatMap to display the concentration of any objects. The «warmer» he map is, the greater number of objects there are in that area. Hot spots indicate a large numbers of objects like parking cafes, parks, marinas, etc.

9

Ultimately, it’s easy to sum up my Skobbler experience. In some parts of the platform, I faced difficult challenges. Because these parts of the platform aren’t very popular, I had trouble finding a solution on the internet. However, overall, these troubles were minor – the advantages of Skobbler outweighed any minor disadvantages I experienced.

Read and comment