Skip to main content
Solved

Batch KML to Layer in ArcGIS Pro, but all append to one layer


adrianwelsh
Contributor
Forum|alt.badge.img+5

I have about 1,000 KMLs in a folder, all with the same schema and only one feature each (line features). I want to bring in each KML into a single feature class in a file geodatabase in ArcGIS Pro and populate a field in that feature class with the unique name of each KML. Is there a way to even do this in FME?

 

Thanks!

Best answer by nielsgerrits

This is not too hard.

  • Initiate with a Creator.
  • FeatureReader (Directory and File Pathnames) to scan the directory with files.
  • FeatureReader (OGC / Google KML) to read all files found by setting the Dataset to the attribute path_windows. Under Output Ports, choose Single Output Port. Under Attributes choose Merge Initiator and Result.
  • AttributeCreator, create a field OriginalFileName value path_filename.
  • FeatureWriter, define gdb and featureclassname, attribute OriginalFileName.
View original
Did this help you find an answer to your question?

7 replies

nielsgerrits
VIP
Forum|alt.badge.img+54
  • Best Answer
  • October 12, 2023

This is not too hard.

  • Initiate with a Creator.
  • FeatureReader (Directory and File Pathnames) to scan the directory with files.
  • FeatureReader (OGC / Google KML) to read all files found by setting the Dataset to the attribute path_windows. Under Output Ports, choose Single Output Port. Under Attributes choose Merge Initiator and Result.
  • AttributeCreator, create a field OriginalFileName value path_filename.
  • FeatureWriter, define gdb and featureclassname, attribute OriginalFileName.

adrianwelsh
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • October 12, 2023
nielsgerrits wrote:

This is not too hard.

  • Initiate with a Creator.
  • FeatureReader (Directory and File Pathnames) to scan the directory with files.
  • FeatureReader (OGC / Google KML) to read all files found by setting the Dataset to the attribute path_windows. Under Output Ports, choose Single Output Port. Under Attributes choose Merge Initiator and Result.
  • AttributeCreator, create a field OriginalFileName value path_filename.
  • FeatureWriter, define gdb and featureclassname, attribute OriginalFileName.

Thanks for your help! This does seem doable but I guess I am not putting in all the variables correctly since I get an error (this error is about "Cannot open dataset 'path_windows'" and error initializing the KML reader).

 

This is what my flow looks like with the property dialog boxes (not sure how well it will show up here).

KML to Single Feature Class 1


nielsgerrits
VIP
Forum|alt.badge.img+54
adrianwelsh wrote:

Thanks for your help! This does seem doable but I guess I am not putting in all the variables correctly since I get an error (this error is about "Cannot open dataset 'path_windows'" and error initializing the KML reader).

 

This is what my flow looks like with the property dialog boxes (not sure how well it will show up here).

KML to Single Feature Class 1

You need to connect the FeatureReaders PATH outputport to the FeatureReader_2's inputport. Then you can select the path_windows attribute as dataset.


adrianwelsh
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • October 13, 2023
adrianwelsh wrote:

Thanks for your help! This does seem doable but I guess I am not putting in all the variables correctly since I get an error (this error is about "Cannot open dataset 'path_windows'" and error initializing the KML reader).

 

This is what my flow looks like with the property dialog boxes (not sure how well it will show up here).

KML to Single Feature Class 1

Thanks for your help again. This got me to not have an error. I suppose this is not writing any geometry. These are all line features and I set the geometry in the FeatureWriter to geodb_polyline. Does this need to be established elsewhere? I also assigned it a coordinate system of LL-WGS84 in the first feature reader since it was not coming across with a coordinate system. Thanks.


nielsgerrits
VIP
Forum|alt.badge.img+54
adrianwelsh wrote:

Thanks for your help! This does seem doable but I guess I am not putting in all the variables correctly since I get an error (this error is about "Cannot open dataset 'path_windows'" and error initializing the KML reader).

 

This is what my flow looks like with the property dialog boxes (not sure how well it will show up here).

KML to Single Feature Class 1

Can you use the sample workspace from this topic and change it for your needs?


adrianwelsh
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • October 13, 2023
adrianwelsh wrote:

Thanks for your help! This does seem doable but I guess I am not putting in all the variables correctly since I get an error (this error is about "Cannot open dataset 'path_windows'" and error initializing the KML reader).

 

This is what my flow looks like with the property dialog boxes (not sure how well it will show up here).

KML to Single Feature Class 1

Thanks for example. That helped. I am not sure what I changed exactly but I am now getting geometry features. In the first feature reader, I changed Features to Read from Schema and Data Features to Data Features. I added the Attribute exposer but I'm not sure I fully needed that since the PATH variable is already there. This is how looks in the end and it works so I don't think I want to change anything, haha! Thanks so much for your help.

image


nielsgerrits
VIP
Forum|alt.badge.img+54
adrianwelsh wrote:

Thanks for your help! This does seem doable but I guess I am not putting in all the variables correctly since I get an error (this error is about "Cannot open dataset 'path_windows'" and error initializing the KML reader).

 

This is what my flow looks like with the property dialog boxes (not sure how well it will show up here).

KML to Single Feature Class 1

Looks great. I always find it more convenient to work from a working sample. Happy it helped :)


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