Beginning Google Maps Applications with PHP and Ajax: From Novice to Professional

Beginning Google Maps Applications with PHP and Ajax: From Novice to Professional

Jeffrey Sambells, Michael Purvis, Cameron Turner

Language: English

Pages: 384

ISBN: 1590597079

Format: PDF / Kindle (mobi) / ePub

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.


















all cases, it’s a matter of instantiating the control object, and then adding it to the map with the GMap2 object’s addControl() method. For example, here’s how to add the small map control, which you can see as part of the next example in Listing 2-5: map.addControl(new GSmallMapControl()); You use an identical process to add all the controls: simply pass in a new instance of the control’s class. ■Note What does instantiating mean? In object-oriented programming, a class is like a blueprint for

mean anything. For the geocaching map, you want to be sure there is information associated with each point, so you need to save all the information in one request. ■Caution Don’t confuse the GMap2.openInfoWindow() method with the GMarker.openInfoWindow() method. The map and marker objects have similar properties and methods; however, their parameters differ. You need to use the GMap2 methods when creating info windows attached to the map itself, but if you have an existing marker, you could then

in the chapter, you’ll be retrieving all the XML at once and wrapping it in a parent node, so you’ll end up with a valid XML result: Since you’re going to retrieve all the XML without any matching or searching to determine which bits to retrieve, it makes sense to store the data in one file in the format

little red dots and customize them to use whatever image you like. Rather than looking at a red marker, you can add a small icon of the find (Figure 3-15). 59 7079ch03.qxd 60 7/26/06 4:56 PM Page 60 CHAPTER 3 ■ INTERACTING WITH THE USER AND THE SERVER Figure 3-15. Different marker icons on a map To use the GIcon object, you are required to set a minimum of three properties: • GIcon.image: URL of the image • GIcon.iconSize: Size of the image in pixels • GIcon.iconAnchor: Location of the

aren’t shown due to the restrictions of the central point location, as shown in Figure 7-3. Figure 7-3. A map missing the available data outside the viewable area 7079ch07FINAL.qxd 7/25/06 1:45 PM Page 157 CHAPTER 7 ■ OPTIMIZING AND SCALING FOR LARGE DATA SETS Some maps we’ve seen use “closest to the center” of the map to filter points. This imposes the same ambiguity, as the map actually contains much more information but it’s simply ignored. When using the server-side common point

Download sample