Question

how to update metadata in file geodatabase with multiple feature classes with feature writer

  • 27 October 2019
  • 6 replies
  • 43 views

Badge

Hello,

I have a workbench that updates metadata by reading a file geodatabase with multiple feature classes. The multiple feature classes will change every time, i.e. in effect I want to update metadata for all feature classes in a file geodatabase based on excel provided for every feature class.

I am reading the file geodatabase with directory and file path reader and then using feature readers for file geodabase and raster dataset. They need to be split as raster dataset has a separate reader.

Then I am updating the metadata for each feature class based on input excel, which works fine.

However, I cannot write the metadata back to the original file geodatabase feature classes using either feature writer in a dynamic way, i.e. write to all feature classes in the file geodatabase or with a dynamic file geodatabase writer.

I am getting errors and I run out of options on how to do it.

This is how I am reading:

And this is how I am trying to write the updated metadata back to file geodatabase only at this time, raster dataset will be added later:

Your help much appreciated.

Magda


6 replies

Badge +16

Hi @wilczekmj,

How are you recreating the new metadata string? maybe this article can help:

https://knowledge.safe.com/articles/22583/working-with-geodatabase-metadata-writing-to-xml.html

Badge +10

What are the errors you are getting? The most likely cause of error is your xml string not being correct.

Badge

What are the errors you are getting? The most likely cause of error is your xml string not being correct.

Hello ebygomm,

Many thanks for looking at this and your help with previews related question:)

The error message I am getting with Feature writer is:

"Attempting to create table 'HYD_871_160_103_00_REF_MainRivers10k_Ln' with 'geodb_type' set to 'geodb_metadata'. FME features of 'geodb_metadata' can only be written to existing tables. If intending to write metadata, please ensure the table already exists. If intending to create a new table, ensure the 'geodb_type' is set to a valid table type.

A fatal error has occurred. Check the logfile above for details"

 

It looks as it is trying to create rather than update to the existing feature class.

Badge

Hi @wilczekmj,

How are you recreating the new metadata string? maybe this article can help:

https://knowledge.safe.com/articles/22583/working-with-geodatabase-metadata-writing-to-xml.html

Thank you itay. Thank you. I went through this article and metadata manipulation works fine for me. I am dealing with a more complex looping through all feature classes in thegeodatabase to write metadata back to them.

Badge

Hi @wilczekmj,

The error message you quote in your comment suggests that you are trying to write metadata to a feature class that doesn't exist.

If you want to update existing metadata of a feature class then you would need to point your reader and writer to the same geodatabase or, at least during testing, point your writer to a copy of the original geodatabase.

You can set the Table | General parameters of the FeatureWriter to Insert and Use Existing.

You'll also need to make sure that you don't overwrite the existing geodatabase.

Hope this helps,

Si

Badge +6

Hello @wilczekmj,

 

 

The current error you are getting is as a result of the Destination geodatabase being different than your source, as mentioned by @sipsysigh. If you add a VariableSetter either before your FeatureReader or just after the Path Reader and set the following parameters:

 

 

variable name: pathVariable
value: @Value(path_windows)

After this, your workflow stays the same until just prior to the FeatureWriter. Here if you add a VariableRetriever with the following values:

variable name: pathVariable
attribute receiving value = _gdbpath

What the above does allows you to maintain the path_windows attribute(which contains the geodatabase path) through the workflow. You could rework the workflow to maintain that attribute, but a variablesett/retriever will do the same. This _gpdpath would then become the dataset value in your FeatureWriter.

On the writer, I believe if you change the Feature Operation to Insert, I suspect it will over-ride the original metadata feature. Update won't work as it will be unable to find a match based on the geodb_metadata_string, as a result of it being altered in the workspace.

 

 

Let me know if that works.

Reply