How to display a custom map on Android

10,460

Solution 1

Adding an overlay for Google maps with a custom map is pretty easy to do, the sample code works out of the box.

To overlay the map you need to have a rough idea of the gps coordinates of the park. There is the sample code for overlays using a jpg is here: https://code.google.com/p/android-maps-extensions/source/browse/google-play-services-samples/src/com/example/mapdemo/GroundOverlayDemoActivity.java?r=fd7175206a82da6d87b773e968d52849b4c107fb

Clone the entire project and import it into Eclipse:

git clone https://code.google.com/p/android-maps-extensions/

After you have it running and installed on your device, you will want to get an API key here: https://code.google.com/apis/console

Full instructions are here if you get stuck: https://developers.google.com/maps/documentation/android/start

There are other demos to make your map more useful for example:

  • traffic info to get to the event/park
  • a 3D perspective if you want for eye candy
  • GPS of users current location with relation to the park
  • make the overlay opaque, or slightly transparent
  • custom markers so the user can tap and open another screen

Solution 2

Well, you can use the google maps api v2 in android, and you create an Overlay map and implement the getTile, here you can find more info:

https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/model/TileProvider

but the only thing is, change the properties in order that the maps ask for the tile you want to send, lest say that you have 4 tiles for your map, so use a zoom level that only allows 4 tiles to be delivered and then you return the corresponding tile to the map.

also you have to set the type map to NONE.

Share:
10,460
Bryan Muscedere
Author by

Bryan Muscedere

Updated on June 28, 2022

Comments

  • Bryan Muscedere
    Bryan Muscedere almost 2 years

    I'm trying to make an Android application that displays a map of a Park and when a user taps on a certain location on the map, the application goes to another screen.

    Problem is that currently my map of the park is in a .jpg format. Which mapping API is best for my application and how would I go about converting this .jpg map into a format that is accepted by the API.

    Thanks!