Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying OpenLayers 2.10 Beginner's Guide
  • Table Of Contents Toc
OpenLayers 2.10 Beginner's Guide

OpenLayers 2.10 Beginner's Guide

4.2 (9)
close
close
OpenLayers 2.10 Beginner's Guide

OpenLayers 2.10 Beginner's Guide

4.2 (9)

Overview of this book

Table of Contents (18 chapters)
close
close
OpenLayers 2.10
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1
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...

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
OpenLayers 2.10 Beginner's Guide
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon