Google Map开发(一) ASP.NET中调用Google Map API实现简单的地图显示

本文介绍了如何在ASP.NET中使用Google Maps API来显示地图。首先,你需要注册并获取API密钥,然后在网页的JavaScript中加载API,并在<head>标签内放置API密钥。接着,通过修改网页的HTML和添加JavaScript代码,设置地图的中心位置、控件和显示样式。最后,运行网站,地图将会成功显示。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 


1、注册gooogle map api key

输入网址http://www.google.com/apis/maps/

google map api主页

在页面的右面点击注册一个Gooogle地图API密钥

在新的页面中进行如下设置并点击生成API密钥。其中我的网址可以是域名、IP,建议调试的时候为http://localhost申请一个Key,便于测试和修改。

点击生成API密钥后进入到如下页面,注意记录下自己申请的Key和示例代码。

下面即为我们注册的Key 查看地址:http://code.google.com/intl/zh-CN/apis/maps/signup.html

Thank You for Signing Up for a Google Maps API Key!

Your key is:

ABQIAAAArE134c2Mr3M29FkARzPFlRT2yXp_ZAY8_ufC3CFXhHIE1NvwkxR48vLPcCXKDxOOw0-JDlZzbOdQxA

Note: for more information on the API key system, consult http://code.google.com/apis/maps/faq.html#keysystem.

How you use your key depends on what Maps API product or service you use. Your key is valid for use within the entire family of Google Maps API solutions. The following examples show how to use your key within the Maps API product family.

JavaScript Maps API Example

Within the JavaScript Maps API, place the key within the script tag when you load the API:

...
  // Note: you will need to replace the sensor parameter below with either an explicit true or false value.
  <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=true_or_false&amp;key=ABQIAAAArE134c2Mr3M29FkARzPFlRT2yXp_ZAY8_ufC3CFXhHIE1NvwkxR48vLPcCXKDxOOw0-JDlZzbOdQxA" type="text/javascript"></script>
...

See Loading the Maps API in the JavaScript Maps API documentation for more information.

Maps API for Flash Example

Within the Maps API for Flash, you may place the key within an MXML declarati

评论 12
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值