Select to view content in your preferred language

How can I duplicate an event layer to a new shapefile?

688
2
11-01-2010 03:52 AM
MartijnSenden
Emerging Contributor
Hi All!

I am trying to copy an event layer to a new feature layer with the same properties (i.e. duplicate the features, the symbology and the labeling properties). I need to do all this through ArcObjects VBA code.

I can manage to copy the features and I can copy the symbology, but I am having a hard time copying the labeling properties. My questions are:

  1. Do I need to copy the features, symbology and labeling separately? Or is it possible to do all this at once? And if so, how?

  2. If I have to copy the features, symbology and labeling separately, then how can I copy the labeling from the event layer to the new feature layer? I have been trying this, but I have no clue on how to approach this (i.e. the approaches I tried don't work).

I expressly didn't add any code here. I hope you guys may have a fresh view on the best way to tackle this. That may be more useful than getting comments on my current approach.

I will appreciate any help greatly.

Best regards,
Martijn Senden.
0 Kudos
2 Replies
MartijnSenden
Emerging Contributor
Hi again,

Please let me know if more clarification is needed. I would still appreciate any help!
Thanks again in advance.

Martijn Senden
0 Kudos
mohamedkenzi
Emerging Contributor
Hi,

try this :

1. Export the event layer to [shapefile_name].shp

2.create a layer file ([shapefile_name].lyr) from the event layer (it includes all definitions : Symbology, labels, ...)

3.load the new [shapefile_name].lyr into your map

4.change the data source of the layer added from event_layer to the shapefile_name.shp
   (open the new featureclass and assign it to the featurelayer)
          pFClass = pFworkspace.openfeatureclass(....)
          pFLayer.featureclass = pFClass

5.refresh the map and the legend

good luck
0 Kudos