Skip to main content
Solved

Can I combine two KMZ files and extract the result of combined kmz's in a csv file or a table with FME?


I have two KMZ files containing states and cities borders. I want to combine them and find out which city falls under which state as a result in some tabular format. How I can achieve this with FME? Are there any transformers available for this?

Best answer by chrisatsafe

Hi @gauripearl,

The SpatialFilter is likely the transformer you are looking for. The SpatialFilter will allow you to determine which states contain which cities using a spatial predicate (i.e. Filter contains Candidate). Check out the Determining Spatial Relationships article to learn more!

Once you have determined the spatial relationships, you can use something like the AttributeRemover or AttributeManager to remove, rename, and re-order the attributes before sending the features to a CSV Writer.

I have attached an example which demonstrates a similar task - determining which voting boundaries belong to each neighborhood using data from the Vancouver Open Data Catalogue.

Hope this helps!

Input(s)

Output

Divisions_by_Neighborhood.fmw

View original
Did this help you find an answer to your question?

6 replies

chrisatsafe
Contributor
Forum|alt.badge.img+2
  • Contributor
  • Best Answer
  • April 12, 2019

Hi @gauripearl,

The SpatialFilter is likely the transformer you are looking for. The SpatialFilter will allow you to determine which states contain which cities using a spatial predicate (i.e. Filter contains Candidate). Check out the Determining Spatial Relationships article to learn more!

Once you have determined the spatial relationships, you can use something like the AttributeRemover or AttributeManager to remove, rename, and re-order the attributes before sending the features to a CSV Writer.

I have attached an example which demonstrates a similar task - determining which voting boundaries belong to each neighborhood using data from the Vancouver Open Data Catalogue.

Hope this helps!

Input(s)

Output

Divisions_by_Neighborhood.fmw


chrisatsafe
Contributor
Forum|alt.badge.img+2
  • Contributor
  • April 12, 2019
chrisatsafe wrote:

Hi @gauripearl,

The SpatialFilter is likely the transformer you are looking for. The SpatialFilter will allow you to determine which states contain which cities using a spatial predicate (i.e. Filter contains Candidate). Check out the Determining Spatial Relationships article to learn more!

Once you have determined the spatial relationships, you can use something like the AttributeRemover or AttributeManager to remove, rename, and re-order the attributes before sending the features to a CSV Writer.

I have attached an example which demonstrates a similar task - determining which voting boundaries belong to each neighborhood using data from the Vancouver Open Data Catalogue.

Hope this helps!

Input(s)

Output

Divisions_by_Neighborhood.fmw

Note: in this example, some voting boundaries intersected multiple neighborhoods which resulted in them failing the chosen spatial predicate (Filter contains Candidate). City boundaries shouldn't cross state boundaries so you shouldn't have any failed features from the SpatialFilter.


  • Author
  • April 15, 2019
chrisatsafe wrote:

Hi @gauripearl,

The SpatialFilter is likely the transformer you are looking for. The SpatialFilter will allow you to determine which states contain which cities using a spatial predicate (i.e. Filter contains Candidate). Check out the Determining Spatial Relationships article to learn more!

Once you have determined the spatial relationships, you can use something like the AttributeRemover or AttributeManager to remove, rename, and re-order the attributes before sending the features to a CSV Writer.

I have attached an example which demonstrates a similar task - determining which voting boundaries belong to each neighborhood using data from the Vancouver Open Data Catalogue.

Hope this helps!

Input(s)

Output

Divisions_by_Neighborhood.fmw

Thank you @chrisatsafe I am getting trouble in opening spatial filter transformer. I get a message that spatial filter transformer is not installed and the workspace is made in newer version of FME. I am using 2018. Do I have an option to install spatial filter transformer in my current FME desktop?


chrisatsafe
Contributor
Forum|alt.badge.img+2
  • Contributor
  • April 15, 2019
gauripearl wrote:

Thank you @chrisatsafe I am getting trouble in opening spatial filter transformer. I get a message that spatial filter transformer is not installed and the workspace is made in newer version of FME. I am using 2018. Do I have an option to install spatial filter transformer in my current FME desktop?

Hi @gauripearl,

The workspace I uploaded was created in FME 2019.0 which is why you are seeing that message. No need to install anything as the SpatialFilter is in previous versions of FME as well. You can add the SpatialFilter to the canvas by typing "SpatialFilter" and selecting it from the quick add menu, or by using the add transformer button, or from the menu Transformers > Add Transformer.

Once you have added the SpatialFilter, connect the Neighborhoods reader to the Filter port and the Voting Division Reader to the Candidate port. In the example I provided, the following parameters were used for the SpatialFilter:

Lastly, connect the Passed port to the AttributeRemover.

Additional Resources:


  • Author
  • April 15, 2019
chrisatsafe wrote:

Hi @gauripearl,

The workspace I uploaded was created in FME 2019.0 which is why you are seeing that message. No need to install anything as the SpatialFilter is in previous versions of FME as well. You can add the SpatialFilter to the canvas by typing "SpatialFilter" and selecting it from the quick add menu, or by using the add transformer button, or from the menu Transformers > Add Transformer.

Once you have added the SpatialFilter, connect the Neighborhoods reader to the Filter port and the Voting Division Reader to the Candidate port. In the example I provided, the following parameters were used for the SpatialFilter:

Lastly, connect the Passed port to the AttributeRemover.

Additional Resources:

Perfect. This worked. I am getting the results. I want the output table to add two columns which contains the name of a city and a state. Feature information contains state and city names if I select a feature but output table does not show names. Title or the name of a feature i.e. name of the state is not a part of description of kmz feature. Thus the output table does not contains name of a state and a city. Is there any way that I can include these names from feature information to final output table?


chrisatsafe
Contributor
Forum|alt.badge.img+2
  • Contributor
  • April 15, 2019
gauripearl wrote:

Perfect. This worked. I am getting the results. I want the output table to add two columns which contains the name of a city and a state. Feature information contains state and city names if I select a feature but output table does not show names. Title or the name of a feature i.e. name of the state is not a part of description of kmz feature. Thus the output table does not contains name of a state and a city. Is there any way that I can include these names from feature information to final output table?

Hi @gauripearl,

Yes, you can certainly do that - I would highly encourage reviewing the Managing Attributes Section of our Free FME Desktop Basic Training Manual to learn how to create, set, rename, remove (and more!) attributes


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