AnsweredAssumed Answered

Layer reprojection in ArcGIS Runtime .NET SDK 100.0.0

Question asked by RystadEnergy on Mar 16, 2017
Latest reply on Mar 17, 2017 by RystadEnergy

I have a map with basemap in Spatial Reference = 54030 (Robinson) which is displayed in map viewer. Now I am trying to load a feature layer from the ArcGIS Portal. This layer has WebMercator SpatialReference = 3857 and I am trying to reproject it on the fly which doesn't seem to work.

I am referring to the guide Spatial references—ArcGIS Runtime SDK for .NET | ArcGIS for Developers, paragraph

Feature layers from feature services

When using a feature service table created from a feature service from ArcGIS Online or ArcGIS Enterprise, the service supports reprojection. Set its spatial reference to the same as the map's spatial reference before you initialize the table. This ensures the data is requested from the service in the correct spatial reference. When adding an ArcGIS feature layer to the map, ArcGIS Runtime automatically determines the correct spatial reference and requests data from the feature service accordingly.

According to the guide, I should be able to set SpatialReference either on service feature table, or service layer, but it is not possible. I tried also to make reprojection manually:

FeatureCollectionTable reprojectedCollectionTable = new FeatureCollectionTable(featureTable.Fields, featureTable.GeometryType, Map.SpatialReference) {Title = featureTable.TableName};
FeatureCollection featureCollection = new FeatureCollection(new List<FeatureCollectionTable> { reprojectedCollectionTable });
FeatureCollectionLayer layer = new FeatureCollectionLayer(featureCollection) { Name = reprojectedCollectionTable.Title };
_map.OperationalLayers.Add(layer);

That also doesn't work. How can I reproject layer and add to the map?

Thanks.

Outcomes