I want to implement a div on a single (lat,lng) point with fixed width and height on google maps. There are examples to implement overlay within a bound and not on a single point. Has somebody implemented this ?
Asked
Active
Viewed 124 times
-1
-
How big is your div? What place on that div do you want located at the "single (lat,lng) point? – geocodezip Aug 31 '17 at 19:27
1 Answers
1
You can create an overlay on a single point by adding a custom marker to your point. Essentially, when you create the marker, you can define an icon that will replace the default Google API Marker icon:
var img = 'http://placehold.it/96/ffffff'
var marker = new google.maps.Marker({
position: latLng,
map: map,
icon: img // replace google marker with icon
});
If you want an actual HTML div to overlay on Google Maps, you could convert the div into a canvas as shown in this tutorial

danielcc
- 11
- 1