[OpenLayers-Users] correct geodesic measurements?

jorgelopez jorgelopez.physics at gmail.com
Thu Jan 31 07:37:52 PST 2013


Hello everyone:

I am struggling around this topic. I already know that it is not a new topic
but I am confused about geodesic measurements. 

I am developing a widget in my web app that handles measurements of lengths
and areas.

For instance, the map projection is Google EPSG:900913 one. 

In case of length between points (2 or more) and by using Proj4js library,
planar (not geodesic) measurements are OK 

and obviosuly diferent depending on the managed projections, in my case,
900913 and 3035.


BUT BUT 

If I use geodesic property for Control.Measure (geodesic = true), 

are geodesic measurements equals, no matter map projection used ?????
 


This is my snippet:


// event listener

var handleDistanceMeasurements = function(event){
						var units = event.units;
						var measure = event.measure;
						console.log(measure);
                                                var vertices =
event.geometry.getVertices();
                              var linestring900913 = new
OpenLayers.Geometry.LineString(vertices).clone();
                              var vertices3035 = [];
			 for (var i=0; i< vertices.length ; i++){
				var vertPart = vertices[i].transform(proj900913, proj3035);
															
				vertices3035.push(vertPart);
			}
											
		var linestring3035 = new
OpenLayers.Geometry.LineString(vertices3035).clone();
						console.log(this.getLength(linestring900913, 'km'));
						console.log(this.getLength(linestring3035, 'km'));
};	


// handler options

var measureOptions = {
			
            handlerOptions: {
                style: "default",
                layerOptions: {
                    styleMap: new OpenLayers.StyleMap({
                        'default': new OpenLayers.Style({
                            fillColor: '#646464',
                            fillOpacity: 0.4,
                            strokeColor: '#e00000',
                            strokeOpacity: 0.7,
                            strokeWidth: 3,
                            strokeLinecap: 'square',
                            strokeDashstyle: 'dashdot'
                        })
                    })
                },
                persist: true,
                freehandToggle: null
            }, 
		 geodesic: true 	
};


// Control.Measure
var lineMeasure = new OpenLayers.Control.Measure(OpenLayers.Handler.Path,
measureOptions);


// register events
lineMeasure.events.on({
            "measure": handleDistanceMeasurements
});


Thank in advance

Jorge



--
View this message in context: http://osgeo-org.1560.n6.nabble.com/correct-geodesic-measurements-tp5031225.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list