[OpenLayers-Users] Converting distance to map units?

Xingshan He xingshan_he at hotmail.com
Tue May 25 13:25:39 EDT 2010


I am trying to create a circle with fixed radius programatically and am using OpenLayers.Geometry.Polygon.createRegularPolygon(center, radius, sides, angle) to do that.  

I have trouble converting my distance, say 800 feet, to the correct radius value in map units.  This is what I do:

 

var inches = OpenLayers.INCHES_PER_UNIT;

radius = radius * inches["ft"] / inches[map.getUnits()];

 

The circle drawn has smaller radius than what I wanted.  What's the right way of converting real distance to map units?  And by 'map units', does it mean the value returned by map.getUnits()?

 

Thanks for any help.

 

Cynthia
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100525/9778943f/attachment.html


More information about the Users mailing list