Hi,
if the files are stored in the same directory of the main html page,
you can obtain the correct URL to your KML files adding the complete
URL (see below). The KML data will be loaded by the a server on google
side and not (directly) by the browser, therefore you cannot see it
while working in local deployments (localhost) but only in a public
site deployment.
Hope it helps,
Davide
*****************************************
var atlantaKML = new google.maps.KmlLayer(getBaseURL()+ '/
Streets.kml');
var fultonKML = new google.maps.KmlLayer(getBaseURL()+ '/
fulton.kml');
function getBaseURL ()
{
// Get document base path
documentBasePath = document.location.href;
if (documentBasePath.indexOf('?') != -1)
documentBasePath = documentBasePath.substring(0,
documentBasePath.ind\
exOf('?'));
documentBasePath = documentBasePath.substring(0,
documentBasePath.lastIndexOf\
('/'));
return( documentBasePath );
}
*****************************************
On May 28, 9:40 am, Santiago Nieto Carrera
<[email protected]> wrote:
> Hi:
>
> In your code:
> var atlantaKML = new google.maps.KmlLayer('Streets.kml');
> var fultonKML = new google.maps.KmlLayer('fulton.kml');
>
> directions to the KML must be absolute and a server that is public.
> Does not work with local KML files.
>
> I hope it will help you
>
> On 27 mayo, 17:36, Kris <[email protected]> wrote:
>
>
>
> > Working off of the example given in the tutorials section I can't seem
> > to get a kml file that was generated from google earth to load into my
> > google map. The path is correct to the kml files as they reside in
> > the same directory as the html, i've also tried absolute paths to no
> > avail.
>
> > here is my html.
>
> > <html>
> > <head>
> > <meta name="viewport" content="initial-scale=1.0, user-
> > scalable=no" />
> > <meta http-equiv="content-type" content="text/html;
> > charset=UTF-8"/>
> > <script type="text/javascript" src="http://
> > maps.google.com/maps/api/js?sensor=false"></script>
> > <script type="text/javascript">
> > function initialize() {
> > var atlanta = new google.maps.LatLng(33.761926,-84.363144);
> > var myOptions = {
> > zoom: 13,
> > center: atlanta,
> > mapTypeId: google.maps.MapTypeId.ROADMAP
> > }
>
> > var map = new google.maps.Map(document.getElementById("map_canvas"),
> > myOptions);
>
> > var atlantaKML = new google.maps.KmlLayer('Streets.kml');
> > var fultonKML = new google.maps.KmlLayer('fulton.kml');
> > atlantaKML.setMap(map);
> > fultonKML.setMap(map);}
>
> > </script>
> > </head>
> > <body style="margin:0px; padding:0px;" onload="initialize()">
> > <div id="map_canvas" style="width:100%; height:100%"></div>
> > </body>
> > </html>- Hide quoted text -
>
> - Show quoted text -
--
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 [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-js-api-v3?hl=en.