3

I have created a map using Maps Engine Lite. After that, I tried to insert it into my webpage, the problem is I need an outer zoom level, but I couldn't get it (using get parameters, like "z" or "zoom"). So I tried to insert it trough Google Maps API. I want to do it from this code:

https://mapsengine.google.com/map/embed?mid=XXXXX

Is there any way to "create" a map with XXXXX as parameter? I tried this, but didn't work for me:

var map;
function initialize() {
var mapOptions = {
    zoom: 8,
    center: new google.maps.Load('XXXXX'),
    mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById('map-canvas'),
        mapOptions);
}
google.maps.event.addDomListener(window, 'load', initialize);

NOTES: the "div#map-canvas" exists after this script and the library from google was included before this.

PS: Excuse me for my english, my native language is spanish.

Praveen
  • 55,303
  • 33
  • 133
  • 164
Franco Zabala
  • 47
  • 2
  • 6

2 Answers2

2

You're trying to do two different things. The code you're attempting to execute is for loading the Maps Javascript API. You can use that for creating your own map form scratch. For maps created using Maps Engine Lite, the only option you have is to embed the map in your own site. To do this, make sure your map is set to public, then click the folder icon in the left hand panel. You'll see the option "Embed on my site" which will give you HTML you can copy/paste.

Another option you could explore is to build a map using the Maps API and then link to the Maps Engine Lite KML using a KmlLayer. The link you'd provide would be https://mapsengine.google.com/map/kml?mid=XXX Note that KML support in Google Maps in this way is limited so you may get unexpected results.

gmerrall
  • 390
  • 1
  • 8
0

First you would need to create an API key for that... xxx wont work:) Please follow this LINK It has a complete detail how you can use that google maps api via javascript. Above code should work after creating a valid map key.

Thanks

UmarKashmiri
  • 872
  • 8
  • 15