Create circles in OpenLayers using freehand mode | Code Chewing

I was running a bit of an experience and wanted to create circle features from a rough sketch when inside of freehand mode with the draw line control. If you don’t know what freehand mode is in OpenLayers, check out my other article on how to draw line strings in freehand mode. So when a user triggers the mouse down event, and sketches an attempt at a circle and then triggers the mouse up event, a circle will be constructed that best fits the dimensions drawn. For an example of this in action, please check out the demo. You’ll be directly inside the draw path mode, so give drawing a circle a go (mouse down, draw, mouse up) and you’ll see it build a circle based on your input. I hope this finds itself useful. Please view the demo for an example of how to draw circles in OpenLayers based on drawn line string paths in freehand mode! Thanks to this article for helping me understand and implement the dynamic circle radius across zoom level changes. Source.

Яндекс.Метрика Рейтинг Free Web Counter
page counter
Last Modified: May 16, 2016 @ 4:16 am