Skip to main content

Hi everyone,

I have a feature class in a File Geodatabase that I need to update. I have two sources for these updates: a CSV file with codes of the changed features, which I should use to remove those features from the main dataset, and separate shapefiles for each changed feature that needs to be added back to the main dataset. (I shouldn’t delete and update the whole dataset, I should update the changed features only.)
What is the best way to approach this in FME?

Thank u in advance for your time.
 

Hi Marjan,

To achieve your objective, you can follow these steps:

  1. Read the Geodatabase:

    • Use a FeatureReader to read the Geodatabase.
  2. Read the CSV and Shapefile:

    • Utilize separate FeatureReaders for the CSV and Shapefile.
  3. Merge the GDB with the CSV:

    • Merge the Geodatabase with the CSV data.
    • Continue processing with the unmerged features.
  4. Add Shapefiles Using a Junction:

    • Use a junction to add the Shapefile data to the unmerged features of the Geodatabase. Ensure that the attributes of the Shapefile match those of the unmerged features.
  5. Write the Output:

    • Write the output with table handling set to "drop and create."

As a result, you will obtain a Geodatabase with the CSV data removed and the Shapefile data added.


Hi jobvdnoort,

Thank you for your answer. I have 1 more issue.
Features that need to be added back to the main dataset is not a single shapefile. There are a folder including hundreds of shapefiles for each feature separately.
How can I handle that? It does not make sense to add one by one.
Is there anyway too read all shapefiles in a folder path and then add them to the main dataset?

Many thanks in advance


If I understand correctly, your dataset consists of a folder containing a number of shapefiles, with each shapefile defining a specific feature.

Additionally, there is a separate CSV file that contains the changes to be made to the main geodatabase.

These changes should also be applied to the source shapefiles in the folder.

 

To achieve this, you can follow a few steps:

Use the FeatureReader to read all the .shp files in your directory.


Read the CSV file to understand the changes that need to be applied.
Use a FeatureMerger to update the geometry and attributes of the shapefiles based on the CSV data.

And last
Overwrite the shapefiles and write the updated data to the geodatabase.
 

Hope this helps? If I understood wrong, could you provide me with some example?


Hi jobvdnoort,

Thank you so much. I have problem when I use directory and filepath names for importing shapefiles, and then Overwrite the shapefiles and write the updated data to the geodatabase.
The problem is features did not write in the geodatabase, and in the attribute table I can see only the path of each shapefile and features did not added. Do you know how can I fix it?
its like using filepath names only added file locations and file names, not features


Hi jobvdnoort,

Thank you so much. I have problem when I use directory and filepath names for importing shapefiles, and then Overwrite the shapefiles and write the updated data to the geodatabase.
The problem is features did not write in the geodatabase, and in the attribute table I can see only the path of each shapefile and features did not added. Do you know how can I fix it?
its like using filepath names only added file locations and file names, not features

Good morning marjan,

 

Did you read the shape files seperate after the first featurereader?

See the below example. Maybe you can use this.

Kr,

Job


Reply