博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Google Maps Application Developing —— Quick Start
阅读量:6239 次
发布时间:2019-06-22

本文共 2361 字,大约阅读时间需要 7 分钟。

Brief Preface

        There are some fatal steps to make the Google Map working. First of all , add a reference of Google Maps API in the head element:

        Second , make the code run while page loading:

        As you see, the last sentence code is most important.  To initialize the object Map need two parameters, one is a HTML element which used to be a div, the other parameter is an object conclude some customizations associated with the final appearance of the map in web pages.

Introduce to mapOptions

        I would like to introduce some very useful options to customize the map's performance.

1. disableDefaultUI

        By setting this property to true, you will disable the default user interface.

2. mapTypeControl

        With this property, you can control whether the mapTypeControl will be displayed. The mapTypeControl is positioned in the upper-right coner of the map.

3. mapTypeControlOption

        This object has three properties: style, position, mapTypeIds

style: HORIZONTAL_BAR(default), DROPDOWN_MENU

position: BOTTOM, BOTTOM_LEFT, BOTTOM_RIGHT, LEFT, RIGHT, TOP, TOP_LEFT, TOP_RIGHT

mapTypeIds: google.maps.MapTypeId.ROADMAP, google.maps.MapTypeId.SATELLITE

4. navigationControl

        This property displays or hides the navigation control.

5. navigationControlOptions

position

style: SAMLL(default), ANDROID, ZOOM_PAN

6. scaleControl

7. scaleControlOptions

        With this property, you can control how the scale control will be displayed. Just like the NavigationControlOptions, ScaleControlOptions has two properties, position and style.

8. keyboardShortcut

        This property enables or disables the ability to use the keyboard to use the keyboard to navigate and zoom the map.

9. disableDoubleClickZoom

10. draggable

11. scrollwheel

12. streetViewControl

Use Method to Control Map Settings

        You can control the map setting while the map is been initialing, some methods can do this either. For example , there is a method called setOptions() which is very useful:

var mapOptions = {	zoom: 12};map.setOptions(mapOptions);

        To get the current zoom level , there's a method called getZoom(). It returns a number that indicates the current zoom level. To set the zoom level, use setZoom().

        By parity of reasoning, you can use getCenter(0 and setCenter(latlng:Latlng) to get and change the center of the map. getMapTypeId() and setMapTypeId(mapTypeId:MapTypeId) are available to get and set the mapType.

转载地址:http://uvdia.baihongyu.com/

你可能感兴趣的文章
【转】深入理解 C# 协变和逆变
查看>>
第六次作业
查看>>
UML
查看>>
9.[Java开发之路](6)File类的使用
查看>>
折半插入排序(binary insertion sort)
查看>>
打包常见问题
查看>>
javascript解析json
查看>>
在Ubuntu下编译WebKit源码
查看>>
amazeui 移动开发
查看>>
python2 与python3中最大的区别(编码问题bytes&str
查看>>
HDU 2243 AC自动机+DP+矩阵
查看>>
什么叫脱字符合^
查看>>
git版本控制管理实践-2
查看>>
HTTP基础知识(三)
查看>>
如何有效释放DB2所占的磁盘空间?
查看>>
三分法
查看>>
第 8 章 容器网络 - 058 - flannel 概述
查看>>
Mongodb删除collection
查看>>
ArcEngine应用程序中无法实现TOC图层多选
查看>>
Java-笔记9-复习
查看>>