ASP.NET Google Maps Javascript API V3 实战基础篇一地址解析
来源:互联网 发布:卷皮版淘宝客程序 编辑:程序博客网 时间:2024/05/16 09:01
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Geocoding_Sample.aspx.cs"
Inherits="Samples.Services.Geocoding_Sample" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>地址解析</title>
<style type="text/css">
#maps
{
height: 450px;
}
</style>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&language=zh-CN"></script>
<script language="javascript" type="text/javascript">
var geocoder; //申明地址解析对象
var map;
function initialize() {
geocoder = new google.maps.Geocoder(); //实例化地址解析对象
var LatLng = new google.maps.LatLng(-34.397, 150.644);
var Options = {
zoom: 8, center: LatLng, mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("maps"), Options);
}
//地址解析函数 ,如果解析成功将地图中心设置到解析地址,并在该处创建标记
function codeAddress() {
var address = document.getElementById("address").value;
if (geocoder) {
geocoder.geocode(
{ "address": address },
function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker(
{
map: map, position: results[0].geometry.location
});
} else {
alert("不能进行地址解析,原因如下:" + status);
}
}
);
}
}
//将地图初始化函数绑定到window的load事件
google.maps.event.addDomListener(window, "load", initialize);
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input id="address" type="text" value="Sydney, NSW" />
<input id="geocoding" type="button" value="解析" onclick="codeAddress();" />
</div>
<div id="maps">
</div>
</form>
</body>
</html>
- ASP.NET Google Maps Javascript API V3 实战基础篇一地址解析
- ASP.NET Google Maps Javascript API V3 实战基础篇一反向地址解析
- ASP.NET Google Maps Javascript API V3 实战基础篇一简单显示地图
- ASP.NET Google Maps Javascript API V3 实战基础篇一检测用户位置
- ASP.NET Google Maps Javascript API V3 实战基础篇一语言本地化
- ASP.NET Google Maps Javascript API V3 实战基础篇一地图事件
- ASP.NET Google Maps Javascript API V3 实战基础篇一访问用户界面事件中的参数
- ASP.NET Google Maps Javascript API V3 实战基础篇一停用默认用户界面
- ASP.NET Google Maps Javascript API V3 实战基础篇一控件选项
- ASP.NET Google Maps Javascript API V3 实战基础篇一控件定位
- ASP.NET Google Maps Javascript API V3 实战基础篇一自定义控件示例
- ASP.NET Google Maps Javascript API V3 实战基础篇一为控件添加状态
- ASP.NET Google Maps Javascript API V3 实战基础篇一添加叠加层
- ASP.NET Google Maps Javascript API V3 实战基础篇一叠加层显示控制
- ASP.NET Google Maps Javascript API V3 实战基础篇一创建图标
- ASP.NET Google Maps Javascript API V3 实战基础篇一复杂图标
- ASP.NET Google Maps Javascript API V3 实战基础篇一折线
- ASP.NET Google Maps Javascript API V3 实战基础篇一动态创建折线
- 怎样破解局域网限制
- Linux内置字符串处理
- 飞鸽传书网站最新改版
- 无聊~看看TCP/IP笔记(1)
- 看文献
- ASP.NET Google Maps Javascript API V3 实战基础篇一地址解析
- 新版飞鸽传书简述
- 『Raptor』SD2C大会流水帐
- 飞鸽传书内网传输好伙伴
- oracle 中Schema
- 【Oracle】利用管道导入用户数据
- 『Raptor』SD2C之网格与云计算
- ajax +javascript 查询数据库
- BREW内存调试-BPOINT-----转载