Skip to main content
Solved

How to extract polygons from shp to csv file

  • Jul 10, 2017 11:50 PM UTC
  • 4 replies
  • 147 views

Forum|alt.badge.img

Best answer by erik_jan

You can use the GeometryExtractor transformer to create an attribute holding the polygon definition (choice of multiple formats, but WKT is often used).

View original
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

takashi
Celebrity
  • Jul 11, 2017 12:38 AM UTC

Hi @jitkam, it depends on your desired CSV table schema. For example, how do you want to describe this polygon feature (having 3 user attributes - attr1, attr2, attr3, and a single polygon geometry with 5 vertices) in the destination CSV table?

Attribute(string)             : `SHAPE_GEOMETRY' has value `shape_polygon'
Attribute(encoded: fme-system): `attr1' has value `aaa'
Attribute(encoded: fme-system): `attr2' has value `bbb'
Attribute(encoded: fme-system): `attr3' has value `ccc'
Attribute(string)             : `fme_feature_type' has value `data'
Attribute(string)             : `fme_geometry' has value `fme_polygon'
Attribute(entangled: string)  : `fme_type' has value `fme_area'
          entangled to [SHAPE_GEOMETRY]
Coordinate System: `'
Geometry Type: IFMEPolygon
Boundary:
   Geometry Type: IFMELine
   Number of Coordinates: 5 -- Coordinate Dimension: 2
   (0,0)(0,2)(3,2)(3,0)(0,0)

Forum|alt.badge.img
  • Author
  • Jul 11, 2017 4:48 PM UTC

Hi @jitkam, it depends on your desired CSV table schema. For example, how do you want to describe this polygon feature (having 3 user attributes - attr1, attr2, attr3, and a single polygon geometry with 5 vertices) in the destination CSV table?

Attribute(string)             : `SHAPE_GEOMETRY' has value `shape_polygon'
Attribute(encoded: fme-system): `attr1' has value `aaa'
Attribute(encoded: fme-system): `attr2' has value `bbb'
Attribute(encoded: fme-system): `attr3' has value `ccc'
Attribute(string)             : `fme_feature_type' has value `data'
Attribute(string)             : `fme_geometry' has value `fme_polygon'
Attribute(entangled: string)  : `fme_type' has value `fme_area'
          entangled to [SHAPE_GEOMETRY]
Coordinate System: `'
Geometry Type: IFMEPolygon
Boundary:
   Geometry Type: IFMELine
   Number of Coordinates: 5 -- Coordinate Dimension: 2
   (0,0)(0,2)(3,2)(3,0)(0,0)
Hi @takashi, thank you for your comment. I have an shp file with postal codes and I need to convert to csv to have a postal code and a single polygon with each. Taking the shp file as writer and csv as reader without any other elements will only provide me with list of postal codes in the csv right now, so I need to find a way to also add polygons.

 


erik_jan
Contributor
Forum|alt.badge.img+26
  • Contributor
  • Best Answer
  • Jul 11, 2017 5:11 PM UTC

You can use the GeometryExtractor transformer to create an attribute holding the polygon definition (choice of multiple formats, but WKT is often used).


Forum|alt.badge.img
  • Author
  • Jul 11, 2017 5:38 PM UTC

You can use the GeometryExtractor transformer to create an attribute holding the polygon definition (choice of multiple formats, but WKT is often used).

 

Thank you @erik_jan