Xamarin Forms - Initialize map

1201
4
Jump to solution
05-16-2017 12:22 PM
New Contributor II

Hi, 

I just downloaded the Xamarin SDK and I am currently trying to implement some very basic test apps. Is there a way of initializing a map using any of those listed here:

https://www.arcgis.com/home/search.html?t=content&q=tags:streets 

I would like to display the "World street map" map. (https://www.arcgis.com/home/item.html?id=3b93337983e9436f8db950e38a8629af).

Same for "OpenStreetMap" https://www.arcgis.com/home/item.html?id=d415dff75dd042258ceda46f7252ad70 

Thank you,

 Cristian

Reply
0 Kudos
1 Solution

Accepted Solutions
New Contributor

Hi Cristian,

You can create a map from the OpenStreetMap map uri as follows  

Map _map = new Map(new Uri("https://www.arcgis.com/home/item.html?id=d415dff75dd042258ceda46f7252ad70"));  

To create a map displaying the World Street Map you can either 

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

 or 

Map _map = new Map(new Uri("https://www.arcgis.com/home/item.html?id=8bf7167d20924cbf8e25e7b11c7c502c")); 

You will be unable to create Map directly for the URI you linked to https://www.arcgis.com/home/item.html?id=3b93337983e9436f8db950e38a8629af  as it is a Tiled Layer item rather a Map

I'd suggest checking out our samples at https://github.com/Esri/arcgis-runtime-samples-dotnet as well our guide doc and sample code at https://developers.arcgis.com/net/latest/ It's definitely worth while checking out the Map related samples as they cover the various Map constructors and how to use them

Thanks,

Stuart

View solution in original post

4 Replies
New Contributor

Hi Cristian,

You can create a map from the OpenStreetMap map uri as follows  

Map _map = new Map(new Uri("https://www.arcgis.com/home/item.html?id=d415dff75dd042258ceda46f7252ad70"));  

To create a map displaying the World Street Map you can either 

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

 or 

Map _map = new Map(new Uri("https://www.arcgis.com/home/item.html?id=8bf7167d20924cbf8e25e7b11c7c502c")); 

You will be unable to create Map directly for the URI you linked to https://www.arcgis.com/home/item.html?id=3b93337983e9436f8db950e38a8629af  as it is a Tiled Layer item rather a Map

I'd suggest checking out our samples at https://github.com/Esri/arcgis-runtime-samples-dotnet as well our guide doc and sample code at https://developers.arcgis.com/net/latest/ It's definitely worth while checking out the Map related samples as they cover the various Map constructors and how to use them

Thanks,

Stuart

View solution in original post

New Contributor II

Thank you Stuart for the reply. 

The github samples are very useful. I was already using them and they proved to be very useful for some of the other functionalities I was looking for (ex geocoding). I guess I missed the example where the map was being initialized by passing in an online URI - my bad.

Regarding your reply, I had partial success. The World Street Map worked, but the OpenStreetMap did not. I would like to use the the open street map since, in addition to the streets, it also shows the actual buildings.

When initializing using the OpenStreetMap address, the map looks like a grey area (with a grid). I tried zooming in/out, navigating to some test addresses, etc. in order to force a refresh and still nothing.

Would you know why would that happen? I am using a fully updated Google Pixel tablet.

Thank you, 

Cristian

Reply
0 Kudos
New Contributor

Sorry Cristian I've given you some bad information there on the OSM map as I ran a test on our daily build which contains new and developing functionality.

At our last release (100) we did not support OSM layers. However I'm confident that this functionality will likely make the next release which is in a matter of weeks. 

Sorry for the confusion,

Stuart

New Contributor II

Thank you Stuart!

That was very helpful.

Reply
0 Kudos