Skip to main content
Solved

How to change the name of feature class in file geodatabase converted from mdf file by using a transformer from workspace.


Forum|alt.badge.img

Hi All,

I develop a workspace to transfer the mdf to gdb but the feature class in file geodatabase have the same name of the feature in mdf.

For example I have mdf “B” containing five feature class when I transform them into file gdb as you can see below

Is there any way to change the name of feature class from “dbo_COMMUNITIES_point” to “communities” by adding a transformer to my workspace?

Best Regards,

Rawan

Best answer by takashi

The procedure I suggested in the previous post can be implemented as below.

And, in this case, you don't need to define any user attribute in the writer feature type. Remove all attribute definitions from the User Attributes tab.

Hope this helps.

View original
Did this help you find an answer to your question?

9 replies

takashi
Contributor
Forum|alt.badge.img+21
  • Contributor
  • April 23, 2017

Hi @rawansaleh, I guess that you have a dynamic writer feature type, in which the destination feature class name is set to "fme_feature_type" and the Schema Definition Name is set to default (i.e. same as the feature class name).

If my guessing was correct, firstly create appropriate destination feature class name as a new feature attribute. For example, if your desired destination feature class names are the lowercase source table names excluding the schema prefix:

  1. AttributeCopier: Copy the value of "fme_feature_type" (source feature type name) to a new attribute called e.g. "_feature_class".
  2. StringCaseChanger: Make the value of "_feature_class" to lowercase.
  3. SubstringExtractor (or StringReplacer etc.): Remove the unnecessary prefix from the value of "_feature_class".

Then, in the GDB writer feature type properties, set the "_feature_class" to the destination feature class name and set "fme_feature_type" to the Schema Definition Name explicitly. In addition, if you want to prevent adding geometry type suffix ("_point" and "_polygon") to the destination feature class names, try setting "First Feature Defines Geometry Type" to the Geometry.


itay
Supporter
Forum|alt.badge.img+16
  • Supporter
  • April 23, 2017
takashi wrote:

Hi @rawansaleh, I guess that you have a dynamic writer feature type, in which the destination feature class name is set to "fme_feature_type" and the Schema Definition Name is set to default (i.e. same as the feature class name).

If my guessing was correct, firstly create appropriate destination feature class name as a new feature attribute. For example, if your desired destination feature class names are the lowercase source table names excluding the schema prefix:

  1. AttributeCopier: Copy the value of "fme_feature_type" (source feature type name) to a new attribute called e.g. "_feature_class".
  2. StringCaseChanger: Make the value of "_feature_class" to lowercase.
  3. SubstringExtractor (or StringReplacer etc.): Remove the unnecessary prefix from the value of "_feature_class".

Then, in the GDB writer feature type properties, set the "_feature_class" to the destination feature class name and set "fme_feature_type" to the Schema Definition Name explicitly. In addition, if you want to prevent adding geometry type suffix ("_point" and "_polygon") to the destination feature class names, try setting "First Feature Defines Geometry Type" to the Geometry.

Excellent solution, I wonder if it's possible setting the feature class name directly from within the writer feature type, using the text editor.

 

 


takashi
Contributor
Forum|alt.badge.img+21
  • Contributor
  • April 23, 2017
takashi wrote:

Hi @rawansaleh, I guess that you have a dynamic writer feature type, in which the destination feature class name is set to "fme_feature_type" and the Schema Definition Name is set to default (i.e. same as the feature class name).

If my guessing was correct, firstly create appropriate destination feature class name as a new feature attribute. For example, if your desired destination feature class names are the lowercase source table names excluding the schema prefix:

  1. AttributeCopier: Copy the value of "fme_feature_type" (source feature type name) to a new attribute called e.g. "_feature_class".
  2. StringCaseChanger: Make the value of "_feature_class" to lowercase.
  3. SubstringExtractor (or StringReplacer etc.): Remove the unnecessary prefix from the value of "_feature_class".

Then, in the GDB writer feature type properties, set the "_feature_class" to the destination feature class name and set "fme_feature_type" to the Schema Definition Name explicitly. In addition, if you want to prevent adding geometry type suffix ("_point" and "_polygon") to the destination feature class names, try setting "First Feature Defines Geometry Type" to the Geometry.

0684Q00000ArKphQAF.png

Yes, I think you can enter a string expression to the destination feature class name field directly using the Text Editor instead of the transformers, if the destination feature class name should be lowercase source feature type name excluding database schema prefix. e.g.

 

@LowerCase(@ReplaceRegEx(@Value(fme_feature_type),^.+\.,""))

Forum|alt.badge.img
  • Author
  • May 7, 2017

Dear Takashi

Thanks for your answer, actually I tried to enhance my workbench toget what I need but I’m fail to do so, I’m new in fme and I couldn’t know howto build the work space to get my request.

I attached the work bench if you have a time to look on it, andupdate me what is the mistake that I do in it

sql-filegdb.fmw

Best Regards,

Rawan


takashi
Contributor
Forum|alt.badge.img+21
  • Contributor
  • Best Answer
  • May 7, 2017

The procedure I suggested in the previous post can be implemented as below.

And, in this case, you don't need to define any user attribute in the writer feature type. Remove all attribute definitions from the User Attributes tab.

Hope this helps.


Forum|alt.badge.img
  • Author
  • May 7, 2017

Dear Takashi

Thanks a lot, it’s working fine with me.

I would like to ask about another thing if you have any idea about it.

I tried to transform the feature class from sql data base to gdb, what I need is to automatic transformation for all the feature class in the sql data base to file gdb.

Epically when I add a new feature to sql I need it to be selected automatically without any manual input from user.

Is that possible?

Best,

Rawan


takashi
Contributor
Forum|alt.badge.img+21
  • Contributor
  • May 7, 2017
rawansaleh wrote:

Dear Takashi

Thanks a lot, it’s working fine with me.

I would like to ask about another thing if you have any idea about it.

I tried to transform the feature class from sql data base to gdb, what I need is to automatic transformation for all the feature class in the sql data base to file gdb.

Epically when I add a new feature to sql I need it to be selected automatically without any manual input from user.

Is that possible?

Best,

Rawan

I think the MSSQL_SPATIAL reader will read every table from the specified database once you empty (make <not set>) the Feature Types to Read parameter of the reader.

 


Forum|alt.badge.img
  • Author
  • May 7, 2017

Dear Takashi

Thanks for your answer I tried what you mentioned above but itproduced the following error.

And when I selected all parameter that will produce unnecessarytables while I need only the feature classes.

What do you think?

sql-gdb-02.fmw

Best,

Rawan


takashi
Contributor
Forum|alt.badge.img+21
  • Contributor
  • May 7, 2017
rawansaleh wrote:

Dear Takashi

Thanks for your answer I tried what you mentioned above but itproduced the following error.

And when I selected all parameter that will produce unnecessarytables while I need only the feature classes.

What do you think?

sql-gdb-02.fmw

Best,

Rawan

The reader requires to be set one or more tables to Feature Types to Read when being added to the workspace, but you can clear the parameter setting after you added the reader.

 

However, there may not be a generic way to determine if a table is "feature class".

 

Looks like the source dataset is not a native Microsoft SQL Server Spatial database. Perhaps is it an Esri Geodatabase (ArcSDE) dataset that uses a MS SQL Server database as its storage?

 

If so, consider using Esri Geodatabase (ArcSDE Geodb) reader instead of MS SQL Server Spatial reader. # And sorry, I cannot help you since I don't have the ArcSDE environment.

 

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings