Created
January 11, 2017 07:19
-
-
Save anonymous/b9d10653910f94fd4eede813ad11a697 to your computer and use it in GitHub Desktop.
Minimal example that should load Geotiffs with ArcGIS runtime version 100
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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