当前位置: 首页 > news >正文

深圳建设集团股份有限公司济南官网seo推广

深圳建设集团股份有限公司,济南官网seo推广,关键词优化排名易下拉效率,超炫酷网站欣赏使用Google Maps API在网页中显示地图和标记的示例博客。以下是一个简单的示例: C:\pythoncode\blog\google-map-markers-gh-pages\google-map-markers-gh-pages\index.html 介绍: 在本篇博客中,我们将学习如何使用Google Maps API在网页中…

使用Google Maps API在网页中显示地图和标记的示例博客。以下是一个简单的示例:
C:\pythoncode\blog\google-map-markers-gh-pages\google-map-markers-gh-pages\index.html
在这里插入图片描述

介绍:

在本篇博客中,我们将学习如何使用Google Maps API在网页中显示地图,并在地图上添加标记。Google Maps API提供了丰富的功能和灵活性,使我们可以在网页中集成地图和地理信息。

步骤:

  • 创建一个新的HTML文件,并将以下代码保存为index.html
 <!DOCTYPE html>
<html><head><title>Map with Markers and Info Windows</title><meta name="viewport" content="initial-scale=1.0"><meta charset="utf-8"><style>/* Always set the map height explicitly to define the size of the div* element that contains the map. */#map {height: 100%;}/* Optional: Makes the sample page fill the window. */html, body {height: 100%;margin: 0;padding: 0;}</style></head><body><div id="map"></div><script>var poly;
var map;function initMap() {map = new google.maps.Map(document.getElementById('map'), {zoom: 7,center: {lat: 41.879, lng: -87.624}  // Center the map on Chicago, USA.});poly = new google.maps.Polyline({strokeColor: '#000000',strokeOpacity: 1.0,strokeWeight: 3});poly.setMap(map);// Add a listener for the click eventmap.addListener('click', addLatLng);
}// Handles click events on a map, and adds a new point to the Polyline.
function addLatLng(event) {var path = poly.getPath();// Because path is an MVCArray, we can simply append a new coordinate// and it will automatically appear.path.push(event.latLng);// Add a new marker at the new plotted point on the polyline.var marker = new google.maps.Marker({position: event.latLng,title: '#' + path.getLength(),map: map});
}</script><script src="https://cdn.jsdelivr.net/gh/somanchiu/Keyless-Google-Maps-API@v5.9/mapsJavaScriptAPI.js"></script></body>
</html>

请在页面源代码中加入 <script src="https://cdn.jsdelivr.net/gh/somanchiu/Keyless-Google-Maps-API@v5.9/mapsJavaScriptAPI.js">。确保你无需输入Maps JavaScript API,也可使用Google地图服务。

  • 在浏览器中打开index.html文件,你会看到一个地图显示在页面上,并且有一个标记在地图上显示出来。

总结:

在本篇博客中,我们学习了如何使用Google Maps API在网页中显示地图,并添加标记。通过使用Google Maps API和一些简单的JavaScript代码,我们可以轻松地集成地图和地理信息到我们的网页中。

参考

https://github.com/somanchiu/Keyless-Google-Maps-API/tree/master
http://www.noobyard.com/article/p-txwklxur-bm.html

http://www.yayakq.cn/news/233253/

相关文章:

  • 网站风格设计要素程序员自己做网站
  • 云南网站开发公司推荐网站软文制作
  • 小型网站开发要多少钱凡客诚品官方网
  • oto电子商务网站建设发电机出租技术支持 东莞网站建设
  • 南京企业做网站投资建设网站
  • 如何备案网站河源市住房建设局网站
  • 视频网站做漫画东营建筑信息网
  • 校园网站建设整改建议wordpress不能翻页
  • 通辽网站网站建设广州百度竞价外包
  • 扬州大发网站建设photoshop下载免费版
  • 中山市西区建设局网站soho外贸网站建设
  • 培训网站 建公司网站有哪些重要性
  • 提升政务网站建设水平家具设计培训
  • 网站建设开发上线流程关键词歌词图片
  • 建设部网站 合同格式wordpress的排版
  • 杭州cms建站模板下载单页关键词优化费用
  • 田阳县建设局网站便宜网站建设怎么样
  • 做网站入什么科目网站的稳定性
  • 网站怎么赚钱的简单的网页制作软件
  • 中信银行门户网站系统wordpress侧栏文本代码
  • 深圳英文网站制作搜索排名优化
  • 如何查看一个网站是否备案自媒体采集网站建设
  • 网站怎样做百度推广阳江北京网站建设
  • 临沂市建设局网站改版网站建设都是需要什么软件
  • 食堂网站建设长春网络公司宣传
  • 网站逻辑结构优化是指广西建设教育学会网站
  • 建站之星源码下载沈阳凯鸿网站建设
  • 做app还是做网站合适6东莞公司注册登记
  • 网站开发需要哪些软件无锡百度推广平台
  • 金色 网站 模板专业搜索引擎seo公司