Hi everyone.
Pretty simple question, does anyone know how I could show a gpkg file as a basemap? The docs haven't helped and a few samples mention geopackages but then use .shp files.
Thanks,
Aaron
Hi,
I saw it earlier but couldn't quite work out how to use it. Could you perhaps provide an example of how to use it with a service or even just locally? Currently with another map system we are able to just provide a url like so "../Diagrams/{z}/{x}/{y}.png"
I believe you may use MosaicDatasetRaster.AddRastersAync() method to add rasters to mosaic dataset. Have you tried this?
MosaicDatasetRaster.AddRastersAsync Method
Thanks Nagma, that works great!
However, I have come to realise that this will not completely fulfill my requirement. Is it possible to use a mosaic file system with ArcGIS .NET? For example, have the image split into many tile PNGs across multiple folders and when you zoom in/out of the map it requests the new tiles from a server using z/x/y parameters?
Hi Aaron,
You could use the code below to display a gpkg file:
Map myMap = new Map();
// Get the full path string geoPackagePath = "..\\..\\AuroraCO.gpkg";
// Open the GeoPackage GeoPackage myGeoPackage = await GeoPackage.OpenAsync(geoPackagePath);
// Read the raster images and get the first one Raster gpkgRaster = myGeoPackage.GeoPackageRasters.FirstOrDefault();
// Make sure an image was found in the package if (gpkgRaster == null) { return; }
// Create a layer to show the raster RasterLayer newLayer = new RasterLayer(gpkgRaster);
await newLayer.LoadAsync(); myMap.Basemap.BaseLayers.Add(newLayer);
MyMapView.Map = myMap; await MyMapView.SetViewpointCenterAsync(39.5517, -104.8589);
Attached is the sample application. Hope that helps.
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.