Reputation: 409
I'm new to OpenLayers and I need to draw a Circle when I call a method. Something like:
<div id="map"></div>
<button id="addcircle">Add Circle!</button>
addCircle(long, lat, radius){
//Draw circle
}
$('#addcircle').click(function () {
map.addCircle(-53,24,5000);
});
I'm having trouble to decide which kind of circle to use.
I found these:
I would like to know the difference between them and which one I should use.
Thank you!
Obs: I'm using OL v3.7.0 Sorry, I'm also new in SO, so I couldn't post a third link =/
Upvotes: 0
Views: 1079
Reputation: 5647
You can forget about the third method, that's for letting the user draw geometries on the map.
Whether you use the first or the second method depends on how you want the circle to look or be stored. The first draws a circle on the surface of the earth, so it may look elliptical if it covers a large area. It stores the circle as polygon. The second is the simplest, it draws a circle on the map, and stores it with center and radius.
Upvotes: 1