0

Does anyone know how to:

1) make the Google map not zoom-able? make it so it is at a fixed zoom size and the user cannot change it?

2) have the map API load a picture of my choosing and overlay the little blue dot of the user's current location over it?

Here is what I want to do, I'm want to have a custom picture of the world (that i have created in Photoshop or w/e, it will be .jpeg, .png, or whatever file format will work) the picture of the world will be 'artsy' and I just want the Google maps to overlay the little blue dot of where you are in the world. For example, if you are in New York, NY, you will see the picture of the world with the blue dot over what on the picture is New York.

Any help will be greatly appreciated, Thanks

slowsword
  • 314
  • 2
  • 14

3 Answers3

0

You should be able to control the map as follows:

map = (MapView) findViewById(R.id.mapview);

map.setBuiltInZoomControls(false);

As for overlaying an image, you'll need to create an image layout file (in XML) and then inflate that over the top of the map. This tutorial shows you the basics of inflating a layout and adding it to an existing view:

http://www.mysamplecode.com/2011/10/android-dynamic-layout-using-xml-add.html

To position the inflated layout (your image), you will need to use LayoutParams (http://developer.android.com/reference/android/widget/LinearLayout.LayoutParams.html) to set the position of the new view on to the map.

Hope that helps.

Gary Stevens
  • 693
  • 8
  • 20
  • if i inflate the image over the map, will the blue marker still be able to been seen over my picture? – slowsword Apr 27 '12 at 22:55
  • Good point, I'm not sure. If you inflate the view after you've positioned your marker than no, the map will cover everything. I'm not sure what would happen if you position the marker afterwards though. You could always take the GeoPoint of your marker and inflate that on to the image - to do that you would need to use .getProjection() on the map which would convert your longitude and latitude to a pixel position, which could be used to position a point onto the image. It's a bit messy and convoluted though. – Gary Stevens Apr 28 '12 at 07:49
0

Regarding you second question: it sounds like you actually want to replace the Google Maps tiles by images you've created yourself. As far as I know, that's not possible with the Maps API. You can potentially hack something together by adding your own creation as overlay to the map, but that may not give your the results you're looking for, especially if you want the user to still be able to pan/drag the map around.

In stead, you might want to take a look at the osmdroid (Open Street Maps for Android) project. They do support loading in your own tiles via the ModularTileProviderArchitecture. It'll probably give you more freedom and flexibility, but might be overkill for what you're after.

MH.
  • 45,303
  • 10
  • 103
  • 116
  • yea that is a bit overkill, ive settled on loading the map picture i want as a background (i dont want the user to pan/zoom because for my purpose it is only relevant if you see the whole world) and overlaying a picture, picture would look like a marker, based off of a geopoint location....now i have the idea but i do not know how to specifically place an image on the screen. is there any xy coordinates or something? anyone know? – slowsword Apr 30 '12 at 18:20
0

I know that OSM is hip and cool, but the OP asked about Google maps — and the question is readily answered in the Google Maps API documentation (https://developers.google.com/maps/documentation/javascript/).

The Google Maps API has supported custom maps for years. I think you can edit their first "ImageMapType" (https://developers.google.com/maps/documentation/javascript/maptypes#CustomMapTypes) example to solve your problem.

In your case, you would set the "maxZoom" and "minZoom" fields to whatever zoom you want to create artwork for. Use the "mapOptions" dictionary to take away the zoom control. You'll need to cut your artwork into tiles, and replace their "getTileUrl" function with one that returns your tiled image.

Tom Stambaugh
  • 1,019
  • 13
  • 18