GeoJsonDataSource - message: "Unknown crs name: urn:ogc:def:crs:EPSG::4326"

Wehen i try to add json from my geoserver to Cesium viwer with code bellow:

var viewer = new Cesium.Viewer('cesiumContainer', {
    sceneMode : Cesium.SceneMode.SCENE2D,
    timeline : false,
    animation : false
});

var dataSource = Cesium.GeoJsonDataSource.load(‘http://localhost:8200/geoserver/SrbijaAdmGranice/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=SrbijaAdmGranice:SRB_AdministrativneGranice_Level2_3909&srsName=EPSG:4326&outputFormat=json’);
viewer.dataSources.add(dataSource);
viewer.zoomTo(dataSource);

I gate this error : Unknown crs name: urn:ogc:def:crs:EPSG::4326

What should i do?
Do I need some more property in .load function?

Thanks forward.

Hey, yesterday I’ve encountered the same issue but I was able to workaround it.

In GeoJsonDataSource.crsNames static property there are two default coordinate references systems defined, both for WGS84.

var crsNames = {

‘urn:ogc:def:crs:OGC:1.3:CRS84’ : defaultCrsFunction,

‘EPSG:4326’ : defaultCrsFunction

};

``

As far as I understand the issue, there’s this another GML representation of EPSG:4326, which happens to be urn:ogc:def:crs:EPSG::4326 but isn’t included in the default CRS names.

This is how geoserver returns GeoJson when making WFS requests, just like in your example.

There are multiple solution to this :

  1. My first (and ugly) solution was to load your geojson and manipulate it’s crs object to conform to the crs names that supported by Cesium before passing to GeoJsonDataSource, like this :
    // Get your geojson from geoserver or wherever it is stored
    var geojson = loadYourGeoJson();
    // Change the projection to match the one supported by Cesium
    geojson.crs.properties.name = “EPSG:4326”;
    // Load the geojson
    Cesium.GeoJsonDataSource.load(geojson);

``

  1. My second approach was to add the CRS name to the static property on the GeoJsonDataSource, since it’s the same projection we can reuse the same function
    // Just add our CRS to the crs names and point it to the same function
    Cesium.GeoJsonDataSource.crsNames[‘urn:ogc:def:crs:EPSG::4326’] = Cesium.GeoJsonDataSource.crsNames[“EPSG:4326”];

``

  1. My third solution would be to ask Cesium guys to simply add this CRS name to the defaults since it seems to be just another representation of those that are already there
    var crsNames = {

‘urn:ogc:def:crs:OGC:1.3:CRS84’ : defaultCrsFunction,

‘EPSG:4326’ : defaultCrsFunction,
‘urn:ogc:def:crs:EPSG::4326’ : defaultCrsFunction

};

``

Hello,

That seems reasonable. Thanks for the info!

Could you open a pull request with your third solution? Here’s some info in contributing: https://github.com/AnalyticalGraphicsInc/cesium/blob/master/CONTRIBUTING.md

Thanks!

Hannah

Actually that was my intention :slight_smile:

I’ll sign the CLA and read the contributions guide