Google maps api demo 2
demo
/**
* @fileoverview Sample showing capturing a KML file click
* and displaying the contents in a side panel instead of
* an InfoWindow
*/ var map;
var src = 'https://developers.google.com/maps/tutorials/kml/westcampus.kml'; /**
* Initializes the map and calls the function that creates polylines.
*/
function initialize() {
map = new google.maps.Map(document.getElementById('map-canvas'), {
center: new google.maps.LatLng(-19.257753, 146.823688),
zoom: 2,
mapTypeId: google.maps.MapTypeId.TERRAIN
});
loadKmlLayer(src, map);
} /**
* Adds a KMLLayer based on the URL passed. Clicking on a marker
* results in the balloon content being loaded into the right-hand div.
* @param {string} src A URL for a KML file.
*/
function loadKmlLayer(src, map) {
var kmlLayer = new google.maps.KmlLayer(src, {
suppressInfoWindows: true,
preserveViewport: false,
map: map
});
google.maps.event.addListener(kmlLayer, 'click', function(event) {
var content = event.featureData.infoWindowHtml;
var testimonial = document.getElementById('capture');
testimonial.innerHTML = content;
});
} google.maps.event.addDomListener(window, 'load', initialize);
westcampus.kml
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>KmlFile</name>
<Style id="west_campus_style">
<IconStyle>
<Icon>
<href>https://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png
</href>
</Icon>
</IconStyle>
<BalloonStyle>
<text>$[video]</text>
</BalloonStyle>
</Style>
<Placemark>
<name>Google West Campus 1</name>
<styleUrl>#west_campus_style</styleUrl>
<ExtendedData>
<Data name="video">
<value><![CDATA[<iframe width="480" height="360"
src="https://www.youtube.com/embed/ZE8ODPL2VPI" frameborder="0"
allowfullscreen></iframe><br><br>]]></value>
</Data>
</ExtendedData>
<Point>
<coordinates>-122.0914977709329,37.42390182131783,0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Google West Campus 2</name>
<styleUrl>#west_campus_style</styleUrl>
<ExtendedData>
<Data name="video">
<value><![CDATA[<iframe width="480" height="360"
src="https://www.youtube.com/embed/nb4gvrNrDWw" frameborder="0"
allowfullscreen></iframe><br><br>]]></value>
</Data>
</ExtendedData>
<Point>
<coordinates>-122.0926995893311,37.42419403634421,0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Google West Campus 3</name>
<styleUrl>#west_campus_style</styleUrl>
<ExtendedData>
<Data name="video">
<value><![CDATA[<iframe width="480" height="360"
src="https://www.youtube.com/embed/0hhiEjf7_NA" frameborder="0"
allowfullscreen></iframe><br><br>]]></value>
</Data>
</ExtendedData>
<Point>
<coordinates>-122.0922532985281,37.42301710721216,0</coordinates>
</Point>
</Placemark>
</Document>
</kml>
Google maps api demo 2的更多相关文章
- Google maps api demo
demo: <!DOCTYPE html> <html> <head> <meta name="viewport" content=&qu ...
- Google Maps API V3 之绘图库 信息窗口
Google官方教程: Google 地图 API V3 使用入门 Google 地图 API V3 针对移动设备进行开发 Google 地图 API V3 之事件 Google 地图 API V3 ...
- Google Maps API V3 之 图层
Google官方教程: Google 地图 API V3 使用入门 Google 地图 API V3 针对移动设备进行开发 Google 地图 API V3 之事件 Google 地图 API V3 ...
- Google Maps API V3 之 路线服务
Google官方教程: Google 地图 API V3 使用入门 Google 地图 API V3 针对移动设备进行开发 Google 地图 API V3 之事件 Google 地图 API V3 ...
- google maps api申请的问题
现在已经改由统一的GOOGLE API控制台进行所有GOOGLE API的管理了. 方法是使用Google帐号登入 https://code.google.com/apis/console. 然后在所 ...
- Google maps API开发(一)(转)
一.加载Google maps API <script type="text/javascript" src="http://ditu.google.com/map ...
- Google maps API开发(二)(转)
这一篇主要实现怎么调用Google maps API中的地址解析核心类GClientGeocoder: 主要功能包括地址解析.反向解析.本地搜索.周边搜索等, 我这里主要有两个实例: 实例一.当你搜索 ...
- Google Maps API Web Services
原文:Google Maps API Web Services 摘自:https://developers.google.com/maps/documentation/webservices/ Goo ...
- Google maps API开发
原文:Google maps API开发 Google maps API开发(一) 最近做一个小东西用到google map,突击了一下,收获不小,把自己学习的一些小例子记录下来吧 一.加载Googl ...
随机推荐
- 65、TextView 字体设置不同颜色 --- 未完
mTextView.setText(Html.fromHtml("教练评论" + "<font color='#b0b0b0'>" + " ...
- 第二只Python爬虫
同样参照网上教程,同时把会的不多的html标签又复习了一下 同时安利一个网站,我唯一加入过的一个社团官网(web开发协会 www.nutjs.com 前任会长是属于大牛级的存在,目前网站已多次重构,花 ...
- AtCoder Tak and Hotels
题目链接:传送门 题目大意:有 n 个点排成一条直线,每次行动可以移动不超过 L 的距离,每次行动完成必须停在点上, 数据保证有解,有 m 组询问,问从 x 到 y 最少需要几次行动? 题目思路:倍增 ...
- 【VUE】VUE相关学习和知识备份
一.学习资料参考 1.1.Vue.js 官网:Vue.js https://cn.vuejs.org/ 官方文档:介绍 - Vue.js https://cn.vuejs.org/v2/guide/ ...
- 如何看懂ORACLE执行计划
如何看懂Oracle执行计划 一.什么是执行计划 An explain plan is a representation of the access path that is taken when a ...
- css的常用知识点
一.css的引入方式 1.行内引入 直接在标签中定义样式 <p style="background-color: red">test</p> 2.嵌入式引入 ...
- 解决chrome在ubuntu+root模式下打不开的问题
chrome在ubuntu root模式下打不开 双击图标,chrome打不开了: 解决办法: 查看一下打开chrome浏览器的命令是什么,右键properties 发现是chromium-brows ...
- linkText()的用法
1.linkText()常用于定位链接,以谷歌的gmail为例: WebElement gmailLink = driver.findElement(By.linkText("Gmail&q ...
- 流畅的python 符合python风格的对象
对象表示形式 每门面向对象的语言至少都有一种获取对象的字符串表示形式的标准方式.Python 提供了两种方式. repr() 以便于开发者理解的方式返回对象的字符串表示形式.str() 以便于用户理解 ...
- Linux一键安装web环境全攻略(阿里云ECS服务器)
摘自阿里云服务器官网,此处 一键安装包下载: 点此下载 安装须知 1.此安装包可在阿里云所有linux系统上部署安装,此安装包包含的软件及版本为: nginx:1.0.15.1.2.5.1.4.4 a ...