爬坑之路---Google map
google.maps.event.adddDomListen(window, 'load', callback);
当文档流中所有的dom加载完成后,执行回调函数,可以不用在script中使用defer和async的模式
<script defer async
src="http://maps.googleapis.com/maps/api/js?key=YOUR_KEY&sensor=false">
</script>
动态的加载script标签
window.onload = function() {
var script = document.createElement('script');
script.type = 'text/javascript';
script.url = url;
//在url中定义参数,决定是否需要回调,&callback=funcName
document.body.appendChild(script);
}
初始化地图
定义地图属性
var mapPro = {
center: {lat: number, lng: number} || google.maps.LatLng(number, number),
zoom: number,
mapType: '地图类型'
}
center 地图中心点位置 经纬度 数据类型为数值(不能填写字符串) 两种格式{lat: number, lng: number} google.maps.LatLng(number, number)
zoom 放大的倍数
mapType 地图的类型 四种 基本格式 Google.maps.MapTypeId.type type {'街道透明层': HYBRID, '普通街道': ROADMAP, '卫星地图': SATELLITE, '具有自然特征': TERRAIN}
坑记录: not a LatLng or LatLngLiteral: in property lat: not a number 类似于center的数据一定是要number的
initMap is not a function 定义于请求google map的参数回调函数没有定义造成
google map marker : new google.maps.Marker({position: '位置, 需要center格式的number数据', map: map, icon: '一个图片'}),多点标记使用循环实现,一个new google.maps.Marker实例是一个点,icon 定义图标
map 指向 map初始化实例
坑记录: 标记不显示,没有报任何错。 --参数名字打错,注意参数名字
google map polyline: new google.maps.Polyline({path, strokeColor, strokeOpacity, strokeWeight, fillColor, fillOpacity, editable})
path: 坐标点集合,数据和上述坐标的数据格式一致
strokeColor: 路径线的颜色
strokeOpacity: 路径线的透明度
strokeOpacity: 路径线的粗细程度
fillColor: 填充的颜色
fillOpacity: 填充的透明度
editable: bool, 路径的线是否可编辑
google map cicle: new google.maps.Circle({center, radius, strokeColor, strokeOpacity, strokeWeight, fillColor, fillOpacity, editable})
google map info: new google.maps.InfoWindow({conent})
消息窗口一般和marker一起使用
infoWindow.open(map, marker);
爬坑之路---Google map的更多相关文章
- 多线程爬坑之路-Thread和Runable源码解析之基本方法的运用实例
前面的文章:多线程爬坑之路-学习多线程需要来了解哪些东西?(concurrent并发包的数据结构和线程池,Locks锁,Atomic原子类) 多线程爬坑之路-Thread和Runable源码解析 前面 ...
- Vue 爬坑之路(六)—— 使用 Vuex + axios 发送请求
Vue 原本有一个官方推荐的 ajax 插件 vue-resource,但是自从 Vue 更新到 2.0 之后,官方就不再更新 vue-resource 目前主流的 Vue 项目,都选择 axios ...
- Vue 爬坑之路(九)—— 用正确的姿势封装组件
迄今为止做的最大的 Vue 项目终于提交测试,天天加班的日子终于告一段落... 在开发过程中,结合 Vue 组件化的特性,开发通用组件是很基础且重要的工作 通用组件必须具备高性能.低耦合的特性 为了满 ...
- Vue 爬坑之路(一)—— 使用 vue-cli 搭建项目
vue-cli 是一个官方发布 vue.js 项目脚手架,使用 vue-cli 可以快速创建 vue 项目,GitHub地址是:https://github.com/vuejs/vue-cli vue ...
- Vue 爬坑之路(十二)—— vue-cli 3.x 搭建项目
Vue Cli 3 官方文档:https://cli.vuejs.org/zh/guide/ 一.安装 @vue/cli 更新到 3.x 之后,vue-cli 的包名从 vue-cli 改成了 @vu ...
- Tinker爬坑之路
目的 热修复去年年底出的时候,变成了今年最火的技术之一.依旧记得去年面试的时候统一的MVP,然而今年却变成了RN,热修复.这不得不导致我们需要随时掌握最新的技术.不然可能随时会被淘汰.记得刚进公司,技 ...
- Android爬坑之路
做了那么久前端,现在终于可以回到我的老本行, 今天我用了一天的时间配置里Android开发环境,mac和windows双平台,eclipse和IDEA双平台,别问为什么,我就喜欢,中间大坑不断,再加上 ...
- 安卓易学,爬坑不易——腾讯老司机的RecyclerView局部刷新爬坑之路
针对手游的性能优化,腾讯WeTest平台的Cube工具提供了基本所有相关指标的检测,为手游进行最高效和准确的测试服务,不断改善玩家的体验.目前功能还在免费开放中. 点击地址:http://wetest ...
- 安卓易学,爬坑不易—腾讯老司机的RecyclerView局部刷新爬坑之路
前言 安卓开发者都知道,RecyclerView比ListView要灵活的多,但不可否认的里面的坑也同样埋了不少人.下面让我们看看腾讯开发工程师用实例讲解自己踩坑时的解决方案和心路历程. 话说有图有真 ...
随机推荐
- 【QT】Installer requires Xcode Version 5.0.0 for Qt download if toolchain not found
When I install QT in MacOS 11.3.6, it prompts I need to install xcode then I install xcode but it wa ...
- [LeetCode] 55. Jump Game_ Medium tag: Dynamic Programming
Given an array of non-negative integers, you are initially positioned at the first index of the arra ...
- layer倒计时弹框/弹层 DEMO
layer.msg("提示语...", { time: 5000, shade: 0.6, success: function (layero, index) { var msg ...
- upCode
更新源码 Sub main() Dim str As String str = "这是测试的字符串对话框" MsgBox str Sheets(1).Select End Sub
- powerdesigner的PDM模型name和comment相互复制替换
在[Tools]-[Execute Commands]-[Edit/Run Script] 下.输入以下命令,这些命令也可以保存起来,扩展名为 vbs ,以便下次使用. 1.name的值复制到comm ...
- Why ngx-uploader doesn't like to cooperate with .net core 2.x?
The POST action seems to have no effect on the .net core controller. If you put [IgnoreAntiforgeryTo ...
- hibernate 调用存储过程返回参数
Connection conn= getSession().connection(); CallableStatement cs=null; //指定调用的存储过程 cs = conn.prepare ...
- gcc Build-in functions
https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html gcc -posix -E -dM - </dev/null
- php读取文件使用redis的pipeline(管道)导入大批量数据
需求:需要做一个后台上传TXT文件,读取其中的内容,然后导入redis库中.要求速度快,并且支持至少10W以上的数据,而内容也就一个字段存类似openid和QQ 传统做法:我一开始做的时候就老套路,遍 ...
- Redis连接池
package com.lee.utils; import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisPool; impor ...