Skip to main content
Question

KML to Gdb with saving hierarchy folders names


marta.podsiad
Supporter
Forum|alt.badge.img+9

Hi,

I have a very complex KML file with many folders and subfolders. I would like to save the folder name or full folder path where each placemark is located — something similar to the "FolderPath" field when converting KML to GDB in ArcGIS Pro.


How can I achieve this?

4 replies

liamfez
Influencer
Forum|alt.badge.img+34
  • Influencer
  • April 17, 2025

You can read in the folders of the kml file as their own features in FME, you would need to select the “Folder” Feature Type when adding the reader by feature type or they should already be read in if you used a Merged Feature Type reader.

If you expose the kml_parent attribute on the placemarks, you can join that to the kml_id of the folders and the name of the folder should be the kml_name attribute. Similarly you could join folders to the parent folder feature that they are in.


marta.podsiad
Supporter
Forum|alt.badge.img+9
  • Author
  • Supporter
  • April 18, 2025

Unfortunately this approach does not give the full path to the item, just the name of the folder


debbiatsafe
Safer
Forum|alt.badge.img+20

Hello ​@marta.podsiad,

You can try the same method as described here in this Community post. There is a workspace demonstrating this approach linked to the answer to get you started. 

The workspace outputs folder paths sorted from bottom-most to top-most order. If you want the folder paths sorted from top-most level to bottom-most level, add a Sorter after the FeatureJoiner and before the Aggregator. The Sorter should be configured as sublevel (numeric, ascending) then _copynum (numeric, descending).

I hope this information helps.


takashi
Influencer
  • April 24, 2025

Hi ​@marta.podsiad ,

@debbiatsafe , good to know that kml_id of Folder features can be used to follow folder path. Thank you for the great solution. I created a workspace example applying the "kml_id system", see the attached workspace example "kml_id_system.fmw".

I would like to provide another solution.

I think it's a little-known fact that you can use XMLTemplater and JSONTemplater as an interface of the XQuery processor and also perform sub expressions recursively. In this case, you can create folder path string for each Placemark using just a single XMLTemplater (or JSONTemplater) in the screenshot below.

See also the attached workspace example "recursive_xquery.fmw". 

Perform XQuery expression recursively with XMLTemplater

 


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