1

我正在尝试在 Google 地图上创建斯德哥尔摩地铁地图。我已经创建了一个 KML 文件到蓝线http://tourist-sweden.se/transport/map/sthlm/t-11-bana.kml 我用这个 JavaScript 代码调用这个文件:

<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
    <title>Map of Stockholm's subway: line Nr.T-11 "Akalla - Kungstr&#228;dg&#229;rden"</title>
    <link href="https://developers.google.com/maps/documentation/javascript/examples/default.css" rel="stylesheet">
    <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
    <script>
function initialize() {
  var subwayblue = new google.maps.LatLng(18.032405,59.334372);
  var mapOptions = {
    zoom: 10,
    center: subwayblue,
    mapTypeId: google.maps.MapTypeId.ROADMAP
  }

  var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);

  var ctaLayer = new google.maps.KmlLayer({
    url: 'http://tourist-sweden.se/transport/map/sthlm/t-11-bana.kml'
  });
  ctaLayer.setMap(map);
}

google.maps.event.addDomListener(window, 'load', initialize);

    </script>
  </head>
  <body>
    <div id="map-canvas"></div>
  </body>
</html>

但没有显示车站之间的路径。我的错是什么?

4

1 回答 1

0

您的折线没有有效的颜色:

http://feedvalidator.org/check.cgi?url=http%3A%2F%2Ftourist-sweden.se%2Ftransport%2Fmap%2Fsthlm%2Ft-11-bana.kml

于 2013-07-05T13:16:03.157 回答