Skip to main content
Question

Deleting files spatially

  • March 10, 2020
  • 4 replies
  • 39 views

Forum|alt.badge.img

Hi. I'm looking for a way for FME to check a folder full of GMLs and either delete the ones that don't fall within a shapefile area feature, or move those that do to a different folder, but I assume the first option is easier ... but I could be wrong.

 

So for instance if I had a GML location for each Corona virus case in a folder, I want it to delete those GMLs that fall outside of my shapefile of the UK.

 

Any ideas? Do it for the children - and the elderly!

 

J

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

4 replies

ebygomm
Influencer
Forum|alt.badge.img+46
  • Influencer
  • March 10, 2020

Do you know the spatial extents of each gml file?

 

If they are small files, you could just read every gml file in, expose the fme_dataset attribute, do the spatial comparison with the boundary then use a filecopywriter to either delete those that fall outside the boundary or more those that fall inside the boundary


Forum|alt.badge.img
  • Author
  • March 10, 2020

Do you know the spatial extents of each gml file?

 

If they are small files, you could just read every gml file in, expose the fme_dataset attribute, do the spatial comparison with the boundary then use a filecopywriter to either delete those that fall outside the boundary or more those that fall inside the boundary

I don't know them without loading them. They are small files, yes. Single point data with a small table about date, recent history, diagnosis, outcome etc. About 5kb each.


deanatsafe
Safer
Forum|alt.badge.img+6
  • Safer
  • March 18, 2020

Use a Director and Path reader with *.gml to generate a feature per file, a FeatureReader to read each file, a Shape file reader to read your region features, and a SpatialRelator to filter for those gml files are contained in your regions. I'm not sure how many features are contained in each file. If there is only one feature per file, than this workflow should work. If there are multiple features per file then you may need a BoundingBoxAccumulator with the group-by set to fme_dataset name.


mark2atsafe
Safer
Forum|alt.badge.img+59
  • Safer
  • March 20, 2020

I covered this question in my question-of-the-week.

There are lots of methods (@ebygomm and @deanatsafe gave a couple here). But I think the fastest method might be to use the Envelope tag in the GML data to extract the data extents, rather than having to read the entire dataset.

In my demo workspace, it takes 2.8 seconds to process 80 files, which I think it pretty quick.

So check out the article and I hope you find it useful.