I want to get the marker size of the marker, here the code below is returning this title and icon name completely Is returning. But the size of the icon is not returning, so how to get the icon size from the marker
var markers = new google.maps.marker ({location: new google.maps.LatLng () -25.363882,131.044922), map: map, title: 'map', icon: " Travel.png ", size: new google.maps.size (20, 16)}); Warning ("title" + marker.getTitle ()); Warning ("icon" + marker.getIcon ()); Warning ("title" + marker.getIcon () size.); Var iconSize = marker.getIcon (). Shape; Var w = iconSize.width; Var h = iconSize.height; Var p1 = projection .fromLatLngToPoint (marker.getPosition ()); Var p2 = marker.gate icon (). Anchor; Var sw = new google.maps.Point (p1.x-p2.x-pad, p1.y-p2.y + pad + h); Var = new google.maps.Point (p1.x-p2.x + pad + w, p1.y-p2.y-pad); SW = projection .frPointToLatLng (sw); Ne = projection .frPointToLatLng (NE); Iconbound = new google.maps.LatLngBounds (sw, ne); Please help !! How to solve it ??
That's because you do not mark a marker option, just a URL API, but then it will only give you a string)
You should make a mark with shape attribute (otherwise the size property will remain undefined), something like that Will: var myIcon = {url: "icon.jpg", size: new google.maps.size (10,10)}; Var marker_new google.maps.marker ({status: latte, icon: myIcon});
No comments:
Post a Comment