English

How To: Insert annotation into an item in a Feature Attribute Table

Procedure

Summary:
How to move annotation from a subclass into a feature attribute table. For example, an arc coverage has annotation containing street names and the user would like to insert each arc's corresponding street name into an item in the AAT called STREET_NAME.

Procedure:
In order for this to be achieved, the annotation must be in a subclass and that subclass must built so there is a Text Attribute Table (TAT). One can tell if the annotation has a subclass by trying to LIST the cov.tatsubclass file from the ARC prompt. If the file is not found, build the coverage for the annotation subclass.

ARC: BUILD TESTCOV ANNO.STREET_NAME

The next step is to add the text information to the TAT using the ADDTEXT command.
ARC: ADDTEXT TESTCOV STREET_NAME

Now, the TRANSFER commands can be used to transfer the TEXT item from the TAT to the AAT (or other FAT).
ARCEDIT: EDIT TESTCOV
ARCEDIT: EDITFEATURE ARC
ARCEDIT: DRAWENVIRONMENT ARC ANNO.STREET_NAME
ARCEDIT: DRAW
ARCEDIT: TRANSFERCOVERAGE TESTCOV
ARCEDIT: TRANNSFERFEATURE ANNO.STREET_NAME
ARCEDIT: TRANSFERITEMS TEXT
ARCEDIT: TRANSFER
/* NOW YOU WILL CLICK ON THE SOURCE PIECE OF ANNOTATION, THEN CLICK ON THE TARGET
/*ARC TO TRANSFER THE TEXT ATTRIBUTE TO.

Notes:

The following is an AML that helps automate this process for most features.
Please use caution when using this AML, especially when working with POLYGONS
as there can be incorrect output when annotation insertion points fall outside
of a polygon although the annotation appears to be within the polygon.

/*A------------------------------AUTHOR---------------------------------
/*
/*Original Coding: ESRI
/*
/*N-------------------------------NAME----------------------------------
/*
/*CONVERTANNO.AML
/*Copyright 1995, Environmental Systems Research Institute, Inc.
/*
/*P-----------------------------PURPOSE---------------------------------
/*
/*This AML will populate a feature attribute table with information from
/*an annotation subclass.
/*
/*U------------------------------USAGE----------------------------------
/*
/*&r convertanno <in_coverage> <anno_subclass> <ARC|POINT|POLYGON|NODE> ~
/*{near_distance}
/*
/*C------------------------------CALLS----------------------------------
/*
/*NONE
/*
/*============================DISCLAIMER===============
/*You may use, copy, modify, merge, distribute, alter, reproduce and/or
/*create derivative works of this AML for your own internal use. All
/*rights not specifically granted herein are reserved to ESRI.
/*
/*THIS AML IS PROVIDED "AS-IS" WITHOUT WARRANTY OF ANY KIND, EITHER
/*EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
/*WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE,
/*WITH RESPECT TO THE AML.
/*
/*ESRI shall not be liable for any damages under any theory of law
/*related to your use of this AML, even if ESRI is advised of the
/*possibilites of such damage. This AML is not supported by ESRI.
/*=====================================================

&args cov subcls feat dist

&severity &error &routine BAILOUT

&if [null %cov%] or [null %subcls%] or [null %feat%] &then
&return USAGE &r convertanno <in_coverage> <sub_class> <ARC | POINT | POLYGON|NODE>~
{near_distance}

&if [show program] = 'ARCEDIT' &then
&return This AML must be run from ARC

&if [show program] = 'ARCPLOT' &then
&return This AML must be run from ARC

&if ^ [exists %cov% -cover] &then
&return Coverage [quote %cov%] does not exist. ~ Exiting...

&if ^ [exists %cov% -annotations.%subcls%] &then
&return Coverage [quote %cov%] does not contain subclass [quote %subcls%]~
Exiting...

&if [null %dist%] or [type %dist%] gt 0 &then
&set dist 10

&do arg &list cov subcls feat
&set %arg% [translate [value %arg%]]
&end

&if [quote %feat%] ne 'ARC' and [quote %feat%] ne 'POINT' and [quote %feat%]~
ne 'POLYGON' and [quote %feat%] ne 'NODE' &then
&return Feature [quote %feat%] is not 'ARC', 'POINT', 'POLYGON' or 'NODE'. ~
Exiting...

&if ^ [exist %cov% -%feat%] &then
&return %cov% lacks %feat% topology
&set home [show &workspace]
&set wrksp [dir [pathname %cov%]]
&workspace %wrksp%
&set cov [entryname %cov%]

/*&if %feat% = polygon or %feat% = point &then
/*&s fat = PAT
/*&if %feat% = arc &then
/* &s fat = AAT
/*&if %feat5 = node &then
/* &s fat = NAT
&select %feat%
&when ARC
&call arclineanno
&when POLYGON
&call polyanno
&when POINT
&call pointanno
&when NODE
&call nodeanno
&end
&workspace %home%

&return
/*--------------- arclineanno -------------------------

&routine arclineanno

build %cov% anno.%subcls%
addtext %cov% %subcls%

&data arc info
ARC
SEL %cov%.TAT%subcls%
OUTPUT ../PTANNO.TXT INIT
PRINT %subcls%#,',',X,',',Y
PRINT 'END'
Q STOP
&END

&if [exists %subcls%_pt -cover] &then
kill %subcls%_pt all

generate %subcls%_pt
input ptanno.txt
points
q

build %subcls%_pt point
near %subcls%_pt %cov% line %dist%

&if ^ [iteminfo %cov% -arc TEXT -exists] &then
additem %cov%.aat %cov%.aat text 32 32 c

&data ARC INFO
ARC
SEL %subcls%_PT.PAT
RELATE %cov%.AAT 1 BY %cov%# LINK
RELATE %cov%.TAT%subcls% 2 BY %subcls%_PT# LINK
MOVE $2TEXT TO $1TEXT
Q STOP
&end

&return
/*--------------- polyanno ----------------------------

&routine polyanno

build %cov% anno.%subcls%
addtext %cov% %subcls%

&data arc info
arc
SELECT %cov%.TAT%subcls%
OUTPUT ../xycoords.txt INIT
PRINT %subcls%#,',',X,',',Y
PRINT 'END'
OUTPUT ARNSP
Q STOP
&end

&if [exists %subcls%_pt -cover] &then
kill %subcls%_pt all

generate %subcls%_pt
input xycoords.txt
points
quit

build %subcls%_pt point
intersect %subcls%_pt %cov% %subcls%_nt point .01 nojoin

&if ^ [iteminfo %cov% -poly TEXT -exists] &then
additem %cov%.pat %cov%.pat text 32 32 c

&data arc info
arc
SELECT %subcls%_NT.PAT
RELATE %cov%.PAT 1 BY %cov%# LINK
RELATE %cov%.TAT%subcls% 2 BY %subcls%_PT# LINK
MOVE $2TEXT TO $1TEXT
Q STOP
&end

&return
/*--------------- pointanno -------------------------

&routine pointanno

build %cov% anno.%subcls%
addtext %cov% %subcls%

&data arc info
ARC
SEL %cov%.TAT%subcls%
OUTPUT ../PTANNO.TXT INIT
PRINT %subcls%#,',',X,',',Y
PRINT 'END'
Q STOP
&END

&if [exists %subcls%_pt -cover] &then
kill %subcls%_pt all

generate %subcls%_pt
input ptanno.txt
points
q

build %subcls%_pt point
near %subcls%_pt %cov% point %dist%

&if ^ [iteminfo %cov% -point TEXT -exists] &then
additem %cov%.pat %cov%.pat text 32 32 c

&data ARC INFO
ARC
SEL %subcls%_PT.PAT
RELATE %cov%.PAT 1 BY %cov%# LINK
RELATE %cov%.TAT%subcls% 2 BY %subcls%_PT# LINK
MOVE $2TEXT TO $1TEXT
Q STOP
&end

&return

/*--------------- nodeanno -------------------------

&routine nodeanno

build %cov% anno.%subcls%
addtext %cov% %subcls%

&data arc info
ARC
SEL %cov%.TAT%subcls%
OUTPUT ../PTANNO.TXT INIT
PRINT %subcls%#,',',X,',',Y
PRINT 'END'
Q STOP
&END

&if [exists %subcls%_pt -cover] &then
kill %subcls%_pt all

generate %subcls%_pt
input ptanno.txt
points
q

build %subcls%_pt point
near %subcls%_pt %cov% node %dist%

&if ^ [iteminfo %cov% -node TEXT -exists] &then
additem %cov%.nat %cov%.nat text 32 32 c

&data ARC INFO
ARC
SEL %subcls%_PT.PAT
RELATE %cov%.NAT 1 BY %cov%# LINK
RELATE %cov%.TAT%subcls% 2 BY %subcls%_PT# LINK
MOVE $2TEXT TO $1TEXT
Q STOP
&end

&return


/*--------------- BAILOUT ----------------------------

&routine BAILOUT
&severity &error &ignore
&severity &warning &ignore
&type An error has occurred in CONANNO.AML
&workspace %home%
&return;&return &error