Hello,
does anyone have any c # code that can load the shapefile into the current map and add the same reference so that it fits well into the original map?
Thank for any advice
To add a data source to your current active map (or another map) you can use the snippet:
public Task<Layer> AddLayer(string uri) { return QueuedTask.Run(() => { Map map = MapView.Active.Map; return LayerFactory.Instance.CreateLayer(new Uri(uri), map); }); }
and you would call the method like this:
var pathToSource = @"c:\temp\test.shp"; Layer lyr = await AddLayer(pathToSource);
and some examples for pathToSource
Thank you!!!
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.