Beginning Google Maps Applications with PHP and Ajax - M. Purvis, Jeffrey Sambells, C Turner

Beginning Google Maps Applications with PHP and Ajax

From Novice to Professional
Buch | Softcover
358 Seiten
2006
Apress (Verlag)
978-1-59059-707-1 (ISBN)
32,09 inkl. MwSt
zur Neuauflage
  • Titel erscheint in neuer Auflage
  • Artikel merken
Zu diesem Artikel existiert eine Nachauflage
"Google Maps Application Development" deals with computers/software.
There is much to like about this book. The explanations are straightforward, the code is readable, the examples are relevant, and the writing style is approachable. - Michael J. Ross, Web developer/Slashdot contributor Until recently, building interactive web-based mapping applications has been a cumbersome affair. This changed when Google released its powerful Maps API. Beginning Google Maps Applications with PHP and Ajax was written to help you take advantage of this technology in your own endeavorswhether you're an enthusiast playing for fun or a professional building for profit. This book covers version 2 of the API, including Google's new Geocoding service. Authors Jeffrey Sambells, Cameron Turner, and Michael Purvis get rolling with examples that require hardly any code at all, but you'll quickly become acquainted with many facets of the Maps API. They demonstrate powerful methods for simultaneously plotting large data sets, creating your own map overlays, and harvesting and geocoding sets of addresses. You'll see how to set up alternative tile sets and where to access imagery to use for them.
The authors even show you how to build your own geocoder from scratch, for those high-volume batch jobs. As well as providing hands-on examples of real mapping projects, this book supplies a complete reference for the Maps API, along with the relevant aspects of JavaScript, CSS, PHP, and SQL. Visit the authors' website for additional tips and advice.

Jeffrey Sambells?is a graphic designer and self-taught web applications developer best known for his unique ability to merge the visual world of graphics with the mental realm of code. With a bachelor of technology degree in graphic communications management along with a minor in multimedia, Jeffrey was originally trained for the traditional paper-and-ink printing industry, but he soon realized the world of pixels and code was where his ideas would prosper. In late 1999, he cofounded We-Create, Inc., an Internet software company based in Waterloo, Ontario, which began many long nights of challenging and creative innovation. Currently, as director of research and development for We-Create, Jeffrey is responsible for investigating new and emerging Internet technologies and integrating them using web standards-compliant methods. In late 2005, he also became a Zend Certified Engineer. When not playing at the office, Jeffrey enjoys a variety of hobbies from photography to woodworking. When the opportunity arises, he also enjoys floating in a canoe on the lakes of Algonquin Provincial Park or going on an adventurous, map-free, drive with his wife. Jeffrey also maintains a personal website at JeffreySambells.com, where he shares thoughts, ideas, and opinions about web technologies, photography, design, and more. He lives in Ontario, Canada, eh, with his wife, Stephanie, his daughter, Addison, and their little dog, Milo.

Beginning Google Maps Applications with PHP and Ajax From Novice to Professional Michael Purvis Jeffrey Sambells and Cameron Turner Beginning Google Maps Applications with PHP and Ajax: From Novice to Professional Copyright (c) 2006 by Michael Purvis, Jeffrey Sambells, and Cameron Turner All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. ISBN-13 (pbk): 978-1-59059-707-1 ISBN-10 (pbk): 1-59059-707-9 Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1 Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. Lead Editor: Jason Gilmore Technical Reviewer: Terrill Dent Editorial Board: Steve Anglin, Ewan Buckingham, Gary Cornell, Jason Gilmore, Jonathan Gennick, Jonathan Hassell, James Huddleston, Chris Mills, Matthew Moodie, Dominic Shakeshaft, Jim Sumser, Keir Thomas, Matt Wade Project Manager: Elizabeth Seymour Copy Edit Manager: Nicole LeClerc Copy Editor: Marilyn Smith Assistant Production Director: Kari Brooks-Copony Production Editor: Katie Stence Compositor: Kinetic Publishing Services, LLC Proofreader: Liz Welch Indexer: Beth Palmer Cover Designer: Kurt Krames Manufacturing Director: Tom Debolski Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail orders-ny@springer-sbm.com, or visit http://www.springeronline.com. For information on translations, please contact Apress directly at 2560 Ninth Street, Suite 219, Berkeley, CA 94710. Phone 510-549-5930, fax 510-549-5939, e-mail info@apress.com, or visit http://www.apress.com. The information in this book is distributed on an as is basis, without warranty. Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work. The source code for this book is available to readers at http://www.apress.com in the Source Code section or at the official book site, http://googlemapsbook.com. Contents Foreword ... xv About the Authors ... xix About the Technical Reviewer ... xxi Acknowledgments ... xxiii PART 1 - - - Your First Google Maps -CHAPTER 1 Introducing Google Maps... 3 KML: Your First Map ... 3 Wayfaring: Your Second Map... 5 Adding the First Point ... 6 Adding the Flight Route ... 7 Adding the Destination Point ... 8 Adding a Driving Route ... 9 What s Next? ... 10 -CHAPTER 2 Getting Started ... 13 The First Map ... 13 Keying Up ... 13 Examining the Sample Map ... 15 Specifying a New Location... 16 Separating Code from Content ... 18 Cleaning Up... 20 Basic Interaction ... 21 Using Map Control Widgets ... 21 Creating Markers ... 21 Opening Info Windows ... 23 A List of Points ... 26 Using Arrays and Objects ... 26 Iterating ... 28 Summary ... 29 vii -CHAPTER 3 Interacting with the User and the Server... 31 Going on a Treasure Hunt... 32 Creating the Map and Marking Points ... 33 Starting the Map ... 33 Listening to User Events ... 35 Asking for More Information with an Info Window... 37 Creating an Info Window on the Map ... 38 Embedding a Form into the Info Window... 39 Avoiding an Ambiguous State ... 44 Controlling the Info Window Size... 46 Using Google s Ajax Object... 48 Saving Data with GXmlHttp ... 49 Parsing the XML Document Using DOM Methods ... 54 Retrieving Markers from the Server ... 57 Adding Some Flair ... 59 Summary ... 62 -CHAPTER 4 Geocoding Addresses... 63 Creating an XML File with the Address Data... 63 Using Geocoding Web Services... 65 Requirements for Consuming Geocoding Services ... 66 The Google Maps API Geocoder ... 67 The Yahoo Geocoding API ... 75 Geocoder.us ... 80 Geocoder.ca ... 83 Services for Geocoding Addresses Outside Google s Coverage... 85 Caching Lookups ... 86 Building a Store Location Map ... 90 Summary ... 93 PART 2 - - - Beyond the Basics -CHAPTER 5 Manipulating Third-Party Data... 97 Using Downloadable Text Files ... 97 Downloading the Database ... 98 Parsing CSV Data ... 101 Optimizing the Import ... 102 Using Your New Database Schema... 106 -CONTENTS viii Screen Scraping ... 113 A Scraping Example ... 114 Screen Scraping Considerations ... 117 Summary ... 118 -CHAPTER 6 Improving the User Interface... 119 CSS: A Touch of Style ... 119 Maximizing Your Map ... 120 Adding Hovering Toolbars... 121 Creating Collapsible Side Panels... 124 Scripted Style ... 126 Switching Up the Body Classes... 126 Resizing with the Power of JavaScript... 129 Populating the Side Panel... 131 Getting Side Panel Feedback ... 134 Warning, Now Loading ... 136 Data Point Filtering ... 139 Showing and Hiding Points ... 140 Discovering Groupings ... 140 Creating Filter Buttons ... 141 Summary ... 143 -CHAPTER 7 Optimizing and Scaling for Large Data Sets ... 145 Understanding the Limitations ... 145 Streamlining Server-Client Communications ... 146 Optimizing Server-Side Processing ... 148 Server-Side Boundary Method ... 149 Server-Side Common Point Method ... 155 Server-Side Clustering ... 161 Custom Detail Overlay Method ... 167 Custom Tile Method... 176 Optimizing the Client-Side User Experience ... 186 Client-Side Boundary Method ... 187 Client-Side Closest to a Common Point Method... 188 Client-Side Clustering ... 191 Further Optimizations ... 196 Summary ... 198 -CONTENTS ix -CHAPTER 8 What s Next for the Google Maps API? ... 199 Driving Directions ... 199 Integrated Google Services ... 200 KML Data ... 202 More Data Layers ... 202 Beyond the Enterprise ... 204 Interface Improvements ... 204 Summary ... 205 PART 3 - - - Advanced Map Features and Methods -CHAPTER 9 Advanced Tips and Tricks ... 209 Debugging Maps ... 209 Interacting with the Map from the API ... 210 Helping You Find Your Place ... 211 Force Triggering Events with GEvent ... 212 Creating Your Own Events ... 214 Creating Map Objects with GOverlay ... 214 Choosing the Pane for the Overlay ... 214 Creating a Quick Tool Tip Overlay ... 216 Creating Custom Controls ... 220 Creating the Control Object ... 222 Creating the Container ... 222 Positioning the Container ... 222 Using the Control ... 223 Adding Tabs to Info Windows... 223 Creating a Tabbed Info Window... 224 Gathering Info Window Information and Changing Tabs ... 226 Creating a Custom Info Window ... 226 Creating the Overlay Object and Containers ... 232 Drawing a LittleInfoWindow... 232 Implementing Your Own Map Type, Tiles, and Projection ... 237 GMapType: Gluing It Together ... 237 GProjection: Locating Where Things Are ... 238 GTileLayer: Viewing Images ... 244 The Blue Marble Map: Putting It All Together ... 247 Summary ... 258 -CONTENTS x -CHAPTER 10 Lines, Lengths, and Areas ... 261 Starting Flat ... 261 Lengths and Angles ... 262 Areas ... 263 Moving to Spheres ... 266 The Great Circle ... 266 Great-Circle Lengths ... 268 Area on a Spherical Surface ... 269 Working with Polylines ... 274 Building the Polylines Demo ... 274 Expanding the Polylines Demo ... 280 What About UTM Coordinates? ... 281 Running Afoul of the Date Line ... 283 Summary ... 284 -CHAPTER 11 Advanced Geocoding Topics ... 285 Where Does the Data Come From? ... 285 Sample Data from Government Sources ... 286 Sources of Raw GIS Data ... 289 Geocoding Based on Postal Codes ... 290 Grabbing the TIGER/Line by the Tail ... 294 Understanding and Defining the Data ... 295 Parsing and Importing the Data... 299 Building a Geocoding Service ... 305 Summary ... 311 PART 4 - - - Appendixes -APPENDIX A Finding the Data You Want ... 315 Knowing What to Look For: Search Tips ... 315 Finding the Information... 315 Specifying Search Terms ... 316 Watching for Errors ... 316 The Cat Came Back: Revisiting the TIGER/Line ... 316 More on Airports ... 318 The Government Standard: The Geonames Data ... 319 Shake, Rattle, and Roll: The NOAA Goldmine ... 319 -CONTENTS xi For the Space Aficionado in You ... 321 Crater Impacts ... 321 UFO/UAP Sightings ... 322 -APPENDIX B Google Maps API ... 323 class GMap2... 323 GMap2 Constructor ... 323 GMap2 Methods... 324 class GMapOptions ... 328 GMapOptions Properties... 328 enum GMapPane ... 328 GMapPane Constants ... 329 class GKeyboardHandler ... 329 GKeyboardHandler Bindings ... 329 GKeyboardHandler Constructor ... 329 interface GOverlay ... 329 GOverlay Constructor ... 330 GOverlay Static Method ... 330 GOverlay Abstract Methods ... 330 class GInfoWindow ... 330 GInfoWindow Methods ... 330 GInfoWindow Event ... 331 class GInfoWindowTab ... 331 GInfoWindowTab Constructor... 331 class GInfoWindowOptions... 331 GInfoWindowOptions Properties ... 331 class GMarker ... 331 GMarker Constructor... 332 GMarker Methods ... 332 GMarker Events ... 332 class GMarkerOptions... 333 GMarkerOptions Properties ... 333 class GPolyline ... 333 GPolyline Constructor ... 333 GPolyline Methods ... 333 GPolyline Event... 334 class GIcon ... 334 GIcon Constructor ... 334 GIcon Constant ... 334 GIcon Properties... 334 -CONTENTS xii class GPoint ... 335 GPoint Constructor... 335 GPoint Properties ... 335 GPoint Methods ... 335 class GSize ... 335 GSize Constructor ... 336 GSize Properties... 336 GSize Methods ... 336 class GBounds ... 336 GBounds Constructor ... 336 GBounds Properties... 336 GBounds Methods ... 336 class GLatLng... 337 GLatLng Constructor ... 337 GLatLng Methods... 337 GLatLng Properties ... 338 class GLatLngBounds ... 338 GLatLngBounds Constructor ... 338 GLatLngBounds Methods ... 338 interface GControl ... 339 GControl Constructor... 339 GControl Methods ... 339 class GControl ... 339 GControl Constructors ... 339 class GControlPosition ... 339 GControlPosition Constructor ... 340 enum GControlAnchor... 340 GControlAnchor Constants ... 340 class GMapType... 340 GMapType Constructor ... 340 GMapType Methods... 340 GMapType Constants ... 341 GMapType Event ... 341 class GMapTypeOptions ... 341 GMapTypeOptions Properties... 342 interface GTileLayer ... 342 GTileLayer Constructor ... 342 GTileLayer Methods... 342 GTileLayer Event ... 343 -CONTENTS xiii class GCopyrightCollection... 343 GCopyrightCollection Constructor ... 343 GCopyrightCollection Methods... 343 GCopyrightCollection Event ... 343 class GCopyright ... 343 GCopyright Constructor... 343 GCopyright Properties ... 344 interface GProjection... 344 GProjection Methods ... 344 class GMercatorProjection ... 344 GMercatorProjection Constructor ... 344 GMercatorProjection Methods ... 345 namespace GEvent ... 345 GEvent Static Methods ... 345 GEvent Event... 346 class GEventListener... 346 namespace GXmlHttp ... 346 GXmlHttp Static Method ... 346 namespace GXml... 346 GXml Static Methods... 347 class GXslt ... 347 GXslt Static Methods ... 347 namespace GLog... 347 GLog Static Methods ... 347 enum GGeoStatusCode... 347 GGeoStatusCode Constants ... 348 class GClientGeocoder ... 348 GClientGeocoder Constructor... 348 GClientGeocoder Methods ... 348 class GGeocodeCache ... 348 GGeocodeCache Constructor ... 349 GGeocodeCache Methods ... 349 class GFactualGeocodeCache ... 349 GFactualGeocodeCache Constructor ... 349 GFactualGeocodeCache Method ... 349 Functions ... 349 -INDEX ... 351 -CONTENTS xiv

Erscheint lt. Verlag 14.8.2006
Verlagsort Berkley
Sprache englisch
Maße 185 x 230 mm
Themenwelt Mathematik / Informatik Informatik Betriebssysteme / Server
Mathematik / Informatik Informatik Software Entwicklung
Mathematik / Informatik Informatik Web / Internet
ISBN-10 1-59059-707-9 / 1590597079
ISBN-13 978-1-59059-707-1 / 9781590597071
Zustand Neuware
Haben Sie eine Frage zum Produkt?
Mehr entdecken
aus dem Bereich