简体   繁体   中英

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 ???

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

You're passing the wrong options to the constructor.

new ol.geom.Circle(center, opt_radius, opt_layout)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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