I'm embedding a map in a webpage but I keep getting a ApiNotActivatedMapError for some reason, I'm looking at it and it is activated. I'm just at a loss here.
<div id="map" style="width:100%;height:400px">My map will go here</div>
<script>
// Initialize and add the map
function initMap() {
var mapProp= {
center:new google.maps.LatLng(51.508742,-0.120850),
zoom:5,
};
var map=new google.maps.Map(document.getElementById("map"),mapProp);
}
</script>
<script async defer
src=";callback=initMap">
</script>
Does anybody have any experience with this problem? Am I missing something simple? Thanks
I'm embedding a map in a webpage but I keep getting a ApiNotActivatedMapError for some reason, I'm looking at it and it is activated. I'm just at a loss here.
<div id="map" style="width:100%;height:400px">My map will go here</div>
<script>
// Initialize and add the map
function initMap() {
var mapProp= {
center:new google.maps.LatLng(51.508742,-0.120850),
zoom:5,
};
var map=new google.maps.Map(document.getElementById("map"),mapProp);
}
</script>
<script async defer
src="https://maps.googleapis./maps/api/js?key=MY_API_KEY&callback=initMap">
</script>
Does anybody have any experience with this problem? Am I missing something simple? Thanks
Share edited Jul 12, 2018 at 13:52 xomena 32.2k6 gold badges96 silver badges125 bronze badges asked Jul 10, 2018 at 21:14 MattWolc24MattWolc24 1061 silver badge9 bronze badges 1- Which API did you activate in your project? The code that you posted requires a Google Maps JavaScript API be activated. – xomena Commented Jul 12, 2018 at 13:53
1 Answer
Reset to default 9Go to console.cloud.google. and follow the following steps:
1) APIs & Services
2) Dashboard
3) + Enable APIS and Services
4) Maps JavaScript API
5) hit Enable button
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742266843a4411955.html
评论列表(0条)