Question

Create Feature Class

  • 22 September 2016
  • 21 replies
  • 101 views

Badge

Hi everybody ,

One question , anybody knows how could I create feature class that are included in the diagram FME but , like no transform elements of that featureClass , don't create the feature class in the output.

I'll explain better , in my actual FME I have diferent feature class of output line VegeLin , etc. I have seen that if the transformation don't send elements to this feature class in the GDB of output I haven't this feature class , and only are created the feature classes that has take elements from the transformation.

Thanks in advanced for your help.

Regards !!!


21 replies

Userlevel 4

Unfortunately this isn't trivial, but Takashi posted a workaround here: https://knowledge.safe.com/questions/21606/force-table-creation-if-table-is-empty.html

Badge

Hi David ,

One question more , do you know from where could I take the attributes fme_db_operation and fme_where?? if the input reader is microstation I don't see this attributes to configure the attribute creator ...

Thanks so much for your help David !!

Userlevel 4

FME is feature driven, meaning that there are a lot of actions that will only take place if a feature triggers them. This is typically the case for output feature types, etc: If no feature arrives at the output feature type, then the table or feature class isn't created.

If the structure of the output file geodatabase is known, you can also use a template geodatabase: https://knowledge.safe.com/articles/1214/creating-geodatabases-based-on-existing-geodatabas.html

Badge

Hi again David , this is was I was looking , thanks ,

if I find the final solution I'll post it ... thanks again !!

Badge

One question David , with the configuration of the attached JPG , do you know if is correct to not delete the empty tables ???.

Thanks !!

Userlevel 2
Badge +17

Hi @xavigarciamar, the mechanism of the workaround is simple.

When there were no actual data features that should be written, INSERT a dummy record to the feature class in order to create the table, and then just DELETE the dummy record. A format attribute called fme_db_operation controls the query: INSERT or DELETE.

In order to do that, for example, assuming that the feature class has an attribute called "A" which can be used as a key field, send two features having the same key value to the feature class consecutively.

The first feature should have these two attributes,

  • A = 0 <for example>
  • fme_db_operation = INSERT

and the second feature has these tow attributes.

  • A = 0 <the same value as the first feature>
  • fme_db_operation = DELETE

Then, set "A" to the "Update/Delete Key Fields" parameter of the feature class. The workflow looks like this.

In addition, since the GDB supports transaction, you will have to set 1 to the "Feature to Write Per Transaction" parameter of the GDB writer. Otherwise, the second feature (i.e. DELETE query) will be rejected, since the transaction for the first feature will not be committed before sending the second feature.

 

If you want to set 2 or more to the "Feature to Write Per Transaction" parameter, you will have to add another GDB writer for the same dataset, and send the second feature (DELETE query) to the same feature class belonging to the second writer.

Userlevel 2
Badge +17

Hi @xavigarciamar, the mechanism of the workaround is simple.

When there were no actual data features that should be written, INSERT a dummy record to the feature class in order to create the table, and then just DELETE the dummy record. A format attribute called fme_db_operation controls the query: INSERT or DELETE.

In order to do that, for example, assuming that the feature class has an attribute called "A" which can be used as a key field, send two features having the same key value to the feature class consecutively.

The first feature should have these two attributes,

  • A = 0 <for example>
  • fme_db_operation = INSERT

and the second feature has these tow attributes.

  • A = 0 <the same value as the first feature>
  • fme_db_operation = DELETE

Then, set "A" to the "Update/Delete Key Fields" parameter of the feature class. The workflow looks like this.

In addition, since the GDB supports transaction, you will have to set 1 to the "Feature to Write Per Transaction" parameter of the GDB writer. Otherwise, the second feature (i.e. DELETE query) will be rejected, since the transaction for the first feature will not be committed before sending the second feature.

 

If you want to set 2 or more to the "Feature to Write Per Transaction" parameter, you will have to add another GDB writer for the same dataset, and send the second feature (DELETE query) to the same feature class belonging to the second writer.

If you have set "Edit Session" to the "Transaction Type" parameter, can set 2 or more to the "Features to Writer Per Transaction" without adding the second writer.

Badge

Thanks so much for your help takashi ... one question , in a feature output like the of the picture attached , how I must configure ???

Thanks and sorry for so much questions !!!featuretable.png

Badge

I'm doing it takashi with ESRI File GEODB API , is correct ??.

Thanks again !!

Userlevel 2
Badge +17

Thanks so much for your help takashi ... one question , in a feature output like the of the picture attached , how I must configure ???

Thanks and sorry for so much questions !!!featuretable.png

ah, you are usin the Geodatabase (File Geodb API) writer. I assumed the "Geodatabase (File Geodb ArcObjects)" writer. The Geodb API writer doesn't care transaction. Try setting the writer feature type like this.

 

 

Userlevel 2
Badge +17

I'm doing it takashi with ESRI File GEODB API , is correct ??.

Thanks again !!

Regarding the differences between the API writer and ArcObjects writer, see this article.

 

Tutorial: Getting Started with Geodatabase

 

 

Badge

Hi takashi , it works , generate the feature class empty , but in the ouput directory I have two GDB's , one with the empty feature classes , and another for the feature class with data ... any idea ??

The GDB with the empty features is called null.gdb ...

Thanks for your help !! is great !!

Badge
Regarding the differences between the API writer and ArcObjects writer, see this article.

 

Tutorial: Getting Started with Geodatabase

 

 

Thanks takashi your help is increible !!!

 

 

Userlevel 2
Badge +17

Hi takashi , it works , generate the feature class empty , but in the ouput directory I have two GDB's , one with the empty feature classes , and another for the feature class with data ... any idea ??

The GDB with the empty features is called null.gdb ...

Thanks for your help !! is great !!

Really? I think that's impossible unless you have two writers in the workspace for different destination datasets. Try again with an empty directory.

 

 

Badge

I have two writers really , one for a microstation file and another for the GDB file , but it generates me 2 GDB's and the microstation file , any idea ??

I let you an image of the parameters of the configuration ....config.png

Badge

In log file I see this :

MULTI_WRITER: multi_writer_id `NULL': Writing feature 0

FileGDB Writer: The fme_where attribute value 'PRIMARYINDEX = 1' on feature conflicts with Feature Operation or Row Selection. Rejecting feature

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Feature Type: `Menu1000/FeatureClass_pol'

Attribute(32 bit integer) : `NFT_count' has value `1'

Attribute(32 bit unsigned integer): `_copynum' has value `1'

Attribute(string) : `filegdb_type' has value `geodb_no_geom'

Attribute(encoded: utf-8) : `fme_db_operation' has value `DELETE'

Attribute(encoded: utf-8) : `fme_where' has value `PRIMARYINDEX = 1'

Attribute(string) : `multi_writer_id' has value `'

Attribute(encoded: utf-8) : `no_features' has value `true'

Geometry Type: Unknown (0)

===========================================================================

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Feature output statistics for `FILEGDB' writer using keyword `FILEGDB_1':

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Features Written

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Menu1000/FeatureClass_Pol 2

==============================================================================

Total Features Written 2

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

MULTI_WRITER: multi_writer_id `NULL': done writing 2 feature(s)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

It helps in something ???

Userlevel 2
Badge +17

fme_where is not necessary for the GDB writer in this case. It was used for the SDF3 writer in the past post. Remove it from the feature.

Badge

Hi takashi , finally I have been able to do it .. only is necessary to attach the template geodatabase and FMe manteins the empty features .

Thanks a lot for your help , has been great !! and thanks also to you David !!

Userlevel 1
Badge +12

Unfortunately this isn't trivial, but Takashi posted a workaround here: https://knowledge.safe.com/questions/21606/force-table-creation-if-table-is-empty.html

Creating an empty table in Esri File Geodatabases with FME is a bit easier than this (unlike most other formats) because a file gdb will reject geometries that aren't the same. So you just need to pass the wrong geometry to the featureclass. The featureclass will create but the feature will be dropped, thus empty featureclass

 

 

 

Badge
Creating an empty table in Esri File Geodatabases with FME is a bit easier than this (unlike most other formats) because a file gdb will reject geometries that aren't the same. So you just need to pass the wrong geometry to the featureclass. The featureclass will create but the feature will be dropped, thus empty featureclass

 

 

 

Thanks Todd , finally I have attach the template file , and the FME manteins the structure of the GDB , and with it works OK .

 

 

Thanks for your suggestion!!

 

 

Userlevel 4
Creating an empty table in Esri File Geodatabases with FME is a bit easier than this (unlike most other formats) because a file gdb will reject geometries that aren't the same. So you just need to pass the wrong geometry to the featureclass. The featureclass will create but the feature will be dropped, thus empty featureclass

 

 

 

That's an interesting hack, thanks for sharing

Reply