Book Image

OpenLayers 2.10 Beginner's Guide

Book Image

OpenLayers 2.10 Beginner's Guide

Overview of this book

Table of Contents (18 chapters)
OpenLayers 2.10
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Time for Action – setting up Proj4js.org


This step is similar to the way we set up OpenLayers.

  1. Download Proj4js from http://trac.osgeo.org/proj4js/wiki/Download. At the time of writing, the latest version was proj4js-1.0.1.zip, so go ahead and download it (or whichever the latest version is).

  2. Extract it and copy the proj4js folder to your root code directory (the folder where your OpenLayers.js file is located).

  3. Add the following line in the <head> section of your code after the OpenLayers library inclusion code.

    <script type='text/javascript' src="proj4js/lib/proj4js-combined.js"></script>
  4. Now, open up the page and start Firebug. Type and run the following:

    var test_proj = new Proj4js.Proj('EPSG:4325');
    console.log(test_proj);
  5. You should see output that looks like the following:

    Object { srsCodeInput="EPSG:4325", more...}
    

What Just Happened?

We just included the Proj4js library and tested to see if it worked. If you received an error when you attempted to call new Proj4js.Proj...