Skip to main content
Hi,

 

 

I've worked through all the various schema mapper examples but could not find one on how to add a new attribute to the writer schema.

 

 

I would like to read the source and add a attribute called 

 

CadLayer as varchar(30) with value of autocad_layer from the source autocad drawing

 

 

The source can have various object data attribute fields

 

 

one example i have in source dwg

 

MCCID_INT     integer

 

MCCID_STR   char  255

 

NAME               char  255 

 

 

i also would like to change them to char 50

 

 

I'm writing to arcsde 10.0 feature class

 

 

tx

 

Rudy

 

 

 

 

 

Hi,

 

 

it usually works if you just add and modify your attributes manually on the writer.

 

 

David
I forgot to add my writer is dynamic properties, read from source schema and create writer schema

 

 

Rudy

 


Hi,

 

 

In the case of adding, you just have to add the attribute in the writer, as David points out, in case of modifying in a dynamic translation it wont work since the schema is defined by the resource or dataset used.

 

The new SP2 provides better dynamic possibilities, but I dont have yet any experience with it.

 

 

Itay
Hi Rudy,

 

 

you can define the writer schema as an external table. Refer to "Dynamic Schema Examples".

 

 

Takashi
Hi Takashi,

 

 

thanks for answer, but i don't want to read writer schema from table, i'm reading it from the source, and just want to add new attribute to the writer

 

 

see my question - i want to add an attribute called CadLayer as  a char(30) field type and then mapped its value with autocad_layer.

 

 

I'm using schema mapper but cannot get it to work

 

 

Rudy

 

 

 


Hey Rudy,

 

 

maybe it will work without the SchemaMapper.

 

1. You set up you dynamic schema

 

2. Expose the autocad_layer attribute if necessary in the reader feature type  properties

 

3. Use an AttributeCopier to copy the values form autocad_layer to your new attribute CadLayer

 

4. In your writer feature type create a new user attribute called CadLayer with varchar(30) (if necessary connect the attribute from the AttributeCopier to the Writer Attribute you created).

 

 

Hope that works,

 

best regards,

 

Stefan

 

 

 

 


Hi,

 

 

I understood your requirement, but I think a new attribute cannot be added to the writer schema as long as you use the source schema for the writer.   I often use a common table for both of the SchemaMapper and  the writer dynamic schema. The table has 6 fields: Feature Type + New Attribute Name *+ Old Attribute Name * Attribute Data Type + Geometry Type + Attribute Sequence + (* for the SchemaMapper, + for the writer)   And when I need to add new attributes to the output features, I do that before the SchemaMapper (exposing autocad_layer in your case).

 

I think this trick is convenient to manage attribute mapping and dynamic writer schema consistently. Although this doesn't fit to your requirement exactly, if you are using a SchemaMapper, it might be worth considering.

 

 

Takashi

Reply