内部错误:光栅层没有空间参考。

45
0
昨天
NathanMoebus
通过
新的因素

尝试加载一组PNG光栅文件,但看到以下错误来自LayerViewStateChanged事件。

内部错误:光栅层没有空间参考。

我没有看到任何方法来设置空间引用在栅格层的属性只有一个getter。此外,我有世界文件,在同一目录下的png文件。

private async Task LoadMap() {// create map map myMap = new map (SpatialReference.Create(3857));关联。Basemap = new Basemap(BasemapStyle.ArcGISOceansBase);MyMapView。Map = myMap;MyMapView。LayerViewStateChanged += MyMapView_LayerViewStateChanged;//获取文件名字符串filepath = GetFilesPath();var files =目录。getfile (filepath“* . png”); foreach (var file in files) { // Load the raster file Raster myRasterFile = new Raster(file); // Create the layer RasterLayer myRasterLayer = new RasterLayer(myRasterFile); // Add the layer to the map myMap.OperationalLayers.Add(myRasterLayer); try { // Wait for the layer to load await myRasterLayer.LoadAsync(); // Set the viewpoint await MyMapView.SetViewpointGeometryAsync(myRasterLayer.FullExtent); } catch (Exception e) { MessageBox.Show(e.ToString(), "Error"); } } }

示例-世界文件内容

9.31098696461825
0
0
-18.587360594795538
-9166533.732955951
3235852.4356317967

0荣誉
0回答