How to reproject feature layer from esri server?

778
2
Jump to solution
04-20-2017 11:04 AM
JosephKane
New Contributor II

Trouble loading feature layer in code behind.  This is in runtime 10.2.7.

In XAML I define my base map as..

<esri:Map>
                <esri:ArcGISTiledMapServiceLayer
                    ServiceUri="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" />

This map layer reports Spatial Reference: 102100 (3857)

Then in the code behind, i try to load the feature layer..

 string endpoint = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Fire/Sheep/FeatureServer/0";
            Uri featUri = new Uri(endpoint);
            var gdbServiceFeatureTable = await ServiceFeatureTable.OpenAsync(featUri);
            gdbServiceFeatureTable.OutFields = Esri.ArcGISRuntime.Tasks.Query.OutFields.All;            
           FeatureLayer fl = new FeatureLayer(gdbServiceFeatureTable) { ID = endpoint };   
           
            MyMapView.Map.Layers.Add(fl);
This map layer reports Spatial Reference: Spatial Reference: 4326
Nothing is visible in the map.
However, if I add this layer via XAML, it is visible.
Any help would be appreciated.
thanks,
joe
0 Kudos
1 Solution

Accepted Solutions
MichaelBranscomb
Esri Frequent Contributor

Hi,

In 10.2.7 you should use one of the OpenAsync methods that takes a Spatial Reference parameter to initialize the ServiceFeatureTable in the SpatialReference of your Map.

ServiceFeatureTable.OpenAsync Method (Uri, String, SpatialReference) 

Cheers

Mike

View solution in original post

0 Kudos
2 Replies
MichaelBranscomb
Esri Frequent Contributor

Hi,

In 10.2.7 you should use one of the OpenAsync methods that takes a Spatial Reference parameter to initialize the ServiceFeatureTable in the SpatialReference of your Map.

ServiceFeatureTable.OpenAsync Method (Uri, String, SpatialReference) 

Cheers

Mike

0 Kudos
JosephKane
New Contributor II

That's it!

Thanks, Mike.

0 Kudos