2010-11-19 9 views
0

3日間の試行後、私はそれをあきらめている。 Google Maps APIを使用して、いくつかのポイントによって形成された長い行の地図を作成しようとしています。残念ながら、XMLファイルをアップロードしても私のためにはうまくいきませんでした(私は自分のGoogleアカウントで正常に認証されましたが)。C#:ライン付きGoogleマップの作成?

誰かが私に助けを与え、地図を作成して線を描く方法についてC#/ VBコード(スニペット)を投稿できますか?ご協力ありがとうございます!

ノルベルト

答えて

0

は、GoogleマップのためのJavaScript APIを使用している場合は、ここではサンプルです:

<!DOCTYPE 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"/> 
<title>Google Maps JavaScript API v3 Example: Polyline Simple</title> 
<link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" /> 
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> 
<script type="text/javascript"> 

    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); 
    } 
</script> 
</head> 
<body onload="initialize()"> 
    <div id="map_canvas"></div> 
</body> 
</html> 
+0

申し訳ありませんが、私はC#のコードではなく、ウェブサイトのうち、マップを構築する必要があることを明確にする必要があり。ありがとう、しかし! – Norbert

+0

地図をどこに表示していますか? winformで? – Kangkan

+0

はい、地図はアプリケーションに表示されます。 – Norbert