开发者

Display flight paths in google maps

开发者 https://www.devze.com 2023-03-22 05:04 出处:网络
Hi I want to display flight paths in Google maps. I have the geo coordinates and want to create something like开发者_开发知识库 this on this image: http://main.makeuseoflimited.netdna-cdn.com/wp-conte

Hi I want to display flight paths in Google maps. I have the geo coordinates and want to create something like开发者_开发知识库 this on this image: http://main.makeuseoflimited.netdna-cdn.com/wp-content/uploads/2011/02/flightarrivals.png?54167

Has anyone a good example? Is this possible?

Thanks Nik


What about the API docs?

http://code.google.com/apis/maps/documentation/javascript/overlays.html

You can add markers, lines, text etc. All described in the API.

Example shamelessly grabbed from the docs on how to draw a polyline on a map:

function initialize() {
  var myLatLng = new google.maps.LatLng(0, -180);
  var myOptions = {
    zoom: 3,
    center: myLatLng,
    mapTypeId: google.maps.MapTypeId.TERRAIN
  };

  var map = new google.maps.Map(document.getElementById("map_canvas"),
      myOptions);
  var flightPlanCoordinates = [
    new google.maps.LatLng(37.772323, -122.214897),
    new google.maps.LatLng(21.291982, -157.821856),
    new google.maps.LatLng(-18.142599, 178.431),
    new google.maps.LatLng(-27.46758, 153.027892)
  ];
  var flightPath = new google.maps.Polyline({
    path: flightPlanCoordinates,
    strokeColor: "#FF0000",
    strokeOpacity: 1.0,
    strokeWeight: 2
  });

  flightPath.setMap(map);
}

There are lots more examples on the Google pages.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号