How to change the position of marker from a javascript function?
You can use setPosition function of the marker class function changeMarkerPosition(marker) { var latlng = new google.maps.LatLng(-24.397, 140.644); marker.setPosition(latlng); }
You can use setPosition function of the marker class function changeMarkerPosition(marker) { var latlng = new google.maps.LatLng(-24.397, 140.644); marker.setPosition(latlng); }
If you want to show the info window opened by default without click, just add a new code like bellow: Your code: google.maps.event.addListener(marker, ‘click’, function() { infowindow.open(map,marker); }); So we have a new code like this: google.maps.event.addListener(marker, ‘click’, function() { infowindow.open(map,marker); }); infowindow.open(map,marker); As you can see, we just add a little line code with … Read more
Okay finally I found a replacement way to solve my problem. The interesting problem is when you assign a marker to map, it’s id is ‘m0’. When you remove it from map and assign new marker you expect the id should be ‘m0’ but it’s ‘m1’. Therefore, it showed me the id is not trustable. … Read more
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)
I just had the same problem – decided to do a quick and dirty conversion and host on github. https://github.com/nathan-muir/fontawesome-markers You can manually include the JS file, or use npm install fontawesome-markers or bower install fontawesome-markers. Just include the javascript file fontawesome-markers.min.js and you can use them like so: new google.maps.Marker({ map: map, icon: { … Read more
You can add a specific url to each point, e.g.: var points = [ [‘name1’, 59.9362384705039, 30.19232525792222, 12, ‘www.google.com’], [‘name2’, 59.941412822085645, 30.263564729357767, 11, ‘www.amazon.com’], [‘name3’, 59.939177197629455, 30.273554411974955, 10, ‘www.stackoverflow.com’] ]; Add the url to the marker values in the for-loop: var marker = new google.maps.Marker({ … zIndex: place[3], url: place[4] }); Then you can add … Read more
var pinIcon = new google.maps.MarkerImage( “http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2|00D900”, null, /* size is determined at runtime */ null, /* origin is 0,0 */ null, /* anchor is bottom center of the scaled image */ new google.maps.Size(12, 18) );
Finally I found the answer: marker = new google.maps.Marker( { map:map, draggable:true, animation: google.maps.Animation.DROP, position: results[0].geometry.location }); google.maps.event.addListener(marker, ‘dragend’, function() { geocodePosition(marker.getPosition()); }); function geocodePosition(pos) { geocoder = new google.maps.Geocoder(); geocoder.geocode ({ latLng: pos }, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { $(“#mapSearchInput”).val(results[0].formatted_address); $(“#mapErrorMsg”).hide(100); } else { $(“#mapErrorMsg”).html(‘Cannot determine address at this location.’+status).show(100); } … Read more
This thing is called Map Toolbar. You can disable it by calling UiSettings.setMapToolbarEnabled(false): GoogleMap map; ……. //init map map.getUiSettings().setMapToolbarEnabled(false);