Ticket #2455 (closed feature: duplicate)
MeasureToolbar: New toolbar to easily measure
| Reported by: | jorix | Owned by: | tschaub |
|---|---|---|---|
| Priority: | minor | Milestone: | 2.9 Release |
| Component: | Control.Measure | Version: | 2.8 |
| Keywords: | Cc: | ||
| State: |
Description
Why?
To measure with OpenLayers is necessary to use {Control.Measure} but operationalizing it requires some API user effort: search examples, understand the use of handlers and style, know how to display data on the map; too complex for a novice to do well.
I have also done this by creating a toolbar with the {Control.Panel}. I think we can simplify the use of APIs for the beginners, and allows experts to make changes to more features. The code required is only:
toool = new OpenLayers.Control.MeasureToolbar(); map.addControl(toool);
What is it?
MeasureToolbar is a simple toolbar to measure. It is easy to use for end user. It displays a toolbar with buttons help texts. Inherits from: {OpenLayers.Control.Panel}
Characterized by:
- Show the data in the div into Panel, the developer may forget to make a div for this.
- For polygons simultaneously shows the area and perimeter length.
- Allows measurement of features in a vector layers and also reports the name of the feature.
Other features:
- Measures are not rounded to a fixed number of decimals, are showing only the significant digits (default 4, for example shows: 134.2 m, 3.437km or 453,500 km)
- You can copy the text of the measure obtained. It has disabled some mouse events on the div of the measure to allow copying.
- When the option measureLayers is active, the vector layers are automatically detected when calling map.addControl().
- The buttons have title (currently only in English, Spanish and Catalan [my native language])
I suggest small changes in {Control.Measure}. They are necessary for to give length and area simultaneously, and also to allow for measuring a geometry from a vector layers. I passed test for Control/Measure.html correctly in IE8, FF3.5 and CH3.
NOTE: The patch also contains an example of using.
Sorry: My English is bad. I used a machine translation and after that, I reviewed as well as I can.

