2

I have annotations in a GDB file that I need to extract to load into a non-ESRI spatial store. It's my understanding that there isn't any tool to export annotations to a shape file. I need to copy points, text, and style info.

I have not worked with annotations before. My prior experience with ESRI products involves writing a shape file parser in C#.Net and writing .Net code that interacts with the C API for ArcSDE to query ArcSDE. It's my understanding that ArcSDE SE_annotation methods don't really return very much detail about annotations, so I would be open to working with ArcObjects as well. I've been reviewing that API, however, and I'm not clear on how I would query annotations.

If anyone has experience with this sort of thing and can suggest ideas or point me to relevant documentation I'd be very grateful.

  • what version are you wanting to know about? – Brad Nesom Aug 20 '13 at 17:55
  • I expect it's probably 9.x, but I'll double-check with the client. – Russell at ISC Aug 20 '13 at 18:38
  • you don't say how basic information you are looking for. the annotation elements are here. resources.esri.com/help/9.3/ArcGISDesktop/ArcObjects/esricarto/… – Brad Nesom Aug 20 '13 at 18:52
  • Turns out it's 10.0. I was looking at 10.x documentation earlier, what Brad posted for 9.x looks very similar. (Thanks, Brad.) What I couldn't get from a quick run through the documentation was how to retrieve existing annotations from a GDB and review text, location, and style. (This is loose annotation, no feature links.) – Russell at ISC Aug 20 '13 at 18:58
  • For instance, in AnnotationFeature I assume IFeature.Shape is the annotation location but neither IAnnotationFeature nor IAnnotationFeature2 seem to contain the text. Also, I'm still unclear how to get the list of AnnotationFeature objects. – Russell at ISC Aug 20 '13 at 19:16
1

Unless I am misunderstanding your question this is nothing more than a simple cursor over a FeatureClass.

I created a geodatabase annotation dataset by exporting some labels and this is the first layer in the DataFrame. The following VBA code demonstrates how to spew out the text to the debug window but it could equally be another non-spatial table.

Public Sub GetText()
' Get first layer in map which is the annotation layer
Dim pMXDocument As IMxDocument
Set pMXDocument = ThisDocument
Dim pMap As IMap
Set pMap = pMXDocument.FocusMap
Dim pLayer As ILayer
Set pLayer = pMap.Layer(0)
Dim pFeatureLayer As IFeatureLayer
Set pFeatureLayer = pLayer

' Create a cursor
Dim pFeatureCursor As IFeatureCursor
Set pFeatureCursor = pFeatureLayer.Search(Nothing, False)

' loop printing text string
Dim s As String
Dim pFeature As IFeature
Set pFeature = pFeatureCursor.NextFeature
Do While Not pFeature Is Nothing
    s = pFeature.Value(pFeature.Fields.FindField("TextString"))
    Debug.Print s
    Set pFeature = pFeatureCursor.NextFeature
Loop
End Sub
  • So an annotation layer is treated as any other feature layer? That will get me farther. I don't think I'll have a "document", since I'll be opening a GDB from a console application, but I imagine examples for that should be fairly easy to find. How did you know to use "TextString" as the field for the annotation text? Also, I can see the geometry will be IFeature.Shape, but what about the style? – Russell at ISC Aug 20 '13 at 21:54
  • Well I just opened the attribute table for the annotation layer in ArcMap and you can see all the fields, Shape being one of them but it will be a polygon which I believe is the extent of the text (could be wrong). You can see the other fields that describe orientation, size and font. Have you actually got ArcMap? – Hornbydd Aug 20 '13 at 22:02
  • This page lists the fields that can read from a simple pass thought using an featureCursor: resources.arcgis.com/en/help/main/10.1/index.html#/… – Hornbydd Aug 20 '13 at 22:19
  • No, I don't have ArcMap. Currently I'm using no ESRI products. I've written a MapDotNet/MapsJS app for a client and he now wants to purchase additional data to use in it that's only available as annotations in a GDB file. I need to estimate the effort to write a console app using ArcObjects to export annotations (into a SQL Server table with geometry). If we do this the client will be purchasing the ESRI SDKs needed, but I don't want them to incur that cost just so I can estimate my dev time. – Russell at ISC Aug 21 '13 at 12:58
  • That link is very helpful, by the way. I could use mid left of that polygon to place text. – Russell at ISC Aug 21 '13 at 13:00
1

I don't know a whole lot about what I am talking about but to get this out of comments here is an answer.
If this is loose annotation you may be talking about "map annotation"

Annotation

ArcGIS provides an annotation feature type for the storage of text in the geodatabase. Storing text in the geodatabase provides the ability to edit the text and more efficient drawing speeds than dynamic labeling since the text positions are fixed. Geodatabase annotation should not be confused with the similar map annotation, which is text stored in the map's BasicGraphicsLayer. For more information on the map's BasicGraphicsLayer, see Working with the map.

Above quoted from the esri help page describing going the other direction (converting labels to annotation).
First determine if the annotation you want is in the geodatabase or as map.

  • Since the annotation is available as a GDB file, I believe that it is geodatabase annotation. It's my understanding that feature links are optional for annotation, and the data provider states that "Annotation is stored in a GDB. The annotations are not 'feature linked' and thus not tied/joined to any features. We refer to it as 'dumb' annotation." – Russell at ISC Aug 20 '13 at 20:28
  • 1
    I marked this as useful because it is, but I'm still hoping someone can point me to some documentation of querying geodatabase annotation. I don't need a complete solution. At this point I'm just trying to size this, i.e. is it more likely to be one man-week or six? – Russell at ISC Aug 20 '13 at 20:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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