hi
i try to view my kml files to view on my local pc without hosting it
on a web server but i wont get it.
at first i tried this method but i have to creat that XML file
seperatly and can't get my own icons

 function load() {

                var map = new GMap2(document.getElementById("map"));
                map.addControl(new GSmallMapControl());
                map.addControl(new GMapTypeControl());

                GDownloadUrl("data.xml", function(data, responseCode) {
                        var xml = GXml.parse(data);
                        var way = 
xml.documentElement.getElementsByTagName("way");
                        var points = [];
                        for (var i = 0; i < way.length; i++) {
                                var point = new 
GLatLng(parseFloat(way[i].getAttribute("lat")),
parseFloat(way[i].getAttribute("lng")));
                                points.push(point);
                        }

                        map.addOverlay(new GPolyline(points, "#0000FF", 4));

                        var markers = 
xml.documentElement.getElementsByTagName("marker");
                        for (var i = 0; i < markers.length; i++) {
                                var point = new
GLatLng(parseFloat(markers[i].getAttribute("lat")),
parseFloat(markers[i].getAttribute("lng")));
                                map.addOverlay(new GMarker(point));
                        }
                });
    }

and because i already have the kml files it woulb be silly to creat a
xml file with the same content so i tried this

function load() {
                 var map;
                 var geoXml;

                GDownloadUrl("data.kml", function(data, responseCode) {
                if (GBrowserIsCompatible()) {
                  geoXml = new GGeoXml("c:\data.kml");
                map = new GMap2(document.getElementById("map"));
                map.addControl(new GSmallMapControl());
                map.addControl(new GMapTypeControl());
                map.addMapType(G_SATELLITE_3D_MAP);
                map.addOverlay(geoXml);
                }
                });
    }

but i can't use local kml files in this method only kml files on web
servers

i have to get this method work to use my kml file
or to write a kml parser for the first method, but this would be too
difficult for me
does anyone have an idea how to solve my problem? uploding the kml
file to a webserver is no option for me, i want to run it local


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to