Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Hi all I sometimes work with large NTDB datasets, and was just wondering the best way to go about saving all of my custom labeling. Is there a way I can save all of my custom label classes so I can apply them to all of my NTDB datasets so all maps made with this dataset are standardized? I can do it the long way by changing the classes every time, but just wanted to know if I could save it so I can just apply it. ie/ like a layer file? Thanks for all your help

share|improve this question

1 Answer 1

up vote 5 down vote accepted

You could just save the layer file then create a UI button (or an Add-on in v.10) and use the following code to import the labels:

    Dim pGxFile As IGxFile
    Dim pGFLayer As IGeoFeatureLayer
    Dim pGxLayer As IGxLayer
    Dim pGxDialog As IGxDialog
    Dim pGxObjFilter As IGxObjectFilter
    Dim pEnumGxObj As IEnumGxObject
    Dim pAnnoLayerPropsColl As IAnnotateLayerPropertiesCollection
    Dim pGxObj As IGxObject
    Dim pMxDoc As IMxDocument

    Set pMxDoc = ThisDocument
    If pMxDoc.SelectedLayer Is Nothing Then
        MsgBox "Select feature class to label with .lyr file label classes"
        Exit Sub
    End If

    Set pGxDialog = New GxDialog
    Set pGxObjFilter = New GxFilterLayers
    Set pGxDialog.ObjectFilter = pGxObjFilter
    pGxDialog.Title = "Select Layer(.lyr) file to import labels definitions from"
    pGxDialog.ButtonCaption = "Apply Labels"

    If pGxDialog.DoModalOpen(0, pEnumGxObj) Then
        Set pGxObj = pEnumGxObj.Next
        Set pGxLayer = pGxObj
    Else
        Exit Sub
    End If

    Set pGFLayer = pGxLayer.Layer
    Set pAnnoLayerPropsColl = pGFLayer.AnnotationProperties

   'Apply label classes  to selected layer in arcmap

    Set pGFLayer = pMxDoc.SelectedLayer
    pGFLayer.AnnotationProperties = pAnnoLayerPropsColl
'    pGFLayer.DisplayAnnotation = True
'    pMxDoc.ActiveView.Refresh
    pMxDoc.CurrentContentsView.Refresh pGFLayer

    MsgBox "Labels imported successfully." & Chr(13) & "To view labels, check 'Label Features'."
share|improve this answer
    
Thanks Jakub :) –  Andrew Dec 16 '10 at 19:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.