Select to view content in your preferred language

Xamarin Forms – displaying mapserver problem

1015
2
08-09-2017 10:07 AM
kbheadley
Deactivated User

I am trying to get a simple overlay working in Xamarin Forms (all code in shared folder) with Esri.ArcGISRuntime SDK v100.1.0, using VS.NET 2017, testing the Android project.  I load an ESRI basemap, then add a busmap/transitmap as a layer on top of that.  I have tried various types of layers.  In all 3 cases, when I monitor the layerviewstatus, it goes from “loading” to “error”.   I do get the basemap to display, but nothing is overlayed. Am I going about this the right way, or could someone suggest a way to get the actual “error” that is being generated?   Thanks so much in advance.

Here is my code for the tiledLayerUri, imageLayerUri, featureLayerUri:

Map myMap = new Map(Basemap.CreateStreets());

var tiledLayerUri = new Uri(              "https://gissbservices.suffolkcountyny.gov/arcgis/rest/services/BusMap/MapServer");

 ArcGISTiledLayer tiledLayer = new ArcGISTiledLayer(tiledLayerUri);

 tiledLayer.Name = "Tiled Layer";

 myMap.OperationalLayers.Add(tiledLayer);

 

var imageLayerUri = new Uri(            "https://gissbservices.suffolkcountyny.gov/arcgis/rest/services/SCTransitRouteStops/MapServer");

ArcGISMapImageLayer imageLayer = new ArcGISMapImageLayer(imageLayerUri)

imageLayer.Name = "Image Layer";

imageLayer.MinScale = 40000000;

imageLayer.MaxScale = 2000000;

myMap.OperationalLayers.Add(imageLayer);

 

 

 var featureLayerUri = new Uri(              "https://gissbservices.suffolkcountyny.gov/arcgis/rest/services/SCTransitRouteStops/MapServer/1");

FeatureLayer myFeatureLayer = new FeatureLayer(featureLayerUri);

myFeatureLayer.Name = "Feature Layer";

myMap.OperationalLayers.Add(myFeatureLayer);

 

0 Kudos
2 Replies
NagmaYasmin
Esri Contributor

Hi,

You Bus Map service is a dynamic layer but you added as ArcGISTiledLayer instead ArcGISImageLayer and the SCTransitRouteStops isn't dynamic layer but you added  as ArcGISImageLayer. I added the correct way and am able to see your layer.ArcGISImageLayer

Hope that helps.

Nagma

kbheadley
Deactivated User

Nagma – Thank you for responding!  I copied your code and am able to see both layers on a basemap in a WPF solution, the same you used in your testing.

 

But the same code in Xamarin Forms, running on an Android physical device, still gives me the same “Error” status in the layerviewstatus.

 

I have tried some sample layer services, such as “arcgis/rest/services/Census/MapServer”, and they work as expected, so I don’t think it is permissions in the AndroidManifest.xml file.

 

Any other suggestions would be appreciated!

0 Kudos