I need to check for the existence of a raster in the project database. Does anyone have the C# code for ArcGIS Pro?
Hi Sam,
Try code below. FilePath is your raster path in geodatabase. Instead of creating layer you can do what you want
private Task AddToMap() { return QueuedTask.Run(() => { try { // first we create an 'Item' using itemfactory Item currentItem = ItemFactory.Instance.Create(FilePath);
// Finally add the feature service to the map // if we have an item that can be turned into a layer // add it to the map if (LayerFactory.Instance.CanCreateLayerFrom(currentItem)) LayerFactory.Instance.CreateLayer(currentItem, MapView.Active.Map); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error while adding vector tile to map"); } }); }
Perfect!!!! thanks Gintautas.... much appreciated.
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.