Google Maps

Book description

Create custom applications with the Google Maps API

Featuring step-by-step examples, this practical resource gets you started programming the Google Maps API with JavaScript in no time. Learn how to embed maps on web pages, annotate the embedded maps with your data, generate KML files to store and reuse your map data, and enable client applications to request spatial data through web services.

Google Maps: Power Tools for Maximizing the API explains techniques for visualizing masses of data and animating multiple items on the map. You’ll also find out how to embed Google maps in desktop applications to combine the richness of the Windows interface with the unique features of the API. You can use the numerous samples included throughout this hands-on guide as your starting point for building customized applications.

  • Create map-enabled web pages with a custom look
  • Learn the JavaScript skills required to exploit the Google Maps API
  • Create highly interactive interfaces for mapping applications
  • Embed maps in desktop applications written in .NET
  • Annotate maps with labels, markers, and shapes
  • Understand geodesic paths and shapes and perform geodesic calculations
  • Store geographical data in KML format
  • Add GIS features to mapping applications
  • Store large sets of geography data in databases and perform advanced spatial queries
  • Use web services to request spatial data from within your script on demand
  • Automate the generation of standalone web pages with annotated maps
  • Use the Geocoding and Directions APIs
  • Visualize large data sets using symbols and heatmaps
  • Animate items on a map

Bonus online content includes:

  • A tutorial on The SQL Spatial application
  • A bonus chapter on animating multiple airplanes
  • Three appendices: debugging scripts in the browser; scalable vector graphics; and applying custom styles

Table of contents

  1. Cover 
  2. About the Author
    1. About the Technical Editor
  3. Title Page
  4. Copyright Page
  5. Contents at a Glance
  6. Contents 
  7. Acknowledgments
  8. Introduction
    1. Why This Book?
    2. Who Should Read This Book
    3. What This Book Covers
    4. How to Use This Book
    5. How Is This Book Organized?
  9. Chapter 1: Introduction to Maps and the Google API
    1. Building Map-Driven Applications
      1. The Map Tiles
    2. Cartography 101
      1. The Mercator Projection
    3. A Global Addressing Scheme: Parallels and Meridians
      1. Converting Angles to Length Units
    4. The Google Maps API
      1. Using the Google Maps API
    5. Summary
  10. Chapter 2: Designing Web Pages with Embedded Maps
    1. The Structure of a Web Page
    2. Adding a Map to Your Page
      1. Is Notepad the Editor of Choice?
      2. Map Localization
      3. Zooming with the Mouse
      4. The Map’s Controls
    3. Adding Markers to the Map
    4. A Useful Template for Mapping Pages
      1. Designing the Demo Map Page
    5. Summary
  11. Chapter 3: Web Page Scripting: An Introduction to JavaScript
    1. What Is JavaScript?
      1. How to Test JavaScript Code
      2. JavaScript’s Basic Syntax
    2. Variables and Data Types
      1. Arithmetic Operations
      2. Math Operations
      3. Working with Text
      4. Working with Dates
    3. Control Flow Statements
      1. Conditional Statements
      2. Looping Statements
    4. Functions
    5. Arrays
      1. Array Properties and Methods
    6. Summary
  12. Chapter 4: Advanced JavaScript Topics
    1. Storing Data in Custom Objects
      1. Creating Objects On the Fly
      2. Variables and Objects
      3. Objects and Methods
      4. Prototyping Custom Objects
    2. Custom Objects as Collections
    3. Event Listeners
      1. Passing Information to the Event Listener
      2. Removing an Existing Listener
    4. Closures
    5. Summary
  13. Chapter 5: Google Maps API: The Building Blocks of Mapping Applications
    1. The Google Maps API at a Glance
    2. The google.maps.Map Object
      1. Map Initialization
      2. Map Options
      3. Map Methods
      4. The Marker and InfoWindow Objects
    3. Working with Map Events
      1. The Basic Map Events Application
      2. Drag Events
      3. Mouse Events
      4. State Events
    4. A Customized Map
    5. Adding a Context Menu to the Map
      1. Designing the Context Menu
      2. Displaying the Context Menu
      3. A More Elaborate Context Menu
      4. The Multiple Maps Application
    6. Summary
  14. Chapter 6: Windows Mapping: Embedding Maps in Desktop Applications
    1. Why a Desktop Application
      1. Using Google Maps with Desktop Applications
      2. The WebBrowser Control
    2. The Windows Mapping Application
      1. The Application’s Architecture
      2. Designing the Application
      3. Building the Windows Interface
      4. Adding Custom Functions to the Script
      5. Function Return Values
      6. Notifying the Host Application with Method Calls
    3. The Interaction Model of the Two Components
      1. Initializing the Map
      2. Updating the Interface
      3. Adding the Context Menu
      4. Tracking User Navigation
      5. Adding Markers to the Map
    4. Summary
  15. Chapter 7: Markers: Identifying Locations on the Map
    1. Marking Locations on the Map
      1. Adding a New Marker
    2. Qualifying Markers with InfoWindows
      1. Customizing the Marker’s Icon
      2. Placing Multiple Markers on the Map
    3. The RichMarker Control
      1. Annotating a Map with RichMarkers
    4. An Alternate Approach to InfoWindows
    5. Summary
  16. Chapter 8: Feature Annotation: Drawing Shapes on Maps
    1. Polylines
      1. Polyline Construction
    2. Polygons
      1. Polygons with Holes
      2. Polygon Islands
      3. Displaying a Crosshair on the Map
      4. Rectangles
    3. Circles
      1. Fixed-Size Circles
    4. Storing Paths in MVCArrays
      1. An Editable Polyline
      2. Placing Symbols Along Polylines
    5. Handling Large Paths
    6. Summary
  17. Chapter 9: Interactive Drawing: The Basics of Drawing on Google Maps
    1. Who Needs to Draw on a Map?
    2. A Simple Web Application for Drawing on Maps
      1. Outlining the Interaction Model
      2. A Simple Starting Point
    3. The Interactive Drawing Application
      1. Handling Vertices
      2. Handling Shapes
      3. Customizing the Vertex Icons
      4. Retrieving Shape Data
    4. A Windows Map Drawing Application
      1. Interacting with the Script from a .NET Application
      2. The .NET Code
    5. The Map Tracing Application
      1. How to Use the Application
    6. Summary
  18. Chapter 10: Geodesic Calculations: The Geometry Library
    1. A Quick Overview of the Mercator Projection
    2. Geodesic Lines and Shapes
      1. Defining Geodesic Paths
    3. The Geometry Library
      1. The geometry.spherical Methods
      2. The geometry.poly Functions
      3. Exercising the Geometry Library
      4. Rhumb Lines
    4. Encoded Paths
    5. Summary
  19. Chapter 11: The KML Data Format: Persisting Spatial Data
    1. XML 101
      1. XML Uses Named Delimiters
      2. Nesting XML Elements
      3. Qualifying Elements with Attributes
      4. The Three XML Rules
    2. Understanding KML
      1. The Structure of a KML Document
      2. Viewing KML Files on Google Maps
      3. Tools for Preparing KML Files
      4. Adding a KML Layer to Your Map
      5. Handling KML Events
    3. Organizing Placemarks in Folders
    4. Generating KML Files
    5. Summary
  20. Chapter 12: Adding GIS Features to Mapping Applications
    1. The Simple GIS Application
      1. The Basic Features of the Application
      2. The Desktop Version of Simple GIS
      3. Saving the Map Annotations
    2. Summary
  21. Chapter 13: SQL Spatial: Backend Databases for Spatial Data
    1. Using Tables with Spatial Features
      1. Designing the Sample Tables
      2. Inserting Spatial Data
      3. Outer and Inner Polygons
      4. Handling Data with SQL Server Management Studio
    2. Querying Spatial Data
      1. Calculating Distances
      2. Line Lengths and Polygon Areas
      3. Intersections
      4. Joining Tables on Geo-Coordinates
      5. Additional Spatial Features
    3. Converting Geography Features into JSON Objects
    4. Summary
  22. Chapter 14: Marker Clustering: Handling Many Markers on the Map
    1. Handling Maps with Too Many Markers
      1. Display Markers as You Go
      2. The MarkerClusterer Component
    2. Summary
  23. Chapter 15: Web Services: Updating Maps On the Fly
    1. Web Services
      1. Calling an Existing Web Service
      2. Contacting the Web Service from Within Your Script
      3. Calling XML Web Services
      4. Processing XML Documents in JavaScript
    2. Preparing Spatial Data for the Web
      1. Reading the County Borders
    3. Building a Web Service
    4. Summary
  24. Chapter 16: Map Annotation and Map Generation Techniques
    1. The Process of Preparing Annotated Maps
      1. An Alternate Approach to InfoWindows
      2. Annotating Maps with Labels
      3. Map Generation Techniques
    2. Summary
  25. Chapter 17: More Google Services: The Geocoding and Directions APIs
    1. The Geocoding API
      1. The Geocoding Response
      2. The Response’s Elements
      3. Using the Geocoding API from Within JavaScript
    2. The Directions API
      1. Using the Directions Web Service
      2. The Directions Request and Response
    3. Summary
  26. Chapter 18: Visualizing Large Datasets
    1. Beyond Markers
    2. Visualizing the Earthquakes
      1. Parsing the Earthquake Data
      2. Interacting with the Symbols
    3. Heatmaps
      1. Constructing the Heatmap
    4. Summary
  27. Chapter 19: Animating Items on the Map
    1. Animating Items on a Map
      1. Basic Animation Concepts
    2. JavaScript Animation
      1. The Paris Metro Animated
      2. The Paris Metro Simple Page
      3. Animating All Metro Lines
    3. Summary
  28. Chapter 20: Advanced JavaScript Animation
    1. Scalable Vector Graphics
      1. Creating SVG Icons
      2. Using the SVG Icon
    2. Animated Flights
      1. Scaling the Flight Animation Time
    3. Animated Heatmaps
      1. The Animation Function
      2. Aggregating the Rainfall Values
  29. Index

Product information

  • Title: Google Maps
  • Author(s): Evangelos Petroutsos
  • Release date: March 2014
  • Publisher(s): McGraw-Hill
  • ISBN: 9780071823043