2

I want to develop an Android application where I present users with a map with some markers. On the basis of a question they select a marker which is then evaluated as correct or wrong. Now the problems:

This can be implemented with Google Maps Android API v2:

  1. But problem is that I am not able to hide country, state or continent names. That takes away the purpose of the game. Can I blur out the names? Can I prevent zoom?

Using WebViews and Google Maps in WebView:

  1. Problem is that markers cannot be made clickable for this. How can I do this. Plus where is javascript coding done? Could I have tutorials for this?

Using offline maps.

Is that a possibility. Can I put markers on it, and know where user clicked?

The application "Geography Learning Game" does it nicely, and it also has Google written at the bottom, so they are using Google maps only. http://goo.gl/obE1fB

Answering any of the above will solve my problem. Please reply with code.

Ankit Aggarwal
  • 787
  • 1
  • 9
  • 15
  • possible duplicate of [Offline World Satellite Map Without Labels(Android)](http://stackoverflow.com/questions/13458137/offline-world-satellite-map-without-labelsandroid). *Also don't notify people in order to get your question visibility (I'm pretty sure its not allowed and/or considered bad behavior)*. –  Mar 13 '14 at 14:34
  • @RC. The question you are referring to, does not have an accepted answer. If I could be helped out here. Sorry, for the notification. – Ankit Aggarwal Mar 13 '14 at 15:36

3 Answers3

9

You can customize your map by applying map style using GoogleMap.setMapStyle(MapStyleOptions) (method reference). You can create map style here (just move 'labels' progress bar to customize map labels). Copy map style json and create raw resource with its content.

Your onMapReady will look like this:

override fun onMapReady(googleMap: GoogleMap) {
    try {
        googleMap.setMapStyle(
                MapStyleOptions.loadRawResourceStyle(context, R.raw.map_without_labels_style)
        )
    } catch (e: Resources.NotFoundException) {
        // log it
    }
}

More information could be found here

2

I found an answer, and would love to help anyone who comes across this while browsing.

Country, continent etc names can't be hidden using Google Maps, so OpenStreetMaps overlay layer is to be used over Google Maps.

So rest of the code remains same, just add an overlay. This selectively hides what has to be hidden.

Refer to https://code.google.com/p/osmdroid/ for the procedure to implement this.

Hope it helps!

Ankit Aggarwal
  • 2,367
  • 24
  • 30
  • Hello Ankit! Would you please help me I downloaded it on github but when I import it on eclipse it gives alot of error. Would you mind if you give me sample? I want to hide country names too using the terrain map type not the satellite one. I am developing a country quiz game. Also I don't want to hide the boundaries for each countries. – user3233787 Mar 28 '15 at 17:47
0

Your best option might be to use a different map type. I assume you're using the default MAP_TYPE_NORMAL. This can be changed after the map has been created (i.e. in the onMapReady method by using the mMap.setMapType(...) method). Here are some possibilities:

MAP_TYPE_NORMAL + Custom Map Style

You can easily create your own map styles by using the Styling Wizard. It allows you to create a style that excludes labels entirely (among other things). Once you've created a style you like, you can copy the JSON code generated by that website and add it to the project file res/raw/style_json.json. It can then be applied like this:

mMap.setMapType( GoogleMap.MAP_TYPE_NORMAL );

try
{
    boolean success = mMap.setMapStyle(
            MapStyleOptions.loadRawResourceStyle(
                    getContext(), R.raw.style_json ) );

    if( !success )
    {
        Log.e( TAG, "Style parsing failed." );
    }
}
catch( Resources.NotFoundException e )
{
    Log.e( TAG, "Can't find style. Error: ", e );
}

MAP_TYPE_NONE + Custom Map Tiles

You could add a TileOverlay of non-Google map tiles (like those provided by OpenStreetMap). You would have to find a set that does not include labels within the tiles themselves.

Map Types Without Labels

MAP_TYPE_SATELLITE and MAP_TYPE_NONE don't include labels. However, it sounds like MAP_TYPE_NONE would not be useful for your application by itself.

Matt N.
  • 53
  • 1
  • 10