简体   繁体   English

Openlayers 3绘图圈

[英]Openlayers 3 drawing circle

I am using openlayers 3 and i am trying to draw a circle, but it doesn't , do i have any mistakes in the code mentioned ??? 我正在使用openlayers 3,并且尝试绘制一个圆,但是没有,我在提到的代码中有任何错误吗?

function DrawCircle() {
            var circleCoordinates = [3210202.3139208322, 5944966.311907868, 3075978.8922520624, 6055647.128864803];
            var circle = new ol.geom.Circle(circleCoordinates);
            var feature = new ol.Feature(circle);

            var id = guid();
            feature.featureID = id;
            feature.setProperties({
                'id': id,
                'name': typeSelect.value,
                'description': 'Some values'
            })
            source.addFeature(feature);
        };

Check the API docs here: http://openlayers.org/en/v3.8.2/apidoc/ol.geom.Circle.html 在此处查看API文档: http : //openlayers.org/en/v3.8.2/apidoc/ol.geom.Circle.html

You're passing the wrong options to the constructor. 您将错误的选项传递给构造函数。

new ol.geom.Circle(center, opt_radius, opt_layout) 新的ol.geom.Circle(中心,opt_radius,opt_layout)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM