Skip to main content

Hey everybody,

I would like to define the hierarchy from the first administrative level into the second administrative level, and I would like to do that with the spatial reference. So for example I have a shapefile of the first administrative level which is called "Central". The second shapefile are the districts, so the second administrative level, which are all in the Central state. Lets say we have 4 districts (south, east, west and north).

The name of the Central state, so "Central" should get automatically get written in the attribute field "hierarchy" of the 4 districts. I would like to use the spatial reference as transformer. But it was not working. Has anybody an idea how to solve that problem?

Thank you in advance.

Cheers,

Fabian

 

There's a number of transformers you can use for this, the SpatialRelator is probably the best suited to the task. It does require that your boundaries match across the different levels.


@zentnerfabian​ The most reliable (and probably fastest) way to accomplish this is to use CenterPointReplacer to generate the inside point of the 'Districts' and then use PointOnAreaOverlayer to determine which districts line in the different 'Central' admin areas. You need to preserve the original 'district' areas, so use GeometryExtractor/GeometryReplacer before and after so save and recover the original area geometry.

This approach is a little more reliable than SpatialRelator since SpatialRelator will assume the boundaries match exactly.


@zentnerfabian​ The most reliable (and probably fastest) way to accomplish this is to use CenterPointReplacer to generate the inside point of the 'Districts' and then use PointOnAreaOverlayer to determine which districts line in the different 'Central' admin areas. You need to preserve the original 'district' areas, so use GeometryExtractor/GeometryReplacer before and after so save and recover the original area geometry.

This approach is a little more reliable than SpatialRelator since SpatialRelator will assume the boundaries match exactly.

Hi @Mark Stoakes​ ,

Thank ypu for your reply. I tried your way, but I fail when I try to copy the name informations from the areas into a specific attribute field from the points which are overlaying. Could you help me please with options in the PointOnAreaOverlayer? I but an picture with my idea. I thought I have to use "Create new list on Points" where I use the informations from the areas. But I can't differ inside the options if its the point or the area attributefields.

 

Thank you.


@zentnerfabian​ I think in your case you will only have one Central (area) for each District (points). So the way you have configured the PointOnAreaOveralyer you'll have a list ANN with one element that looks like:

ANN{0}.ANN_2

You'll only see the list in Data Inspector or Visual Preview Feature Information window (you won't see the list in the table view)

Since you will only have one Central (area) for each District (points), it might be easier to use Attribute Accumulation - Merge Attributes instead of Generate List


@zentnerfabian​ I think in your case you will only have one Central (area) for each District (points). So the way you have configured the PointOnAreaOveralyer you'll have a list ANN with one element that looks like:

ANN{0}.ANN_2

You'll only see the list in Data Inspector or Visual Preview Feature Information window (you won't see the list in the table view)

Since you will only have one Central (area) for each District (points), it might be easier to use Attribute Accumulation - Merge Attributes instead of Generate List

@Mark Stoakes​ Ok thank you for that note. I didn't know about that I can't export the list and just visualize it. Actually with ANN was just a try. The attribute "NAME" of the area, should go to the "HIERARCHIE" attribute of the point which is overlaying over the area. So I have no idea how the options inside the Attribute Accumulation has to look. Every time I try to that with Attribute Accumulation it brings me no result.


@zentnerfabian​ I think your workspace will look something like this:

imageI've attached the workspace and example data (FME 2022.2)


@zentnerfabian​ I think your workspace will look something like this:

imageI've attached the workspace and example data (FME 2022.2)

@Mark Stoakes​ thank you for your answer. I tried to adapt that way but it was not working. Maybe in the screenshot I made, it will show what I really try to do. I have two ESRI Shapefiles, so in that case I have a level-2-admin-area "New York". This is the first Shapefile. And then I have level-3-admin-areas, so the counties of NY. I want now that all Counties of NY get the "name" so "New York" in the attribute field "hierarchie". So in each field of "hierarchie" of all Counties shoud stand "New York" because the Counties are overlaying over the level-2-admin-area NY.


@zentnerfabian​ "a picture is worth a thousand words" (F. Barnard). A small sample dataset is worth a thousand pictures (annon.)

It looks like you have a naming conflict between the "name" & "hierarchie" attributes. Perhaps renaming the point "name" attribute before it enters the PointOnAreaOverlayer


@zentnerfabian​ "a picture is worth a thousand words" (F. Barnard). A small sample dataset is worth a thousand pictures (annon.)

It looks like you have a naming conflict between the "name" & "hierarchie" attributes. Perhaps renaming the point "name" attribute before it enters the PointOnAreaOverlayer

@Mark Stoakes​ 

thank you a lot! It worked finally. I only have still some problems with area which are formed like triangles, so he creates the center point in kind of the middle of the area and it looks like if he thinks it would be bigger area. So in that case sometime the center point is not in the middle of the area. I tried the other to options by "CenterPointReplacer" but still, some points are laying outside of the areas. Is there a chance to catch them?


Reply