Openlayers 3 带有CRS的OpenLayers3 GeoJSON抛出错误

Openlayers 3 带有CRS的OpenLayers3 GeoJSON抛出错误,openlayers-3,proj4js,Openlayers 3,Proj4js,我有一个geoJSON资源,如下所示: { "type": "FeatureCollection", "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, "features": [...] } 当我尝试使用以下方法创建图层时: var myLayer = new ol.layer.Vector( { source: new ol.source.Vector( {

我有一个geoJSON资源,如下所示:

{
"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [...]
}
当我尝试使用以下方法创建图层时:

var myLayer = new ol.layer.Vector( { 
    source: new ol.source.Vector( {
        url: "http://some.closed.api/resource.json",
        format: new ol.format.GeoJSON(),
        strategy: ol.loadingstrategy.bbox
    } )
} );
我收到以下错误,并且GeoJSON未加载到地图中:

Uncaught AssertionError: Assertion failed: transform should be defined
我在本地下载了该文件,并将其放在我的web服务器上,删除“crs”或将其替换为“EPSG:4326”,它可以正常工作


有人能推荐一个不需要将CRS硬编码到我的olSource构造函数中的解决方案吗?

您使用的是自定义OL构建吗?不,我没有使用自定义构建。也许is与GeoJSON的相对url(即data/resource.json)有关?它与在GeoJSON中声明CRS名称的方式有关。尝试在geojson中设置
crs:{“type”:“name”,“properties”:{“name”:“EPSG:4326”},
。我无法控制生产中的JSON,因此无法工作。是否有任何理由通过OGC crs urn进行投影,例如:“urn:OGC:def:crs:OGC:1.3:CRS84?”“不工作?我可以做一些配置来支持这些投影字符串吗?它在文档()中表示支持这些字符串。。。