Public Sub Test() ' This code expects the first layer in the TOC to be a raster ' Get map Dim pMXD As IMxDocument Set pMXD = ThisDocument Dim pMap As IMap Set pMap = pMXD.FocusMap ' Get raster Dim pLayer As ILayer Set pLayer = pMap.Layer(0) Dim pRasterLayer As IRasterLayer Set pRasterLayer = pLayer ' Get extent Dim pGeoDataset As IGeoDataset Set pGeoDataset = pRasterLayer Dim pEnv As IEnvelope Set pEnv = pGeoDataset.Extent ' Test minimum value, assumes rasters are not in decimal degrees If pEnv.XMin = -0.5 Then Debug.Print "This raster has no extent so can't be geo-referenced!" Else Debug.Print "This raster is geo-referenced!" End If End Sub
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.