Openlayers 开放层-GeoJSON错误投影
我在加载这样的GeoJSON时遇到了一个问题:Openlayers 开放层-GeoJSON错误投影,openlayers,geojson,projection,Openlayers,Geojson,Projection,我在加载这样的GeoJSON时遇到了一个问题: new OlLayerVector({ source: new OlSourceVector({ url: layer.url, format: new ol.format.GeoJSON({defaultDataProjection: dataProjection, featureProjection}) }) }); 尽管指定了EPSG:32632的投影,但加载的特性占有率很差,而且
new OlLayerVector({
source: new OlSourceVector({
url: layer.url,
format: new ol.format.GeoJSON({defaultDataProjection: dataProjection, featureProjection})
})
});
尽管指定了EPSG:32632的投影,但加载的特性占有率很差,而且太大了
当我在本地加载json时,所有内容都会正确显示:
new OlLayerVector({
source: new OlSourceVector({
features: (new ol.format.GeoJSON()).readFeatures(geoJsonData, {dataProjection, featureProjection});
})
});
Any ideas?
您使用的是哪个版本的OpenLayers
defaultDataProjection
:在版本5中更改为dataProjection
:就是这样。使用dataProjection
有效。但这很奇怪,因为当查看接口时,它的:interface GeoJSONOptions{defaultDataProjection:ol.ProjectionLike;featureProjection:ol.ProjectionLike;geometryName?:string;}
我添加了一个/@ts ignore
,因为它阻止我构建应用程序。您使用的是哪个版本的OpenLayersdefaultDataProjection
:在版本5中更改为dataProjection
:就是这样。使用dataProjection
有效。但这很奇怪,因为在查看接口时,它的:接口GeoJSONOptions{defaultDataProjection:ol.ProjectionLike;featureProjection:ol.ProjectionLike;geometryName?:string;}
我添加了一个/@ts ignore
因为它阻止我构建应用程序