[GIS] Convert Shapefile to CSV using FME

fme

I have a simple shapefile (point) that has only ID in the attribute table. I can transform shp to csv but this only gets the ID into the CSV file.

What transformer/settings do I need to read the x,y coordinates of each point in the shapefile and pass them to the CSV writer?

Best Answer

Use the CoordinateExtractor transformer. According to the documentation:

Retrieves the value of the x, y, and z coordinate at the specified index into attributes. A negative index can be used to indicate the position relative to the end of the feature (-1 is the last coordinate, -2 the second last, and so on). The index can be entered as an integer, or may be taken from the value of another attribute by selecting the attribute name from the pull-down list. If the index is invalid, then the translation will be terminated.

If the feature was two-dimensional, then the Z attribute will be given the default value specified.

If the feature was a multi-part feature (aggregate), each part’s coordinates are indexed sequentially.