Google Maps JavaScript API Cookbook

Google Maps JavaScript API Cookbook

Alper Dincer, Balkan Uraz

Language: English

Pages: 316

ISBN: 1849698821

Format: PDF / Kindle (mobi) / ePub


This book will help you use the amazing resource that is Google Maps to your own ends. From showing maps on mobiles to creating GIS applications, this lively, recipe-packed guide is all you need.

Overview

  • Add to your website's functionality by utilizing Google Maps' power
  • Full of code examples and screenshots for practical and efficient learning
  • Empowers you to build your own mapping application from the ground up

In Detail

Day by day, the use of location data is becoming more and more popular, and Google is one of the main game changers in this area. The Google Maps JavaScript API is one of the most functional and robust mapping APIs used among Geo developers. With Google Maps, you can build location-based apps, maps for mobile apps, visualize geospatial data, and customize your own maps.

Google Maps API Cookbook is a practical, hands-on guide that provides you with a number of clear, step-by-step recipes that will help you to unleash the capabilities of the Google Maps JavaScript API in conjunction with open source or commercial GIS servers and services through a number of practical examples of real world scenarios.

This book begins by covering the essentials of including simple maps for Web and mobile, adding vector and raster layers, styling your own base maps, creating your own controls and responding to events, and including your own events.

You will learn how to integrate open source or commercial GIS servers and services including ArcGIS Server, GeoServer, CartoDB, Fusion Tables, and Google Maps Engine with the Google Maps JavaScript API. You will also extend the Google Maps JavaScript API to push its capabilities to the limit with additional libraries and services including geometry, AdSense, geocoding, directions, and StreetView.

This book covers everything you need to know about creating a web map or GIS applications using the Google Maps JavaScript API on multiple platforms.

What you will learn from this book

  • Create simple maps and display them on mobile devices
  • Style your own base maps
  • Add your own tile maps as base maps or overlays
  • Show vector layers on base maps in various types such as points, polylines or polygons
  • Parse various vector formats such as KML, GeoRSS, GeoJSON, WKT, and so on
  • Create a custom UI and customize your own ways to control it
  • Respond to various events including mobile gestures
  • Add additional libraries to extend the capabilities of the API
  • Work with Google Services for geocoding, directions, StreetView, and so on
  • Integrate open source or commercial GIS servers or services

Approach

Google Maps API Cookbook follows a fast-paced, high-level, structured cookbook approach, with minimal theory and an abundance of practical, real-world examples explained in a thorough yet concise manner to help you learn quickly and efficiently.

Who this book is written for

Google Maps API Cookbook is for developers who wish to learn how to do anything from adding a simple embedded map to a website to developing complex GIS applications with the Google Maps JavaScript API. It is targeted at JavaScript developers who know how to get by but who are also seeking the immediacy of recipe-based advice.

CSS Essentials

Agile Web Development with Rails (4th edition)

Dreamweaver CC Digital Classroom

Joe Celko's Thinking in Sets: Auxiliary, Temporal, and Virtual Tables in SQL (The Morgan Kaufmann Series in Data Management Systems)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

zoom level property in the bounds object, we have an array of x and y tile coordinates, x being the first and y being the second. Inside these arrays, the lower and upper bounds for the tile coordinates are found. At this point, you may be wondering how these specific numbers are found: var bounds = { var bounds = { 17: [[20969, 20970], [50657, 50658]], ... } These numbers are actually the tile coordinates that intersect with the boundaries of the Moscone Center as shown in the following

API does not try to fetch tiles that do not intersect with the boundaries of the building plan. Changing the transparency of overlays The Google Maps JavaScript API supports third-party tiled map services or images to be overlaid on top of base maps. However, there is a problem with the overlay layers; they come on top of base maps and make them invisible. Of course, you can turn them on or off according to your choice; however, this is not a solution if you want to see the base maps together

create our own context menu class. First, we will define the ContextMenu class with its constructor as follows: function ContextMenuClass (map) { this.setMap(map); this.map = map; this.mapDiv = map.getDiv(); this.menuDiv = null; }; Then, we will set a prototype of the ContextMenu class to an object created from the google.maps.OverlayView class: ContextMenuClass.prototype = new google.maps.OverlayView(); The google.maps.OverlayView class has three methods to be implemented in our newly created

https://developers.google.com/maps/documentation/ utilities/polylinealgorithm By using the geometry library, you can encode and decode the paths of polylines and polygons. This recipe will show you how to encode and decode the paths of the polylines and polygons. Getting ready It would be handy to have a quick glance at the first recipe—Drawing shapes on the map—of this chapter, as it covers every detail on how to draw a shape using the Google Maps JavaScript API. 181 Google Maps JavaScript

have access to the complete code with all the omitted lines from the Packt Publishing website (http://www.packtpub.com/support) Creating a simple fullscreen map Applications can be mapped in different formats. Some of them show a map after a mouse click or an event, and some of them are shown directly in fullscreen mode. This recipe will show you how to create a fullscreen map that will be used both in web or mobile applications. Getting ready As stated before, some recipes will show only the

Download sample

Download