0
经过三天的尝试,我已经接近放弃它了。 我尝试使用Google Maps API来创建具有由多个点形成的较长线条的地图。不幸的是,甚至没有上传一个XML文件为我(尽管我成功授权我自己的谷歌帐户)。C#:用线条创建一个Google Map?
有人可以给我帮助,并发布一个C#/ VB代码(片段)如何创建一个地图并在其上画一条线?感谢您的帮助!
诺伯特
经过三天的尝试,我已经接近放弃它了。 我尝试使用Google Maps API来创建具有由多个点形成的较长线条的地图。不幸的是,甚至没有上传一个XML文件为我(尽管我成功授权我自己的谷歌帐户)。C#:用线条创建一个Google Map?
有人可以给我帮助,并发布一个C#/ VB代码(片段)如何创建一个地图并在其上画一条线?感谢您的帮助!
诺伯特
如果你使用谷歌地图的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>
对不起,我要澄清,我需要建立映射出的C#代码,而不是一个网站。不过谢谢! – Norbert 2010-11-19 07:48:57
那么你在哪里显示地图?在winform上? – Kangkan 2010-11-19 08:21:57
是的,地图显示在应用程序中。 – Norbert 2010-12-21 11:23:47