Skip to content

Instantly share code, notes, and snippets.

Created Jan 11, 2017
Embed
What would you like to do?
Minimal example that should load Geotiffs with ArcGIS runtime version 100
using System.Threading.Tasks;
using System.Windows;
using Esri.ArcGISRuntime.Geometry;
using Esri.ArcGISRuntime.LocalServices;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Rasters;
using Esri.ArcGISRuntime.Symbology;
namespace ArcGISMinimal
{
public partial class MainWindow : Window
{
public readonly SpatialReference SpatialRef = new SpatialReference(4326 /* WGS84 */);
public MainWindow()
{
InitializeComponent();
m_MapView.Map = new Map(SpatialRef)
{
InitialViewpoint = new Viewpoint(new MapPoint(11.576, 48.137, SpatialRef), 0.1)
};
Task.Run(async () =>
{
Layer l = null;
// This works...
{
//var localMap = new LocalMapService("C:/arcgis_maps/Test.mpk");
//await localMap.StartAsync();
//l = new ArcGISMapImageLayer(localMap.Url);
}
// This doesn't work
// Image is from: http://eoimages.gsfc.nasa.gov/images/imagerecords/57000/57752/land_shallow_topo_2048.tif
{
var myRaster = new Raster("C:/arcgis_maps/land_shallow_topo_2048.tif");
await myRaster.LoadAsync();
l = new RasterLayer(myRaster);
}
m_MapView.Dispatcher.Invoke(() => m_MapView.Map.OperationalLayers.Add(l));
await l.LoadAsync();
await m_MapView.Dispatcher.InvokeAsync(async () => await m_MapView.SetViewpointScaleAsync(750 * 1000));
});
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment