+ Reply to Thread
Results 1 to 4 of 4

Thread: Is there a way of Importing Label Styles as you do Symbology?

  1. #1

    Join Date
    Sep 2010
    Posts
    1
    Points
    0
    Answers Provided
    0


    0

    Default Is there a way of Importing Label Styles as you do Symbology?

    Is there a way to do this. I'm in a situation where I have about 100+ shapefiles I need to style with the same type of labels. It is a tedious process where I have to create two label classes for each shapefile to place a label on the top and the bottom of a point. Is there a quick way to do this? Such as the way you import the symbology from another layer file?

  2. #2
    Jakub Sisak
    Join Date
    Apr 2010
    Posts
    466
    Points
    19
    Answers Provided
    1


    1

    Default Re: Is there a way of Importing Label Styles as you do Symbology?

    Yes, programatically. Create a custom UI button and paste the below code into it.
    Create your labels as complex or as simple as you need it then save the layer as a "Layer File"
    In the TOC select the layer you want to import the saved labels into then click the button you just created. This opens up a dialog box. Navigate to the saved layer file and hit the Apply Labels button. I put a msgbox at the end because some labels were so complex and scale so large it would sometimes crash arcmap. This way it will give you the opportunity to save the document then adjust the scale. Then just right-click on the layer and "Label Features"

    If you want the labels display right away, remove the message box and un-comment the the lines near the end.


    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'."

    Jakub Sisak, GISP
    GIS StackExchange

    JAKUB SISAK photography
    To see my photography please visit:
    facebook | fine art america | 500px | Flickr


  3. #3
    Jakub Sisak
    Join Date
    Apr 2010
    Posts
    466
    Points
    19
    Answers Provided
    1


    1

    Default Re: Is there a way of Importing Label Styles as you do Symbology?

    I made a version 10 add-in for this. It can be downloaded here: http://www.arcgis.com/home/item.html...1a067ffd58aea8

    Jakub Sisak, GISP
    GIS StackExchange

    JAKUB SISAK photography
    To see my photography please visit:
    facebook | fine art america | 500px | Flickr


  4. #4
    Kieran Blacker
    Join Date
    Jun 2012
    Posts
    8
    Points
    0
    Answers Provided
    0


    0

    Default Re: Is there a way of Importing Label Styles as you do Symbology?

    Jakub

    I've tried downloading and installing your tool, but it doesnt seem to want to work. The option to copy over symbology is greyed out

    I'm using an Arcview licence if it affects this.

    Cheers, hope this works!


    Just to let you know, it does indeed work. Apologies!
    Last edited by 8556732; 09-03-2012 at 12:20 PM. Reason: Correction

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts