[OpenLayers-Users] geometry.getLength() returns what format

Andrew de klerk andrew.deklerk at gmail.com
Mon Dec 10 09:39:50 EST 2007


Tim (or anyone else)

understanding that your code is still in test mode etc, I am trying to
implement your measure control into a panel toolbar, but am battling to
translate your example to what i need. this is what I have so far:

var mt = new OpenLayers.Control.Measure(OpenLayers.Handler.Path, 
        {onMeasure: ShowMeasureDistance,handlerOptions: {'freehand':
false,'persist':true},'displayUnits':'km', 'displayClass': 'MeasureTool'});

panel.addControls([ new OpenLayers.Control.ZoomToMaxExtent(),new
OpenLayers.Control.Navigation(), zb, select,mt,dply,df,dp,seldel ]); 


 function ShowMeasureDistance() {
                  alert("Distance: " + length.toFixed(3) + " " + units);
     } 

Could you give me some guidance as to what the correct syntax should be..

Thanks
Andrew

Tim Schaub wrote:
> 
> Chris Hardin wrote:
>> What does the persist options indicate for a handler option??
> 
> That persist option on the handlers allow the drawn feature to stick 
> around until another one is drawn or the handler is deactivated.
> 
> Note that my sandbox work is not to be used in production environments, 
> not to be considered stable, not to be considered good code, etc.
> 
> The stuff that makes it in to the trunk is good - but that measure stuff 
> only works in limited cases (makes big assumptions about projected 
> areas/lengths).
> 
> Tim
> 
>> 
>> 
>> On 9/5/07, Christopher Schmidt <crschmidt at metacarta.com> wrote:
>>> On Wed, Sep 05, 2007 at 02:00:49PM -0500, Chris Hardin wrote:
>>>> What does getLength() on the geometry object? Is this measurement in
>>>> degrees? I need to convert to mileage or Kilometers.
>>> This measurement is in map units. If you want it in miles, you're going
>>> to want to look at:
>>>
>>> http://dev.openlayers.org/sandbox/tschaub/feature/examples/measure.html
>>> http://dev.openlayers.org/sandbox/tschaub/feature/lib/OpenLayers/Control/Measure.js
>>>
>>> (I do not think these will be in 2.5.)
>>>
>>> Regards,
>>> --
>>> Christopher Schmidt
>>> MetaCarta
>>>
>> 
>> 
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> 

-- 
View this message in context: http://www.nabble.com/geometry.getLength%28%29-returns-what-format-tp12508821p14254117.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list