[OpenLayers-Users] RE measure with 2398

Steve.Toutant at inspq.qc.ca Steve.Toutant at inspq.qc.ca
Thu Sep 24 10:18:54 EDT 2009


Tim,
You might need to provide the proj4js definitions for your map projection 
2398 to use geodesic: true

I already use it to transform coordinates, perhaps it is also required by 
geodesic option. 

If you want to try it, install the library and include theses scripts
<script src="../../../proj4js/lib/proj4js-compressed.js"></script>
<script src="../../../proj4js/lib/defs/EPSG2398.js"></script> 

you'll probably need to create EPSG2398.js, have a look at other 
definition files in the folder.
That works for me.

You can also have a look at this but I never used it.
http://dev.openlayers.org/docs/files/OpenLayers/Util-js.html#Util.distVincenty
Steve





Steve.Toutant at inspq.qc.ca@openlayers.org 
Envoyé par : users-bounces at openlayers.org
24/09/2009 09:28 AM

A
Tim Balschmiter <tb.rostock at googlemail.com>
cc
Users at openlayers.org
Objet
Re: [OpenLayers-Users] RE  measure with 2398









I would try this 

- Remove geodesic:true from the map option 
- set the measure option like this 
  var measureOptions = { 
 persist :true, 
 geodesic: true, 
 handlerOptions : { 
   style :"default" 
} 
} 

hope this helps 
steve 
 



Tim Balschmiter <tb.rostock at googlemail.com> 
24/09/2009 09:06 AM 


A
Steve.Toutant at inspq.qc.ca 
cc
Users at openlayers.org 
Objet
Re: RE [OpenLayers-Users] measure with 2398










Thanks for these answer, but that idea does not work. 
this is my map options: 
  function createMap() { 
            map = new OpenLayers.Map("map",{geodesic: true,projection: 
"EPSG:2398",controls:[],scales:[442943842.5,221471921.25,110735960.625,55367980.3125,27683990.15625,13841995.078125,6920997.5390625, 
3460498.76953125, 1730249.384765625,865124.6923828125, 432562.34619140625, 
216281.17309570312, 108140.58654785156, 
                    54070.29327392578, 10000.0, 5000.0,1000.0],maxExtent: 
new OpenLayers.Bounds(4504884.5,5997999.5,4506172.5,5999757.5)}); 
            return map; 
        } 
 
and that my new measure options: 

  var measureOptions = { 
 handlerOptions : { 
   style :"default", 
 persist :true, 
 projection: "EPSG:2398", 
 geodesic: true 
} 
} 

2009/9/24 <Steve.Toutant at inspq.qc.ca> 

Hi,
Try to add geodesic: true as an option. 
Is EPSG:2398, the projection defined in the option of the map object? 
Steve 



Tim Balschmiter <tb.rostock at googlemail.com>@openlayers.org 
Envoyé par : users-bounces at openlayers.org 
24/09/2009 02:17 AM 


A
Users at openlayers.org 
cc

Objet
[OpenLayers-Users] measure with 2398












Hello list, i am using the measure-option, but i get wrong  distance, if i 
am using projection 2398. 
What can i do to get the right values?! 
thanks for helping me 
tim 
code: 

var measureOptions = { 
 handlerOptions : { 
   style :"default", 
 persist :true, 
 projection: "EPSG:2398" 
} 
} 
var lineMeasure = new OpenLayers.Control.Measure( 
OpenLayers.Handler.Path, measureOptions); 
var polygonMeasure = new OpenLayers.Control.Measure( 
OpenLayers.Handler.Polygon, measureOptions); 

lineMeasure.events.on( { 
"measure" :handleDistanceMeasurements, 
"measurepartial" :handleDistanceMeasurements 
}); 
polygonMeasure.events.on( { 
"measure" :handleAreaMeasurements, 
"measurepartial" :handleAreaMeasurements 
}); 

function handleAreaMeasurements(event) { 
var units = event.units; 
var measure = event.measure; 
var element = document.getElementById('messung'); 
var out = ""; 
out += "Fläche: " + measure.toFixed(3) + " " + units 
+ "<sup>2</sup>"; 
element.innerHTML = out; 
} 
function handleDistanceMeasurements(event) { 
          var units = event.units; 
var measure = event.measure; 
var element = document.getElementById('messung'); 
var out = ""; 
out += "Distanz: " + measure.toFixed(3) + " " + units; 
element.innerHTML = out; 
};_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users




_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090924/c123b195/attachment.html


More information about the Users mailing list