I'm trying to use the Google Maps APIs v3 but I have always an error
I added the script in the page:
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false&libraries=drawing"></script>
and I've implemented:
var drawingManager = new google.maps.drawing.DrawingManager({
drawingMode: google.maps.drawing.OverlayType.MARKER,
drawingControl: true,
drawingControlOptions: {
position: google.maps.ControlPosition.TOP_CENTER,
drawingModes: [google.maps.drawing.OverlayType.MARKER, google.maps.drawing.OverlayType.CIRCLE]
},
/*markerOptions: {
icon: new google.maps.MarkerImage('http://www.example.com/icon.png')
},*/
circleOptions: {
fillColor: '#ffff00',
fillOpacity: 1,
strokeWeight: 5,
clickable: false,
zIndex: 1,
editable: true
}
I got the same error always:
Uncaught TypeError: Cannot read property 'DrawingManager' of undefined
'The concepts within this document refer to features only available within the google.maps.drawing library. This library is not loaded by default when you load the Maps Javascript API but must be explicitly specified through use of a libraries bootstrap parameter: '
http://maps.googleapis.com/maps/api/js?sensor=false&libraries=drawing
use this:
<script async defer src="https://maps.googleapis.com/maps/api/js?libraries=geometry,drawing&key=YOURKEY&v=3&callback=initMapfUNCTION"></script>
YOURKEY ==> replace this word with your Map API Key initMapfUNCTION ==> replace this word with the name of your initial function to your map
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With