题
如何显示雅虎静态地图在内,如果我们通过地址查询串?另外,请告诉如何显示的动态雅虎的地图。我已经搜查了关于雅虎的地图,并得到了以下链接 http://developer.yahoo.com/flash/maps/examples.html, http://developer.yahoo.com/maps/rest/V1/ 和 http://developer.yahoo.com/maps/.我没有得到任何链接,其中有代码整合雅虎在一个地图ASP.Net 网站!
解决方案
我已经创建了雅虎动态地图,地址可以作为传递的价值的一个隐藏的领域中存在的页。值隐藏的领域可以动态传page_load事件。我创建了这个孩子页面封由主页ASP.Net.
在开始之前,用户已产生的应用程序ID使用雅虎的图通过登录进你的雅虎ID和导航这个链接 https://login.yahoo.com/config/login_verify2?.src=devnet&.done=http://developer.apps.yahoo.com/wsregapp/ 提供我们的网站的网址。
代码显示雅虎的图如下:
.地图{ 高度:400像素;宽度:为700像素;字体的家庭:Verdana;字体大小:11px;字体重量:大胆;}
<script type="text/javascript" src="http://api.maps.yahoo.com/ajaxymap?v=3.8&appid=YourAPPID">
</script>
<script type="text/javascript">
// Capture the user mouse-click and expand the SmartWindow
function onSmartWinEvent() {
// Create a map object
var map = new YMap(document.getElementById('<%= map.ClientID %>'));
// Add a pan control
map.addPanControl();
// Add a slider zoom control
map.addZoomLong();
// Display the map centered on the address specified
map.drawZoomAndCenter(document.getElementById('<%= HiddenField1.ClientID %>').value, 3);
// Create a marker positioned at the address specified
var marker = new YMarker(document.getElementById('<%= HiddenField1.ClientID %>').value, createCustomMarkerImage());
// Add a label to the marker
//marker.addLabel("<blink>*</blink>");
// Call onSmartWinEvent when the user clicks on the marker
YEvent.Capture(marker, EventsList.MouseClick, onSmartWinEvent);
// Display the marker
map.addOverlay(marker);
var words = document.getElementById('<%= HiddenField1.ClientID %>').value;
marker.openSmartWindow(words);
// Add map type control
map.addTypeControl();
// Default map to satellite (YAHOO_MAP_REG) -- other opts: YAHOO_MAP_HYB,YAHOO_MAP_SAT
map.setMapType(YAHOO_MAP_REG);
}
function createCustomMarkerImage() {
var myImage = new YImage();
myImage.src = 'http://l.yimg.com/www.flickr.com/images/dot_splat.png';
myImage.size = new YSize(30, 31);
myImage.offsetSmartWindow = new YCoordPoint(15, 15);
return myImage;
}
</script>
<table width="100%" align="left">
<tr>
<td>
<body onload="onSmartWinEvent()">
<div id="map" class="map" runat="server">
</div>
<asp:HiddenField ID="HiddenField1" runat="server" />
</body>
</td>
</tr>
</table>
注:速度限制性的:Yahoo!阿贾克斯图API是有限的50,000的查询每IP每一天。检查这个的链接 http://developer.yahoo.com/search/rate.html
不隶属于 StackOverflow