Perhaps the most well known GIS operation is to identify whether a point object lies
inside or outside of a given polygon.
This is called a Point in Polygon operation.
In this example there are three source datasets:
a vector line dataset of parcel boundaries in AutoCAD DWG format
a vector point dataset representing city-owned properties in Shapefile format
and a non-spatial Excel spreadsheet representing public artworks
We wish to use this data to find works of art located on city properties, and write
this as a HTML report.
The GIS operations we’ll carry out include two point-in-polygon operations.
Here I start FME Workbench with an empty canvas.
I add a reader to read the Esri Shapefile point dataset representing city-owned properties.
I again add a reader, this time to read the AutoCAD DWG dataset of property boundaries.
The first transformer to add is an AreaBuilder.
It will convert the property boundaries from lines into polygons.
Now I add a PointOnAreaOverlayer transformer.
The City Properties point features are connected to its Point input port and the newly built
property polygons are connected to its Area port.
The PointOnAreaOverlayer copies attributes from point features onto polygon features
- and vice versa - where a point falls inside that polygon.
But to assess if an overlap has taken place, we need to check an attribute that recorded
how many overlaps occurred.
I add a Tester transformer to the workspace connected to the PointOnAreaOverlayer Area
output port.
Opening the parameters dialog I set up a condition to test for where _overlaps is greater than
or equal to 1
This will test the property boundary area features and filter the ones that overlapped
a point feature (and are therefore a city-owned property).
For a third time I add a new reader, this time it is the Excel spreadsheet of artwork.
I open the parameters dialog and see there are several sheets in this dataset, and each
includes a Longitude and Latitude column that FME identifies as X and Y coordinates.
Now I select the Workflow Option "Single Merged Feature Type".
This will ensure that all sheets are represented by a single object in the workspace.
Because the artwork coordinates are latitude and longitude, I add a Reprojector transformer
to the canvas and set it up to reproject from LL83 to UTM83-10
Here I add a second PointOnAreaOverlayer, this time to overlay artworks onto the city
properties; so the reprojected artwork features are the points and the city properties are
the areas.
The first PointOnAreaOverlayer was an overlap with only one result: a property either belonged
to the city or it didn't.
However, the second PointOnAreaOverlayer can have multiple results, because there might
be multiple artworks on a single site.
So for that reason I open the parameters dialog for the second PointOnAreaOverlayer and under
Attribute Accumulation check the boxed labelled "Generate List" and enter a list name such
as "ArtList"
This will cause the artworks for a particular property to be saved as an FME list attribute
called ArtList.
A second Tester transformer - a duplicate of the first one - again tests for overlaps.
I connect an Inspector to view those features that pass and run the workspace.
The result will be a set of 42 polygons, each of which contains public art and has a list
of those artworks attached.
An FME "list" is a way to have multiple values for a single attribute.
Unfortunately not many formats support writing such an attribute natively.
I need to do something with these values and one way to do this is to explode the list;
turn it from one feature with multiple values, to multiple features each with one value.
I replace the Inspector with a ListExploder transformer, open the parameters dialog and
under the List Attribute parameter select "ArtList".
To write a HTML document I first add a HTMLReportGenerator transformer.
This transformer will generate HTML content and I want to set it up to create a report
where each property is shown with a list of the artworks that belong to it.
Firstly I set the group-by parameter to "Property" to create a separate report for each property.
Secondly, under Page Contents, I add a header and choose the address as the attribute whose
contents supply that header.
The header level I set to H3.
Underneath the Header I add a new Page Content of type "List".
For the settings I choose the Title attribute under the List Item Content and click OK to
close the dialog.
Finally I add a HTML format writer.
This will write out the HTML that the previous transformer generated.
I re-run the workspace, locate the HTML file that has been written,
and open it in a web browser.
I find a list of city-owned properties with a list of public artworks
that are located in it.
Alternative transformers to the PointOnAreaOverlayer are the SpatialFilter, FeatureReader, and
Clipper.
Alternative methods of handling a list are to concatenate the values into a single attribute
(ListConcatenator transformer), copy each value to a separate attribute (AttributeManager),
or write the data and values to separate database tables, with a lookup table to join the two.
I hope you found this video tutorial usefull
Thank you for watching.