[OpenLayers-Users] defaultDataProjection in ol.format.GeoJSON does not work
Dietmar Stolz
dietmar.stolz at freenet.de
Mon Dec 12 10:13:38 PST 2016
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20161212/7610cddb/attachment.html>
More information about the Users
mailing list