0

I've used ol.interactin.Draw to draw and save features in GeoJSON format. But the drawn features are stored in EPGS:3857 and my preference is WGS 84. For that, I've used this snippet code to apply dataProjection and featureProjection properties but nothing has been changed.

draw = new ol.interaction.Draw({
        source: vectorSource,
        type: selectedType.value
    });

    draw.on('drawend', function (evt) {

        var extraFeature = evt.feature; 
        var features = vectorSource.getFeatures();
        var allFeatures = features.concat(extraFeature);

        featuresGeoJSON = parser.writeFeatures(allFeatures, {
            dataProjection: 'EPSG:3857',
            featureProjection: 'EPSG:4326'
        });
});

1 Answer 1

1

You have a typo, it is EPSG (not EPGS)

1
  • It was a mistake but the problem was not related to that. I switched dataProjection with featureProjection and it worked fine. Commented Mar 4, 2018 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.