Make Google Maps API Default Marker Smaller - android

Im using Google Maps API in my app and placing a lot of markers on the map.
I need to make the size of the markers smaller, so they won't cover the whole country.
Note that i gotta use the default marker BitmapDescriptorFactory.defaultMarker
because i wrote an algo that defines the color of each marker group.
Thanks for the help in advance!
EDIT:
I know there is a way to resize the marker by setting a custom Marker image,
But i need to use the defualt marker,Therefore this topic is NOT duplicate

Follow these two steps down here:
Replace the Default Google Map Marker with the Bitmap icon as explained here
Then resize the particular Bitmap Icon in Activity as shown here.

Related

How to know if markers on the map touch each other

I am building an application which uses Google Maps. When displaying the map, I'm also adding markers. Is there a way to see if there are 2 markers that touch each other, meaning if a part of a marker is on top of another marker? My goal is to be able to find that out and then make them a single bigger marker instead of 2 different markers.
The answer should depend somehow on the marker's icon size and the current map zoom since if I zoom out, there's a bigger chance they might overlap.
There seem to be a library made by Google which clusters a set of markers together automatically when they are close to one another.
The library is the marker clustering utility and instruction can be found here:
https://developers.google.com/maps/documentation/android-api/utility/marker-clustering

Add GIF image to marker of Google Map Api v2

When I add GIF Image to marker of google map V2 the image is shown but it stops its movement.
Why? And how can I solve this issue and make the image do its movement?
Hope anyone can help me.
Thanks in advance.
Marker Icon in google maps android api v2 is a static image and you cannot change the icon once you have created the marker. So if you are trying to include any animation using GIF images, it will not be supported and only a single image from the GIF will be shown as the icon.
An option to achieve changing marker image is to programatically remove() the marker after a certain time and then immediately add the marker using addMarker with a different image set as icon in MarkerOptions() and retaining other properties.

Label at the top of the marker in google maps api v2

One more problem while switching to the maps api v2.
This is an ugly representation of what i want to achieve.
Edit1. There can be several markers, every marker with its own label. All markers and labels are shown simultaneously.
As you can see there is a label with some information at the top of the marker.
While using api v1 it can easily be done with drawing marker and label on Overlay.
How can I implement it using api v2?
The first idea is to render marker(red) and label(black) to one bitmap and set it as marker. But it will significantly increase marker area(red rectangle) and with this marker limitation gives me real headache with user to map interraction realisation.
The second idea is to use GroundOverlay, but at first glance, it is not designed for this purpose.
Edit2 Here is similar question, solution, like in the first idea, is to use both marker and label as single marker bitmap, created from view.
Have a look at a library I am working on:
googlemaps/android-maps-utils
You can use the BubbleIconFactory to achieve this:
IconGenerator factory = new IconGenerator(this);
Bitmap icon = factory.makeIcon("11:15 1.08.2013");
mMap.addMarker(new MarkerOptions().position(...).
icon(BitmapDescriptorFactory.fromBitmap(icon)));
This is much simpler to do on Android Maps v2. Please take a look at the official documentation here: https://developers.google.com/maps/documentation/android/marker
It is called Info Window. By default, an info window is displayed when a user taps on a marker and if the marker has a title set

How to make a TileOverlay cover the text of the covered map?

I have an app that use the old google map API and add a layer over the map to display a more precise map of my own over the map.
I'm trying to do this in the API v2 using the TileOverlay but the text of the google map are displayed over my tiles.
Here are 2 screenshots, one with the map, and one with the map with an overlay (just based on the API demo)
I tried to add a big Z-Index to the tiles without any results.
Is there any way to really cover the map with custom tiles ?
The reason why you keep seeing the labels, is that in google maps v2 the labels are rendered locally instead of being part of tile bitmaps. The benefit of this, is that you can rotate the map and still have the labels without rotation for easy reading.
Solution
The only solution I know so far is to disable the map base layer using setMapType(MAP_TYPE_NONE). However, this may have the undesireble effect of also disabling parts of the map that are not being covered by your overlay.
Regards.

customize Google Maps API

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
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.
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.
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.

Categories

Resources