O'Reilly logo

OpenLayers Cookbook by Antonio Santiago Perez

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Measuring distances and areas

The capability to measure distances or areas is an important thing on many GIS applications.

In this recipe, we are going to see in action what the Measure control in OpenLayers offers to the developer.

The application will show a simple map with some buttons on top, as shown in the following screenshot. The Measure toggle button activates or deactivates the control, while the radio buttons bring us the possibility to select what to measure: a path or an area:

Measuring distances and areas

In addition, we can set two control options. The Geodesic control indicates if the distance of the area computation must be in geodesic metrics instead of planar. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required