OpenLayers Book
OpenLayers -OpenLayers 2.10 Beginner's Guide
The aim of this book is to provide a guide for beginners and also serve as a reference (but not a replacement for the OpenLayers docs). We use examples throughout the book to deomstrate OpenLayers concepts. This site will serve as extension for the OpenLayers book and contain code samples, error fixes, and other related things.Buy the OpenLayers Book
Published by Packt Publishing.Free Sample Chapter
Free Download of Chapter 9, "Using Vector Layers"Chapter 9, "Using Vector Layers", contains information on how to set up and use the vector layer. We cover how to work with feature objects, load in data from geospatial files (e.g., GeoJSON and KML), use the Strategy classes (such as the Cluster strategy), and much more.
Code Files
Download OpenLayers Book Source Code (.zip archive)The source code files are grouped by chapter and example. To download the code, click the link above.
Errata
Errors in the book are listed below. If you find any errors, please email me. Thanks!
Page 22
On the description for line 20, it says
"Line [20]: map.addLayer(wms);"
It should say:
"Line [20]: map.addLayer(wms_layer);"
Page 150 In the description of OverviewMap functions, it mentioned "layer switcher" control when it should instead mention the overview map control
Page 160 On line 7 in the Description column, there is a typo: "OpenLayers.Contro.lTYPE_TOGGLE"
It should read "OpenLayers.Control.TYPE_TOGGLE"
Page 162 In the code example, "var my_button" should read "var control_button"
Page 189 The link for ExtJS should read "http://www.sencha.com/products/extjs/"
Page 207 In step 2 of Time for Action, there is a misplaced semi-colon typo:
"map.panTo(new OpenLayers.LonLat (-18,42) ; )" should read
"map.panTo(new OpenLayers.LonLat (-18,42)); "
Page 221 "var map1, map2;" shoud be "var map_1, map_2;"
Page 254 The description of Geometry.LinearRing reads "pass in an array of LineString...", but it should read "pass in an array of Points..."
Page 271 In the code, "Create a format object var format_...." should have a comment tag "//Create a format object"
Page 272 5. should read "Put the code below after map.addLayer."
Page 278 "A symbolizer is just an an ..." should read "A symbolizer is just an ..."
Page 293 6. uses an incorrect variable name: "feature_symbolizers_lookup);" should read "symbolizers_lookup);"
Page 315 Typo in 4. "extractAttribtues" -> should be "extractAttributes"
"Line [20]: map.addLayer(wms);"
It should say:
"Line [20]: map.addLayer(wms_layer);"
Page 150 In the description of OverviewMap functions, it mentioned "layer switcher" control when it should instead mention the overview map control
Page 160 On line 7 in the Description column, there is a typo: "OpenLayers.Contro.lTYPE_TOGGLE"
It should read "OpenLayers.Control.TYPE_TOGGLE"
Page 162 In the code example, "var my_button" should read "var control_button"
Page 189 The link for ExtJS should read "http://www.sencha.com/products/extjs/"
Page 207 In step 2 of Time for Action, there is a misplaced semi-colon typo:
"map.panTo(new OpenLayers.LonLat (-18,42) ; )" should read
"map.panTo(new OpenLayers.LonLat (-18,42)); "
Page 221 "var map1, map2;" shoud be "var map_1, map_2;"
Page 254 The description of Geometry.LinearRing reads "pass in an array of LineString...", but it should read "pass in an array of Points..."
Page 271 In the code, "Create a format object var format_...." should have a comment tag "//Create a format object"
Page 272 5. should read "Put the code below after map.addLayer."
Page 278 "A symbolizer is just an an ..." should read "A symbolizer is just an ..."
Page 293 6. uses an incorrect variable name: "feature_symbolizers_lookup);" should read "symbolizers_lookup);"
Page 315 Typo in 4. "extractAttribtues" -> should be "extractAttributes"