Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google maps: place number in marker?

How can I display a number in the marker on a google map? I want to do server side clustering and I need to display how many points the cluster represents.

like image 707
User Avatar asked May 23 '10 04:05

User


People also ask

How do I put numbers on a Google Map?

Number pins and fixed pin numbers Add pin numbers to your custom Google Map. There is an option that allows numbered pins to be added with a single click. Pins can automatically be numbers 1-99 when there are less than 100 visible pins on the map or the set of data contains less than 100 pins.

How do you customize a marker in maps?

For adding a custom marker to Google Maps navigate to the app > res > drawable > Right-Click on it > New > Vector Assets and select the icon which we have to show on your Map. You can change the color according to our requirements. After creating this icon now we will move towards adding this marker to our Map.

What is marker ID in Google Map?

Markers identify locations on the map. The default marker uses a standard icon, common to the Google Maps look and feel. It's possible to change the icon's color, image or anchor point via the API. Markers are objects of type Marker , and are added to the map with the GoogleMap.


2 Answers

icon: 'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=1|FE6256|000000' 

Looks fine with 1-digit and 2-digit numbers

(from Mauro's link)

like image 175
Jerome Jaglale Avatar answered Sep 20 '22 13:09

Jerome Jaglale


Latest google js API has google.maps.MarkerLabel object.

So you can easily set text/styles for labels

var mIcon = {   path: google.maps.SymbolPath.CIRCLE,   fillOpacity: 1,   fillColor: '#fff',   strokeOpacity: 1,   strokeWeight: 1,   strokeColor: '#333',   scale: 12 };  var gMarker = new google.maps.Marker({   map: gmap,   position: latLng,   title: 'Number 123',   icon: mIcon,   label: {color: '#000', fontSize: '12px', fontWeight: '600',     text: '123'} }); 

jsfiddle

like image 33
Valery Viktorovsky Avatar answered Sep 17 '22 13:09

Valery Viktorovsky