문제

내 프로파일 웹사이트의 위치를 보여줍니다 사람들을 사용하여 google maps.

구현했 google 지도는 지금 보는 사람이 당신을 보고 생활하고 당신이 살고있는 곳.

코드는 여기에 있습니다:

  var map = null;
  var geocoder = null;

  function initialize() {
    if (GBrowserIsCompatible()) {
      map = new GMap2(document.getElementById("map"));
      map.addControl(new GLargeMapControl());
      map.addControl(new GScaleControl());
      map.addControl(new GMapTypeControl());
      geocoder = new GClientGeocoder();
    }
  }

  function showAddresses(address1,address2) {
    if (geocoder) {
      geocoder.getLatLng(
        address1,
        function(point) {
          if (!point) {
            alert(address1 + " not found");
          } else {
            map.setCenter(point, 13);
            var marker = new GMarker(point);
            map.addOverlay(marker);
            marker.openInfoWindowHtml(address1);
          }
        }
      );

      geocoder.getLatLng(
      address2,
      function(point) {
        if (!point) {
          alert(address2 + " not found");
        } else {
          map.setCenter(point, 13);
          var marker = new GMarker(point);
          map.addOverlay(marker);
        }
      }
    );
    }
  }

그것이 무엇이 하지 않지만,수정하는 확대/축소 수준을 때 2 곳은 너무 멀리 떨어져 그들이 맞지 않으면 지도에서 togheter.지하는 방법을 알고 있습니다.

다음 단계는지도 보여 시각 사이의 경로는 두 개의 포인트 및 그들의 거리는 다음과 같은 경우에는다.나는 그것을 시도했에서 google 사이트 맵 나는 알고 있는 그들은 이 기능이 있습니다.나는 그냥을 찾을 수 없는 방법에 대한 설명서를 적용하는 작업이 필요합니다.

또는 나을 것이 그냥하는 하이퍼링크가 google 지도는 당신이 준비하지?그것은 또한 나지 않는 방법을 알고 있습니다.

도움이 되었습니까?

해결책

그것을 결코하지만,본 GDirections api:

http://code.google.com/apis/maps/documentation/reference.html#GDirections

Loooks 처럼 무엇을 찾고 있습니다.

다른 팁

모든 포인트를 추가해 다각형.에서 다각형을 LatLongBounds 할 수 있는 파생하는 데 사용되는 확대/축소할 수 있습니다.

    private function setMapZoomLevelBasedOnPlottedPoints(polygonPoints:Array):void
    {
        var pointBounds:LatLngBounds = getLatLongBounds(polygonPoints);
        _map.setCenter(pointBounds.getCenter());
        _map.setZoom(_map.getBoundsZoomLevel(pointBounds) - 1);
    }

    private function getLatLongBounds(polygonPoints:Array):LatLngBounds
    {
    for(var i:Number; i < polygonPoints; i++)
    {
            polygonPoints.push(polygonPoints[i] as LatLong);
    }
        var polygon:IPolygon = new Polygon(polygonPoints);
        return polygon.getLatLngBounds();
    }

그것은에 있습니다.당신이 그것을 찾을 수 있습니다진

route site:http://code.google.com/apis/maps

여기에는 한 페이지입니다,예를 들어,보여줍니다"드라이버 방향에서"오버레이로 플래시입니다.이 API 는 조금 다르면 당신이 하고 있는지도 밖의 플래시,하지만 그것은 동일한 기본 코드입니다.http://code.google.com/apis/maps/documentation/flash/services.html

나는 더 많은 작업과 함께지도는,그래서 그냥을 얻으로 구글지도 API 를 사용합니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top