Solved

Trying to shrink GML data to specific buildings


I downloaded gml file of munich and want to use only few buildings, specifically TUM, from it. However the gml covers large area.

 

How do I cut out the buildings that I want and remove the other buildings from the gml and then save it?

 

I tried using "Clipper" transformers but I dont have any other information or files to use other than personally knowing that I only want the specific few buildings.

 

icon

Best answer by kailinatsafe 8 May 2023, 19:37

View original

5 replies

Userlevel 2
Badge +13

Hello @khairilariffin​, there are probably a few different ways you can do this in FME Form. However, is there a unique identifier / attribute on the building features? 

 

If so, the easiest way might be to use a Tester transformer to select or isolate the buildings of interest. Afterwards, you can use a BoundingBoxAccumulator to create a clipper feature and clip the original dataset! 

 

In this example, I used a sample GML dataset of FireHalls in the Vancouver area. A unique attribute called ‘FireHall’ (eg. stored the number of each firehall) allowed me to select the FireHalls nearest the coast (FireHall = 7 OR FireHall = 8). Afterwards, a BoundingBoxAccumulator can be used to generate a bounding box. The original dataset is clipped with the new bounding box: 

 

GMLFireHallsOtherwise, perhaps you could try using the BoundsExtractor on another feature to select an area, or even a SpatialRelator to select your features of interest. Let me know if you have any other questions! Happy to help, Kailin.

 

Hello @khairilariffin​, there are probably a few different ways you can do this in FME Form. However, is there a unique identifier / attribute on the building features? 

 

If so, the easiest way might be to use a Tester transformer to select or isolate the buildings of interest. Afterwards, you can use a BoundingBoxAccumulator to create a clipper feature and clip the original dataset! 

 

In this example, I used a sample GML dataset of FireHalls in the Vancouver area. A unique attribute called ‘FireHall’ (eg. stored the number of each firehall) allowed me to select the FireHalls nearest the coast (FireHall = 7 OR FireHall = 8). Afterwards, a BoundingBoxAccumulator can be used to generate a bounding box. The original dataset is clipped with the new bounding box: 

 

GMLFireHallsOtherwise, perhaps you could try using the BoundsExtractor on another feature to select an area, or even a SpatialRelator to select your features of interest. Let me know if you have any other questions! Happy to help, Kailin.

 

Thanks for the advice, I tried giving the BoundingBoxAccumulator the BoundsExtractor with X and Y coordinates but it didnt seem to work. Do you know any method or transformers to set up the bounding box with the X and Y coordinates.

Userlevel 2
Badge +13

Thanks for the advice, I tried giving the BoundingBoxAccumulator the BoundsExtractor with X and Y coordinates but it didnt seem to work. Do you know any method or transformers to set up the bounding box with the X and Y coordinates.

Hello @khairilariffin​, thanks for the update! So if you used the BoundsExtractor, you should have some new attributes such as: _xmin, _xmax, etc? In my example, they are point features, so I was able to use a VertexCreator to create the point geometry, and then a BoundingBoxAccumulator afterwards:

vertex_bboxYou can do a similar thing or try to build the polygon yourself with VertexCreators/Counter/LineBuilder/etc.

Thanks so much for the advice. Using BoundsExtractor and 4 Creators I was able to create coordinates points to give to the BoundingBoxAccumulator so it can create boundary based on the points.

 

image.png

Userlevel 2
Badge +13

Thanks so much for the advice. Using BoundsExtractor and 4 Creators I was able to create coordinates points to give to the BoundingBoxAccumulator so it can create boundary based on the points.

 

image.png

Hello @khairilariffin​, awesome!! So glad you got it working! If you wanted to reduce the number of transformers being used, you could also try creating the polygon in a single Creator (this would elimate the need for the BoundingBoxAccumulator as well):

 

imageThis would require you knowing the coordinates ahead of time though! Until next time, Kailin.

Reply