Search code examples
androidosmdroid

Cannot find symbol variable mapquest_osm


I created a new project and am borrowing some Osmdroid code from an old project from about a year ago.

On this line:

    mapView.setTileSource(new XYTileSource(OSM_Mapquest, 
        ResourceProxy.string.mapquest_osm, 0, MAX_ZOOM_LEVEL, 256, IMAGE_EXTENSION, parameterString));

I get the error:

cannot find symbol variable mapquest_osm

If I look at ResourceProxy in the new project, there is indeed no such variable. If I look at ResourceProxy in the old project, it is there:

package org.osmdroid;

import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;

public interface ResourceProxy {

    public static enum string {

        // tile sources - THIS IS MISSING FROM THE NEW
        mapnik, cyclemap, public_transport, cloudmade_small, cloudmade_standard, mapquest_osm, mapquest_aerial, bing, mapbox,

        // overlays - SO IS THIS
        fiets_nl, base_nl, roads_nl,

        // other stuff - THIS BOTH IN THE OLD AND THE NEW
        unknown, format_distance_meters, format_distance_kilometers, format_distance_miles, format_distance_nautical_miles, format_distance_feet, online_mode, offline_mode, my_location, compass, map_mode,

    }

So it appears that this has been intentionally removed. Am I supposed to setTileSource() in another manner?

In the new project, I have included osmdroid in the app gradle file:

dependencies { ...
compile 'org.osmdroid:osmdroid-android:5.1@aar'
compile 'org.osmdroid:osmdroid-third-party:5.0.1@aar' }


Solution

  • That's because it was removed.

    Osmdroid maintains an upgrade guide in the wiki, located at the following link

    https://github.com/osmdroid/osmdroid/wiki/Upgrade-Guide

    Essentially, the resource proxy isn't used anymore and was banished from the source repo. Just remove the reference and you should be good to go. All other constructor parameters are the same.

    Also MapQuest has changed significantly and no longer offers free tiles without an API key. Other sources are available in the TileSourceFactory and there's further discussion the wiki and issue tracker for osmdroid.