Question

Polylines to polygon with attributes

  • 19 November 2013
  • 9 replies
  • 18 views

I'm trying to convert polylines (shp) to polygons (shp).

 

 

Every polyline (in some cases multipart) has it's own number.

 

So that number has to stay in the attribute table of the new polygon.

 

 

The steps I'll take are:

Reader --> Attribute Exposer --> AreaBuilder (by it's own numer) --> Writer (polygon shape for 'area') AND Writer2 (polyline shape for unused_lines)

 

 

What am I doing wrong, I'm not getting the individual number through in the writer.

 

Which I'll see in the Inspector, so it must be there somewhere...

 

 

Any help would be appreciated!

9 replies

Badge +10
I suspect that your line IDs, presumably sever different IDs per polygon are being destroyed because you are not preserving a list attribute in your AreaBuilder. Under 'Polygon Parameters', create a 'Polygon List Name' and then you could say use a ListConcatenator to concatenate the element that contains the ID of each line that was used per polygon. A starter on Lists here: http://fmepedia.safe.com/articles/FAQ/List-Attributes

 

 

 

Userlevel 4
Badge +13
HI,

 

 

Since you are using the group by (your number) that is kept further on in hte translation, to keep the rest specify a name for a list in the polygon list name parameter.

 

All attributes from the lines composing the polygon will be available via the list

 

 

Itay
Userlevel 4
Hi,

 

 

if you expand the output feature type, is the triangle next to the individual number red or green?

 

 

Example:

 

 

 

If it's red it means there is no corresponding attribute name and there is probably a typo somwhere either in the workspace or in the output feature type.

 

 

David
Thanks for these quick reactions.

 

 

I think I have to dive into this, because I've never worked with the Polygon List Name and ListConcatenator. I thought it wouldn't be that difficult to create these polygons out of the polylines.

 

 

Badge +10
Hi,

 

 

Well here's an example workspace to get you started and demonstrate what I mean:

 

 

http://goo.gl/lP0qqt

 

 

There's a zipped FMW at the end of the link for you.

 

 

Cheers, Dave
I'm still not getting it.

 

 

http://we.tl/G7R6BsU1Y9

 

 

Here is a download of what I have at the moment
Userlevel 2
Badge +17
Hi,

 

 

If LOKATIENR is unique ID of individual lines, the AreaBuilder will not work expectedly. Because it creates an area from lines having same value of "Group By" attribute. Try clearing "Group By" parameter of the AreaBuilder.

 

 

Takashi
Yes, LOKATIENR is the unique ID of the individual lines.

 

 

So every line(s) with a unique ID has to becoma a polygon. It shouldn't be that difficult I thought.

 

 

If I do FanOut by attribute (LOKATIENR) then it makes a lot of individual shapefiles with the LOKATIENR as name of the new shapefile.

 

 

So it couldn't be difficult to make 1 shapefile with the LOKATIENR as attribute.

 

 

It's driving me crazy
Hi everybody,

 

 

Problem solved.

 

 

It was quite easy.

 

I didn't had to make a list.

 

 

I had to place the attribute exposer after the AreaBuilder.

 

So I build an area based on the LOKATIENR, then I exposed the attributes of the areas. And then connect the the LOKATIENR with the Writer where I had to fill in a user attribute. And connect that one woth the LOKATIENR of the attribute exposer.

 

 

Thanks for all the help!

Reply