Cobining "My Maps" and GoogleJS API v3

155 views
Skip to first unread message

DSP

unread,
Nov 26, 2010, 8:19:39 AM11/26/10
to Google Maps JavaScript API v3
Hi there,

I have a general question:

Is it possible to use a created map with marked locations in the
regular Google Maps acoount of "my maps" with the JS API v3?

The background is:
We want to include a map on our website, that includes all of our
locations. This map (maybe with an ID) should be accessible via the
Google JS API.

Thanks in advance,

Dirk

geoco...@gmail.com

unread,
Nov 26, 2010, 8:44:24 PM11/26/10
to Google Maps JavaScript API v3
On Nov 26, 8:19 am, DSP <dsp.sprin...@googlemail.com> wrote:
> Hi there,
>
> I have a general question:
>
> Is it possible to use a created map with marked locations in the
> regular Google Maps acoount of "my maps" with the JS API v3?

I would think so. The "View in Google Earth" link should give kml
that can be displayed using kmlLayer.

-- Larry

Joseph Elfelt

unread,
Nov 28, 2010, 9:06:38 AM11/28/10
to Google Maps JavaScript API v3


On Nov 26, 5:19 am, DSP <dsp.sprin...@googlemail.com> wrote:
> Is it possible to use a created map with marked locations in the
> regular Google Maps acoount of "my maps" with the JS API v3?

Yes, it is possible.
See:
http://groups.google.com/group/google-maps-js-api-v3/browse_thread/thread/ba8a4b69d821fd94/fb0a8b36a76caeaa?lnk=gst&q=elfelt#fb0a8b36a76caeaa

Joseph Elfelt

unread,
Nov 28, 2010, 10:23:10 AM11/28/10
to Google Maps JavaScript API v3
Oops, I should have provided a brief overview.

In order to use the v3 API to display a Google MyMap you need to:

1. Make a small KML file that includes a NetworkLink which points to
the MyMap
2. Place that small KML file online
3. Use the v3 API to display that small KML file

See the link above for details.

DSP

unread,
Dec 2, 2010, 10:44:54 AM12/2/10
to Google Maps JavaScript API v3
Thanks to all of you.

There is a simple way to achieve what I wanted:

You can get the "MyMaps" kml on the fly by just open your disered map
in mymaps, get the link , paste it in your browser and add a
"&output=kml" to it.

Thats the way, you can call your mymap with the api:

if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map"),{

googleBarOptions:
{linkTarget:G_GOOGLEBAR_LINK_TARGET_SELF}

})

map.setCenter(new GLatLng(startLatitude, startLongitude), 2,
mapType);
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.enableGoogleBar();
map.enableScrollWheelZoom();
//map.addControl(new GOverviewMapControl());
map.addOverlay(new GGeoXml("http://maps.google.de/maps/ms?
hl=de&ie=UTF8&msa=0&msid=YOUR_MSID&output=kml"));
}//EoF ifBrowserIsCompatible

geoco...@gmail.com

unread,
Dec 2, 2010, 10:51:14 AM12/2/10
to Google Maps JavaScript API v3
On Dec 2, 7:44 am, DSP <dsp.sprin...@googlemail.com> wrote:
> Thanks to all of you.
>
> There is a simple way to achieve what I wanted:
>
> You can get the "MyMaps" kml on the fly by just open your disered map
> in mymaps, get the link , paste it in your browser and add a
> "&output=kml" to it.
>
> Thats the way, you can call your mymap with the api:

FYI - that code uses the v2 API. This is the v3 group. In v3 you
don't use GGeoXml, you use kmlLayer (and a lot of other things in your
code snippet would need to change), but the general advice on how to
access myMaps is useful for both APIs.

If you have questions on v2 API maps, that group is:
http://groups.google.com/group/google-maps-api

-- Larry

>
> if (GBrowserIsCompatible()) {
>         map = new GMap2(document.getElementById("map"),{
>
>                 googleBarOptions:
>                 {linkTarget:G_GOOGLEBAR_LINK_TARGET_SELF}
>
>                 })
>
>         map.setCenter(new GLatLng(startLatitude, startLongitude), 2,
> mapType);
>         map.addControl(new GSmallMapControl());
>         map.addControl(new GMapTypeControl());
>                 map.enableGoogleBar();
>                 map.enableScrollWheelZoom();
>                 //map.addControl(new GOverviewMapControl());
>         map.addOverlay(new GGeoXml("http://maps.google.de/maps/ms?
> hl=de&ie=UTF8&msa=0&msid=YOUR_MSID&output=kml"));
>       }//EoF ifBrowserIsCompatible
>
> On 28 Nov., 16:23, Joseph Elfelt <josephelf...@gmail.com> wrote:
>
>
>
> > Oops, I should have provided a brief overview.
>
> > In order to use the v3 API  to display a Google MyMap you need to:
>
> > 1.  Make a small KML file that includes a NetworkLink which points to
> > the MyMap
> > 2.  Place that small KML file online
> > 3.  Use the v3 API to display that small KML file
>
> > See the link above for details.- Hide quoted text -
>
> - Show quoted text -

DSP

unread,
Dec 6, 2010, 6:00:25 AM12/6/10
to Google Maps JavaScript API v3
Oh. Alright.

Thank you.

Here is the Code for V3:



function loadGoogleMaps() {


var myLatlng = new google.maps.LatLng(48.699120,8.989563);
var myOptions = {
center: myLatlng,
mapTypeId: google.maps.MapTypeId.HYBRID
}

var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);

var georssLayer = new google.maps.KmlLayer('http://maps.google.de/
yourKml&output=kml',{preserveViewport:true});
georssLayer.setMap(map);
map.setZoom(2);

}




On 2 Dez., 16:51, "geocode...@gmail.com" <geocode...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages