open KMZ file within Google Map API map

4,307 views
Skip to first unread message

Iratus

unread,
Apr 6, 2011, 12:44:02 PM4/6/11
to google-map...@googlegroups.com
Hello

I want to add an KMZ file within my google map API v3 map. I tried to find some tutorials on this but i had not success at all.

Can someone point me out how to do it. Please understand that I just started programming so my knowledges are very limited.

Thank you in advance

The link of the KMZ file i want to integrate


http://bbs.keyhole.com/ubb/ubbthreads.php?ubb=download&Number=981817&filename=Mount-Everest-tour.kmz 

geoco...@gmail.com

unread,
Apr 6, 2011, 1:16:14 PM4/6/11
to Google Maps JavaScript API v3
On Apr 6, 9:44 am, Iratus <malakia...@googlemail.com> wrote:
> Hello
>
> I want to add an KMZ file within my google map API v3 map. I tried to find
> some tutorials on this but i had not success at all.
>
> Can someone point me out how to do it. Please understand that I just started
> programming so my knowledges are very limited.


Look at the documentation and examples for KmlLayer:
http://code.google.com/apis/maps/documentation/javascript/overlays.html#KMLLayers

-- Larry



>
> Thank you in advance
> *
> The link of the KMZ file i want to integrate*
>
> http://bbs.keyhole.com/ubb/ubbthreads.php?ubb=download&Number=981817&... 

Iratus

unread,
Apr 6, 2011, 1:41:42 PM4/6/11
to google-map...@googlegroups.com
I have problem integrating the KMZ file again.

Please help me a little bit

My javascript code is this

(function() {
window.onload = function() {

// Creating an object literal containing the properties
//you want to pass to the map

var options = {
zoom: 10,
center: new google.maps.LatLng(27.98002,     86.92154),
mapTypeId: google.maps.MapTypeId.SATELLITE,

//Scale bar

scaleControl: true,


// Now we will play with the maptype terrain menu !!!

mapTypeControl: true,
mapTypeControlOptions: {
  style: google.maps.MapTypeControlStyle.DROPDOWN_MENU,
  position: google.maps.ControlPosition.TOP_RIGHT

//Types of maps available to the user

/* mapTypeIds: [
google.maps.MapTypeId.ROADMAP,
google.maps.MapTypeId.SATELLITE
]  */



  }


//Navigation toolbar (zoom)

// DEN LEITOURGEI !!!

/* disableDefaultUI: true,
navigationControl: true,
navigationControlOptions: {
  position: google.maps.ControlPosition.TOP_RIGHT,
} */




};

//Creating the map

var map = new google.maps.Map(document.getElementById('map'), options);


//Street view enable

var options = {
zoom: 3,
center: new google.maps.LatLng(27.98002,     86.92154),
mapTypeId: google.maps.MapTypeId.SATELLITE,
streetViewControl: true
};

//BackGround Color

//Den leitourgei

var options = {
zoom: 3,
center: new google.maps.LatLng(27.98002,     86.92154),
mapTypeId: google.maps.MapTypeId.SATELLITE,
backgroundColor: '#000000'
};

// Adding a marker on the Summit Everest

var marker = new google.maps.Marker({
position: new google.maps.LatLng(27.98002,     86.92154),
map: map,
// ADDING a title to the Marker
title: ' Summit Everest',
icon: 'http://gmaps-samples.googlecode.com/svn/trunk/markers/blue/blank.png'

});

// Create Infowindow on the Marker Everest

var infowindow = new google.maps.InfoWindow({
content:'The Highest Summit on Earth'
});

// Create 'LISTENER' so the Marker can saw info

google.maps.event.addListener(marker, 'click' , function() {

// call the open method od the InfoWindow
                infowindow.open(map, marker);                                                         
           });

 

var map = new google.maps.Map(document.getElementById("map"), myOptions);
   
var ctaLayer = new google.maps.KmlLayer('http://bbs.keyhole.com/ubb/ubbthreads.php?ubb=download&Number=981817&filename=Mount-Everest-tour.kmz');
ctaLayer.setMap(map);



//TELOS TELOUS

};
})();



Nothig seems to happens. The KMZ layers is not integrated within. What is my mistake ????

Thanks again


geoco...@gmail.com

unread,
Apr 6, 2011, 1:55:15 PM4/6/11
to Google Maps JavaScript API v3
On Apr 6, 10:41 am, Iratus <malakia...@googlemail.com> wrote:
> I have problem integrating the KMZ file again.
>
> Please help me a little bit
>
> *My javascript code is this*

Help us to help you. Post a link to your map:
READ THIS FIRST: Posting Guidelines
http://groups.google.com/group/google-maps-js-api-v3/t/2b3f101fd509919e


>
>
> *Nothig seems to happens. The KMZ layers is not integrated within. What is
> my mistake ????*

Don't know. My browser could perhaps help me to find it if you were
to post a link.

-- Larry

>
> *Thanks again*
> *

Iratus

unread,
Apr 6, 2011, 2:09:13 PM4/6/11
to google-map...@googlegroups.com
Hello

I don't know if this will help but here you can see the map (at least I can see it from my computer)

file:///C:/Master_Geomatics/Semester_2/Map%20Cpt%202%20---Everest/Index.html


Thanks

geoco...@gmail.com

unread,
Apr 6, 2011, 2:16:13 PM4/6/11
to Google Maps JavaScript API v3
On Apr 6, 11:09 am, Iratus <malakia...@googlemail.com> wrote:
> Hello
>
> I don't know if this will help but here you can see the map (at least I can
> see it from my computer)
>
> *
> file:///C:/Master_Geomatics/Semester_2/Map%20Cpt%202%20---Everest/Index.html

That is on your local computer. How do you think I can access your
hard drive?

-- Larry

> *
>
> Thanks

Rossko

unread,
Apr 6, 2011, 3:40:14 PM4/6/11
to Google Maps JavaScript API v3
> *Nothig seems to happens. The KMZ layers is not integrated within. What is
> my mistake ????*

You might revise your code, so that it only creates the map once.

Iratus

unread,
Apr 6, 2011, 4:58:34 PM4/6/11
to google-map...@googlegroups.com
Ok I am sorry but I have not got any server to upload my map !!!

I made some small change to my Javascript code so i only create the map ones but still can not integrate my KMZ file within.

Any suggestions ???

-------  CODE -------

//TELOS TELOUS

};
})();





geoco...@gmail.com

unread,
Apr 6, 2011, 5:22:41 PM4/6/11
to Google Maps JavaScript API v3
On Apr 6, 1:58 pm, Iratus <malakia...@googlemail.com> wrote:
> Ok I am sorry but I have not got any server to upload my map !!!
>
> I made some small change to my Javascript code so i only create the map ones
> but still can not integrate my KMZ file within.
>
> Any suggestions ???

It works on Google Maps:
http://maps.google.com/maps?client=gmail&q=http:%2F%2Fbbs.keyhole.com%2Fubb%2Fubbthreads.php%3Fubb%3Ddownload%26Number%3D981817%26filename%3DMount-Everest-tour.kmz&ie=UTF8&hl=en&z=6

Means it should work on your map.

-- Larry


>
> -------  CODE -------
>
> *(function() {
> google.maps.KmlLayer('http://bbs.keyhole.com/ubb/ubbthreads.php?ubb=download&Number=981817&...
> })();*
>
>

Iratus

unread,
Apr 6, 2011, 5:39:00 PM4/6/11
to google-map...@googlegroups.com
Finaly !!!

Now it works and I don' even know why !!!

Is it possible to somehow to change the KML code and integrated directly into the javascript file (not through link) ???

I have allready unziped the KMZ file and I can see the code and i can make some modifications also.

Thank you 

geoco...@gmail.com

unread,
Apr 6, 2011, 7:43:14 PM4/6/11
to Google Maps JavaScript API v3
On Apr 6, 2:39 pm, Iratus <malakia...@googlemail.com> wrote:
> Finaly !!!
>
> Now it works and I don' even know why !!!
>
> Is it possible to somehow to change the KML code and integrated directly
> into the javascript file (not through link) ???

I'm not quite sure what you mean by that.

If you want to add markers, polylines and ground overlays with the API/
javascript, you can do that.

The documentation has examples of each.

-- Larry

Tony

unread,
Apr 7, 2011, 11:05:49 AM4/7/11
to Google Maps JavaScript API v3
I believe you can just open the KML file and determine what kind of
objects/classes are in use for example Polygon. Then create it using
the JavaScript API.

Iratus

unread,
Apr 8, 2011, 1:06:44 AM4/8/11
to google-map...@googlegroups.com
 So can i just copy and paste some of the code that are within the KML file into my code ??? I mean it will work ???

Thank you

Rossko

unread,
Apr 8, 2011, 3:20:14 AM4/8/11
to Google Maps JavaScript API v3
>  So can i just copy and paste some of the code that are within the KML file
> into my code ??? I mean it will work ???

No.
KML is just one kind of XML, it is not code.
You will need a tool called a parser to read the KML.
Search for GeoXml3 for an example.

annusuya medhi

unread,
Apr 9, 2011, 4:49:19 AM4/9/11
to google-map...@googlegroups.com
HEY ITS AMAZING IIII..

--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
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.

Reply all
Reply to author
Forward
0 new messages