banniere

Le portail francophone de la géomatique


Toujours pas inscrit ? Mot de passe oublié ?
Nom d'utilisateur    Mot de passe              Toujours pas inscrit ?   Mot de passe oublié ?

#1 Mon 02 March 2009 12:38

tawfik3221
Juste Inscrit !
Date d'inscription: 19 Feb 2009
Messages: 1

Export Rasters

Bonjour
je cherche à exporter les layers avec ArcMap en utilisant un code (vba , vb, .net ....)
j'ai réussi à exporter les layers mais pas les rasters
je me demande si il y a un code pour exporter les rasters dans un répertoire donné


voici le code qui fait l'export des données :


Code:

Public Sub ExportAll_TOC()



Dim pDoc As IMxDocument

Dim pEnumLayer As IEnumLayer

Dim pLayer As IFeatureLayer

Dim pName As IName

Dim pLayerSet As ISet

Dim pMap As IMap

Dim pFC As IFeatureClass

Dim pINFeatureClassName As IFeatureClassName

Dim pDataset As IDataset

Dim pInDSName As IDatasetName

Dim pFields As IFields

Dim pField As IField

Dim pGeometryDef As IGeometryDef

Dim pFeatureClassName As IFeatureClassName

Dim pOutDatasetName As IDatasetName

Dim pWorkspaceName As IWorkspaceName

Dim pExportOp As IExportOperation



Set pDoc = Application.Document

Set pMap = pDoc.FocusMap

Set pEnumLayer = pMap.Layers

Set pLayerSet = New esriSystem.Set

pEnumLayer.Reset

Set pLayer = pEnumLayer.Next



Do Until pLayer Is Nothing

'Enumerate through the layers in the TOC and

'Get the Feature Class Name from the featureclass

    Set pFC = pLayer.FeatureClass

    Set pDataset = pFC

    Set pINFeatureClassName = pDataset.FullName

    Set pInDSName = pINFeatureClassName

    Set pFields = pFC.Fields

    Set pField = pFields.Field(lGeomIndex)

    Set pGeometryDef = pField.GeometryDef

    Set pFeatureClassName = New FeatureClassName

    Set pOutDatasetName = pFeatureClassName

    

    'Assign name to each exported layer

        pLayerSet.Add pLayer

        For i = 0 To pLayerSet.Count - 1

            X = pLayerSet.Count - 1

            pOutDatasetName.Name = pDataset.Name 

        Next i



    Set pWorkspaceName = New WorkspaceName

    pWorkspaceName.PathName = "C:\temp"

    pWorkspaceName.WorkspaceFactoryProgID = "esriDataSourcesFile.ShapefileWorkspaceFactory"

    Set pOutDatasetName.WorkspaceName = pWorkspaceName



    'Export the layers in the TOC

    Set pExportOp = New ExportOperation

    pExportOp.ExportFeatureClass pInDSName, Nothing, Nothing, pGeometryDef, pOutDatasetName, hWnd



    Set pLayer = pEnumLayer.Next



Loop



'Update the table of contents

pDoc.UpdateContents



End Sub

Hors ligne

 

#2 Mon 02 March 2009 22:11

Jeirhome
Membre
Lieu: Liverion
Date d'inscription: 22 Aug 2006
Messages: 4298
Site web

Re: Export Rasters

En tapant "export raster" sur le site de référencede l'éditeur, j'ai trouvé la fonction IRasterLayerExport.Export

Ça devrait vous aider.


Jérôme Cuinet
L'avantage de la Chine, c'est que le soleil se couche plus tard !

Hors ligne

 

Pied de page des forums

Powered by FluxBB