Select to view content in your preferred language

shape file labels missing

2378
3
09-25-2012 10:22 PM
konradenzensberger
Emerging Contributor
Hello,

i built a smal app using the TocControl, ToolbarControl and MapControl.
i am loading a shp file into MapControl using the AddData Toolbar button,
the shape file is displayed but no labels .

if i save this as mxd and reload the mxd file, same result - no labels are displayed.

what am i doing wrong ?

br, enze
0 Kudos
3 Replies
JohnHauck
Frequent Contributor
Labels are not automatically enabled when you create a new feature layer (as would happen when adding a shapefile with Add Data). The Working with labels and annotation document should help get you started I believe.
0 Kudos
konradenzensberger
Emerging Contributor
thanks for repley.

unfortunately your link does not help much.
we are not using this interfaces, we simply like to open an mxd file, add a shape file and save the new mxd file
by using the TocControl, ToolBarControl and MapControl.
After that we are using the MapCooker interface to create map tiles.

is there a way to enable displaying labels by using this controls ?
it should be, of course, but i can not find any ToolBar options to do.

"enable displaying labels" should be saved in mxd file - isn't it ?

br, konrad

btw - the ArcObjects API reference is the poorest reference i ever saw, most interface methodes are not described in detail, e.g:

http://resources.arcgis.com/en/help/arcobjects-cpp/componenthelp/index.html#/IMapCacheToRasterFuncti...

who can work with such ref ?
0 Kudos
JohnHauck
Frequent Contributor
Labels for a shapefile are controlled at the Layer level.

IGeoFeatureLayer.DisplayAnnotation is a property that you can use to simply turn labels on and off.

If you have the option of controlling how you initially save the data you could consider using a "layer file" has a ".lyr" extension or a "layer package" has a ".lpk" extension. As layers have the ability to persist details about the values that control labels you can simply open a layer file or package that was saved with labels enabled and not have to do any additional work in your application. However, if you must deal with shapefiles or other feature class types directly then you will always be responsible for enabling the labels as a feature class doesn't persist those same types of values for labeling.

If you are cooking a cache have you seen this sample it may be helpful: Multithreaded MapCruncher

However, we have many approaches for generating tiles in a much less complex fashion. I could give some details on those if you would let me know the constraints or requirements that you must deal with as well as what version you are working with.
0 Kudos