Hello I wanted to ask a question about how I can include an ArcGis feature service. I'm trying to use a certain layer from the services.arcgis.com. But the feature server content are not working compared to map servers? What should I do differently to include the desired layer that isnt a map server but feature server.
I’m assuming the ArcGIS service is returning a WFS layer, correct? In that case, it’s not returning an imagery layer, which is what ArcGisMapServerImageryProvider and other imagery providers show. Currently, I don’t think there is a way to directly load a WFS layer, but there is an available Cesium plugin to load WFS data from a community member.
TerriaJS, which uses Cesium for 3D visualization (and also Leaflet for 2D), has support for WFS and ArcGIS FeatureServers. WFS pretty much works just by constructing a WFS URL to ask the server for GeoJSON. You can find the code here:
ArcGIS FeatureServers are a little more involved. The code is here:
But the most important part is the conversion of Esri REST features to GeoJSON, which is here:
The usual caveats with loading large GeoJSON datasets (i.e. it may be slow and crash your browser).
Kevin, that sounds awesome! I will take a look at the code, when i have time at a desktop, but can you tell me if there is any support built in Terriajs for reprojecting ArcGIS services from projected CRS to WGS84? Our regional and city GIS services are all in state plane feet, and so far useless to me in Cesium. Thanks! -Jon
Hi, it depends exactly what you mean.
For GeoJSON, TerriaJS will reproject vector data in almost any projection to WGS84 by using proj4. There are hooks in GeoJsonDataSource to do the same in pure Cesium if necesary. For Esri FeatureServers, TerriaJS will turn any Esri “wkid” to “urn:ogc:def:crs:EPSG::” and then try to reproject that using proj4.
For raster data, ArcGIS MapServers can usually do the reprojection themselves via the “export” service. However, if a pre-cached tile layer is using an unsupported projection, TerriaJS and Cesium can’t use it. In theory they could still use the (slower) export service instead, if the server supports it (but it may not). You can force it to try using export instead of the pre-cached tiles by passing false for “usePreCachedTilesIfAvailable” to the ArcGisMapServerImageryProvider constructor (TerriaJS will do this automatically).