Embeding Google Maps API in a Google Site

135 views
Skip to first unread message

Open Source GIS

unread,
Oct 30, 2012, 4:31:22 PM10/30/12
to google-map...@googlegroups.com
Hello,

I am currently struggling getting a Google Maps javascript code that i have written into a Google Sites. I though this would be easy as they are using the same product...no unfortunatley not.

I have created a basic google maps that references a fushion table to give it some data and also points on a map. The code looks like this:

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css"> 
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map_canvas { height: 100% }
</style>
<script type="text/javascript"
</script>
<script type="text/javascript"> 
var map = null;
function initialize() {
var myOptions = {
zoom: 7,
center: new google.maps.LatLng(52.603047, -1.604003),
mapTypeControl: true,
mapTypeCOntrolOptions: {style:
google.maps.MapTypeControlStyle.DROPDOWN_MENU},
navigationControl: true,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
 
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
 
var layer = new google.maps.FusionTablesLayer({
query: {
select: 'Latitude',
from: '1g1TJN9-M0JSmP2fXpAnSkJ5A2zW6KXxGtW4uI-s'
},
});

layer.setMap(map);

};
</script>
</head>
<body onload="initialize()">
<div id="map_canvas" style="width:100%; height:100%">
</div>
</body>
</html>

Now unfortunatley, even though the API is registered to the Google Sites page it just dosent like it. I would really appreciate a little help with getting this map into a google site application. Any advice or guidance that people could give would be massivley helpful!

Many Thanks,

Ian Usher
GIS Consultant
Open Source GIS

Barry Hunter

unread,
Oct 30, 2012, 4:43:42 PM10/30/12
to google-map...@googlegroups.com
A Google site, doesnt support arbitrary code. Its limited. 

But it looks like a HTML box could be a Google Maps API based map, subject to making a few changes to your code...




Open Source GIS

--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-maps-js-api-v3/-/k_DBbycPkpUJ.
To post to this group, send email to google-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Open Source GIS

unread,
Oct 30, 2012, 4:59:55 PM10/30/12
to google-map...@googlegroups.com
Thanks Barry,

Unfortuantley even though the API key is registered to the name of the Google Sites it dosent seem to like it. Im totally stumped by this...its driving me insane! :(

Thanks for your quick reply though! :)

Ian

Barry Hunter

unread,
Oct 30, 2012, 5:16:27 PM10/30/12
to google-map...@googlegroups.com
You have far more fundamental issues. You can't just put arbitrary javascript into a page directly. 

It looks like HTML Box might support it. But will need to make changes to the code, eg as noted on the page I linked to onload doesnt work. Once you start putting in the code, the HTML box editor will prompt you about issues it finds. Quite a few issues to deal with. You still dont get arbitray code support. 


You might find it easier to just host the html page somewhere else. On a normal webserver. 
If you search "iframe" in the Gadgets section, can use that to include your new html page inside a Google sites page. 


--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.

Ian Usher

unread,
Oct 30, 2012, 5:19:36 PM10/30/12
to google-map...@googlegroups.com

Thank you for your help...I'm going to kept trying and see what happens! I think a new website might be needed rather than just embedding the java! Many thanks for your help with this! :)

Reply all
Reply to author
Forward
0 new messages