defaultDataProjection in ol.format.GeoJSON does not work

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

defaultDataProjection in ol.format.GeoJSON does not work

Dietmar Stolz-2

Hi,

since API v3.18.0 it's not longer possible to transform feature coordinates with defaultDataProjection and featureProjection:

  source: new ol.source.Vector({
   format: new ol.format.GeoJSON({defaultDataProjection:'EPSG:3857',featureProjection:'EPSG:25832'}),
   url: 'file.geojson'
  })
 
I can only transform with readFeatures():

var e_bike = new ol.layer.Vector({
 source: new ol.source.Vector()
});
$.ajax('file.geojson').then(function(response) {
  var geojsonFormat = new ol.format.GeoJSON();
  var features = geojsonFormat.readFeatures(response,{dataProjection:'EPSG:25832',featureProjection:'EPSG:3857'});
  e_bike.getSource().addFeatures(features);
});

Tested up to v3.20.0 API.

Thanks for your help!

Dietmar.


_______________________________________________
Users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/openlayers-users