Book description
Map Scripting 101 uses a project-based approach to teach you how to create useful and fun online map mashups like weather maps and local concert trackers. Author Adam DuVander shows you how to use Mapstraction, an open source JavaScript library, to create and manipulate basic maps by setting zoom levels, showing and hiding markers, geocoding addresses, customizing maps for visitors based on their locales, and so on. You'll also learn to handle complex GIS (geographic information system) data and formats like KML and GeoRSS, and to create graphical overlays to make sense of data and trends. This is a perfect book for any web developer, whether their goal is to build a map to track earthquakes around the world, or to simply mark the best coffee shops in town.
Table of contents
- MAP SCRIPTING 101
- ACKNOWLEDGMENTS
- INTRODUCTION
- 1. MAPPING BASICS
-
2. PLOTTING MARKERS AND MESSAGE BOXES
- #1: Add a Marker to Your Map
- #2: Remove or Hide a Marker
- #3: Show a Message Box When Your Marker Is Clicked
- #4: Show and Hide Message Boxes Without Clicking the Marker
- #5: Create a Custom Icon Marker
- #6: Create Numbered Markers
- #7: Loop Through All Markers
- #8: Determine the Correct Zoom Level to Use Based on Markers
- #9: Filter Out Certain Markers
- #10: Remove or Hide All Markers
- #11: Handle Clusters of Markers
- 3. GEOCODING
-
4. LAYER IT ON
- #16: Draw Lines on a Map
- #17: Draw Shapes on a Map
- #18: Add Circles to Show Search Radius
- #19: Draw a Rectangle to Declare an Area
- #20: Draw Lines Along Clicks
- #21: Color States/Countries on a Map
- #22: Add Custom Controls
- #23: Create Your Own Zoom Interface
- #24: Plot Image Thumbnails on a Map
- #25: Overlay an Image on a Map
- #26: Use Custom Tiles
-
5. HANDLE MAP EVENTS
- Mapstraction's Event Model
- #27: The User Clicks the Map
- #28: The User Drags the Map
- #29: The Zoom Level Changes
- #30: A Marker Is Added to or Removed from the Map
- #31: A Polyline Is Added to or Removed from the Map
- #32: The User Opens or Closes a Message Box
- #33: The User Clicks a Marker
- #34: Return to the Center When the Message Box Is Closed
- #35: The User Moves the Map Outside Preset Bounds
-
6. EXPLORE PROXIMITY
- #36: Calculate Distance Between Two Points
- #37: Find True Distance with Routing
- #38: Create Driving Directions
- #39: Determine Closest Marker
- #40: Find a Point Along a Line
- #41: Plot Local Results on a Map
- #42: Retrieve Local Results with HTTP
- #43: Check Whether a Point Is Within a Bounding Box
- #44: Get a Random Point in a Bounding Box
- #45: Check Whether a Point Is Within a Shape
- #46: Get Nearest Locations from Your Own Database
- 7. USER LOCATION
- 8. DATA FORMATS
-
9. GO SERVER-SIDE
- #59: Install PHP
- #60: A Quick PHP Introduction
- #61: Retrieve a Web Page
- #62: Install MySQL
- #63: Store Locations to a Database
- #64: Import Data from a Spreadsheet
- #65: Use MySQL from PHP
- #66: Plot Locations from a Database
- #67: Get Nearest Locations from a Database
- #68: Get Nearest Locations to a Postal Code
- 10. MASHUP PROJECTS
- A. JAVASCRIPT QUICK START
-
B. MAPSTRACTION REFERENCE
-
Class mxn.Mapstraction
- Function mxn.Mapstraction
- Function addControls
- Function addFilter
- Function addImageOverlay
- Function addLargeControls
- Function addMapTypeControls
- Function addMarker
- Function addMarkerWithData
- Function addOverlay
- Function addPolyline
- Function addPolylineWithData
- Function addSmallControls
- Function addTileLayer
- Function applyOptions
- Function autoCenterAndZoom
- Function centerAndZoomOnPoints
- Function declutterMarkers
- Function doFilter
- Function getAttributeExtremes
- Function getBounds
- Function getCenter
- Function getMap
- Function getMapType
- Function getZoom
- Function getZoomLevelForBoundingBox
- Function polylineCenterAndZoom
- Function removeAllFilters
- Function removeAllMarkers
- Function removeAllPolylines
- Function removeFilter
- Function removeMarker
- Function removePolyline
- Function resizeTo
- Function setBounds
- Function setCenter
- Function setCenterAndZoom
- Function setDebug
- Function setMapType
- Function setOption
- Function setOptions
- Function setZoom
- Function swap
- Function toggleFilter
- Function toggleTileLayer
- Function visibleCenterAndZoom
- Variables in mxn.Mapstraction Class
- Class mxn.BoundingBox
- Class mxn.LatLonPoint
- Class mxn.Marker
- Class mxn.Polyline
- Namespace mxn.util
-
Class mxn.Mapstraction
- About the Author
- UPDATES
Product information
- Title: Map Scripting 101
- Author(s):
- Release date: August 2010
- Publisher(s): No Starch Press
- ISBN: 9781593272715
You might also like
book
Google Maps JavaScript API Cookbook
This book will help you use the amazing resource that is Google Maps to your own …
book
Beginning Google Maps Applications with PHP and Ajax: From Novice to Professional
Until recently, building interactive web-based mapping applications has been a cumbersome affair. This changed when Google …
article
Use Github Copilot for Prompt Engineering
Using GitHub Copilot can feel like magic. The tool automatically fills out entire blocks of code--but …
book
Xcode Treasures
Learn the critical tips and techniques to make using Xcode for the iPhone, iPad, or Mac …