Search code examples
google-mapsopenlayersopenlayers-3ol3-google-maps

Circle not draw in Google Maps with OpenLayers


I am trying to draw a circle in OpenLayers using Google Maps (olGM). I don´t know why it not draw a circle, because in OSM working perfectly.

var circle = new ol.geom.Circle(ol.proj.transform([latd, lond], 'EPSG:4326', 
'EPSG:3857'), 1000);
var center = circle.getCenter();
var CircleFeature = new ol.Feature(circle);

Edit again. Finally I could to draw the Circle. But, my question is, how can I access to Radius and Center from Circle1? And modifying Circle1, I modify Circle in the same time.

I am using:

var circle1 = new ol.geom.Circle(ol.proj.transform([latd, lond], 
'EPSG:4326', 'EPSG:3857'), radius);
var circle = new ol.geom.Polygon.fromCircle(circle1, 232, 0);
var CircleFeature = new ol.Feature(circle);

Solution

  • Circle geometries are currently not supported in ol3-google-maps, see: https://github.com/mapgears/ol3-google-maps/blob/master/LIMITATIONS.md#circle-geometry

    If you wish to contribute it, you can create a pull request on the library's GitHub.