- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Since the standard weebly drag and drop google map won't work for what I'm trying to do. I pulled code from https://developers.google.com/maps/documentation/javascript/shapes#polygons in order to integrate a map and add an overlay showing a specific area. The code is listed below. This allows me to see the map and overlay on the editing side of the site but after publishing the site nothing shows up. If I attempt to add anothevver overlay the whole map doesn't show even on the editing side.
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0">
<meta charset="utf-8">
<style>
#map {
height: 100%;
}
html, body {
height: 400;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
var map;
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: 25.731751, lng: -80.162037},
zoom: 17});
var polygonCoords = [
{lat: 25.732376, lng: -80.160720},
{lat: 25.732093, lng: -80.160394},
{lat: 25.731341, lng: -80.161834},
{lat: 25.731134, lng: -80.164724},
{lat: 25.731373, lng: -80.164737},
{lat: 25.731453, lng: -80.164291},
{lat: 25.731568, lng: -80.163293},
{lat: 25.731608, lng: -80.163041},
{lat: 25.731632, lng: -80.162277}];
var RSMASPolygon = new google.maps.Polygon({
paths: polygonCoords,
strokeColor: '#FF0000',
strokeOpacity: 0.5,
strokeWeight: 2,
fillColor: '#FF0000',
fillOpacity: 0.35});
RSMASPolygon.setMap(map);}
</script>
<script
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAg86fj-j-4hbLgJq6_NlIsrcWRe80DPbM&callback=initMap"
async defer>
</script>
</body>
</html>
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
It's not unusual for code in the Embed Code element to not show in the editor, but work fine on the live site. That said, some of what you have included there will break the display of your page (the body, html, head, and doctype tags).
Try using just the following, and then publishing to check your live site:
<style> #map { height: 100%; } html, body { height: 400; margin: 0; padding: 0; } </style> <div id="map"></div> <script> var map; function initMap() { map = new google.maps.Map(document.getElementById('map'), { center: {lat: 25.731751, lng: -80.162037}, zoom: 17}); var polygonCoords = [ {lat: 25.732376, lng: -80.160720}, {lat: 25.732093, lng: -80.160394}, {lat: 25.731341, lng: -80.161834}, {lat: 25.731134, lng: -80.164724}, {lat: 25.731373, lng: -80.164737}, {lat: 25.731453, lng: -80.164291}, {lat: 25.731568, lng: -80.163293}, {lat: 25.731608, lng: -80.163041}, {lat: 25.731632, lng: -80.162277}]; var RSMASPolygon = new google.maps.Polygon({ paths: polygonCoords, strokeColor: '#FF0000', strokeOpacity: 0.5, strokeWeight: 2, fillColor: '#FF0000', fillOpacity: 0.35}); RSMASPolygon.setMap(map);} </script> <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAg86fj-j-4hbLgJq6_NlIsrcWRe80DPbM&callback=initMap" async defer> </script>
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
Forgive me for hijacking this thread - I can not figure out how to create a new one.
My Google Map shows fine on Chrome, but doesn't show up at all on IE. I'm trying to figure out why?
Any help is greatly appreciated.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
Microsoft no longer updates Internet Explorer and will be ceasing support for it soon. If you look at it in the newest version of Microsoft Edge, does it work?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
Oh ... haha, well, that is a good reason. All of my computers (work and home) are still on Windows 7 --- so I am behind the times. I'll have to work on this on my end. Thank you VERY much!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
Not a problem! if you still have trouble let me know!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report