Select to view content in your preferred language

xamarin android map.Loaded handler reports LoadFailed, 7001 "missing spatial reference" sporadically

1076
3
Jump to solution
02-11-2020 04:45 PM
ITS_JohnColaneri
Emerging Contributor

What can I do to mitigate this server error on AGOL. There doesn't appear to be a way where I can set a spatial reference. Here's my boilerplate in OnCreate:

_myMapView = new MapView(Activity);
_myMapView.InteractionOptions = new MapViewInteractionOptions
{
   IsMagnifierEnabled = false
};
Basemap bm = null;
bm = new Basemap(new Uri(Resources.GetText(Resource.String.uri_map_basemap)));
Debug.Assert(bm != null, "Shizen!! BaseMap is null!!");
_map = new Map(bm);

_map.LoadStatusChanged += OnMapsLoadStatusChanged;
_myMapView.Map = _map;

This works usually, but sometimes (varying percentage based on the weather I suppose) throws a rod:

debugger locals window

Breakpoint is at the top of _map.Loaded handler.

VisualStudio 2019; EsriArcGISRuntime v 100.6, EsriArcGISRuntime.ToolKit v 100.4, EsriArcGISRuntime.Xamarin.Android v 100.6

I test on a Samsung Galaxy S8

Here's the connexn URI: USA_Topo_Maps (MapServer)  

0 Kudos
1 Solution

Accepted Solutions
dotMorten_esri
Esri Notable Contributor

TBH I'm a little (but pleasantly) surprised that URL can be used for a Basemap, as that's the endpoint for a layer and not a basemap item. The API reference even indicate that shouldn't have worked 🙂

Anyway, as a workaround, you could try forcing the SR instead :

var bm = new Basemap(new ArcGISTiledLayer(new Uri("https://services.arcgisonline.com/ArcGIS/rest/services/USA_Topo_Maps/MapServer"));
Map map = new Map(SpatialReferences.WebMercator) { Basemap = bm };


You could also try not forcing the SR, but create the Basemap as I did above, and see if that resolves your issue (just to confirm if there's something hokey about using the basemap constructor with a service uri instead of a basemap uri):


Map map = new Map(bm);

View solution in original post

3 Replies
dotMorten_esri
Esri Notable Contributor

TBH I'm a little (but pleasantly) surprised that URL can be used for a Basemap, as that's the endpoint for a layer and not a basemap item. The API reference even indicate that shouldn't have worked 🙂

Anyway, as a workaround, you could try forcing the SR instead :

var bm = new Basemap(new ArcGISTiledLayer(new Uri("https://services.arcgisonline.com/ArcGIS/rest/services/USA_Topo_Maps/MapServer"));
Map map = new Map(SpatialReferences.WebMercator) { Basemap = bm };


You could also try not forcing the SR, but create the Basemap as I did above, and see if that resolves your issue (just to confirm if there's something hokey about using the basemap constructor with a service uri instead of a basemap uri):


Map map = new Map(bm);

ITS_JohnColaneri
Emerging Contributor

So, I updated the libraries, and I added this part:

... new ArcGISTiledLayer( ...

I got a little side-tracked and I don't think I've seen that particular problem again, but I'll monitor it for a couple days.

0 Kudos
ITS_JohnColaneri
Emerging Contributor

I haven't seen the mysterious map load issue again, but curiously, I had to back the library updates down to the ones reported on the initial post. The app started consistently failing route solves inexplicably. This code:

RouteTask solveRouteTask = await RouteTask.CreateAsync(uri);

Jumps out of the middle of the method without triggering a catch clause.  ????

I'll mark your answer as correct.

0 Kudos