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
Solved! Go to Solution.
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
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!!!