Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
OpenLayers 2.10 Beginner's Guide

You're reading from   OpenLayers 2.10 Beginner's Guide Create, optimize, and deploy stunning cross-browser web maps with the OpenLayers JavaScript web mapping library

Arrow left icon
Product type Paperback
Published in Mar 2011
Publisher
ISBN-13 9781849514125
Length 372 pages
Edition Edition
Languages
Arrow right icon
Toc

Table of Contents (18) Chapters Close

OpenLayers 2.10
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Getting Started with OpenLayers FREE CHAPTER 2. Squashing Bugs With Firebug 3. The 'Layers' in OpenLayers 4. Wrapping Our Heads Around Projections 5. Interacting with Third Party APIs 6. Taking Control of Controls 7. Styling Controls 8. Charting the Map Class 9. Using Vector Layers 10. Vector Layer Style Guide 11. Making Web Map Apps Index

Time for Action – determining LonLat coordinates


Let's take a look at a couple of examples on coordinates from our previous maps.

  1. Open up the final example from Chapter 1.

  2. Pan around the map in any direction. Then, in Firebug, type:

    map.getCenter();
  3. Depending on where you have panned, your output should read something like this:

    lon=-72.8125, lat=19.6875
    
  4. Now, open up the example from the beginning of this chapter.

  5. Pan around, and then in Firebug type:

    map.getCenter();
  6. You should see something like:

    lon=-9397474.0038099,lat=3595597.9798909
    

What Just Happened?

We just took a look at the longitude and latitude values for the center of the map in two different maps with different projections. When we call map.getCenter(), we get back an OpenLayers LonLat object.

In the first map, the max extent of the map was between -180° and 180° for longitude, and between -90° and 90° for latitude. These are the values used by the EPSG: 4326, and it is a longitude/latitude type of coordinate system. The values for...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime