Skip to main content
Solved

Asigning value to a nul attribute based on topology


Hey guys,

 

 

I have one quick question: If you have a polygon with attribute value 0 and its surrounded by polygons with a different value. Is there a way of assign the value of the surrounding polygons to the 0 valued polygon?

To elaborate. Im working with postal code areas and sometimes there is an empty polygon surrounded by polygons with one postal code (for ex. 1234AB). Is there a plug in which can assign the postal code of the surrounding areas to the empty attribute?

regards,

 

 

Bart

Best answer by gio

With or without buffering the boundary of the zero value polygon (in case it don't touch) you can just use a spatialrelator. (intersect, as the sort of relation is not relevant )

The use a listconcatenator on the related_candidates list.

Then listduplicateremover to remove the duplicate postcode's (in case it is surrended by different zones).

If listelement counter is 0 , u can listindex{0} the _concatenated list.

Else it is surrounded by multiple postcode zones.

View original
Did this help you find an answer to your question?
This post is closed to further activity.
It may be a question with a best answer, an implemented idea, or just a post needing no comment.
If you have a follow-up or related question, 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.

6 replies

takashi
Evangelist
  • January 6, 2016

In general, the SpatialRelator or SpatialFilter can be used to merge attributes of a feature to other features based on spatial relations. If you can assume that the "surrounding" polygon [a] contains the target polygon [b], try using the SpatialFilter.

  • Send [a] to the Filter port, send [b] to the Candidate port.
  • Set "Contains" to the "Tests to Perform" parameter.
  • Set "Yes" (default) to the "Merge Attributes" parameter.

Note: If [b] feature has the same name attribute as [a] feature, attributes of [a] will not be merged to [b]. In such a case, remove or rename the attributes of [b] feature beforehand.


erik_jan
Contributor
Forum|alt.badge.img+19
  • Contributor
  • January 6, 2016

In this case you probably want the Touch as Tests to perform if you are using the SpatialFilter.

You can also use the NeighborFinder to perform this test and merge the attributes from touching polygons (set maximum distance to 0).You want the empty polygons as Base and the polygons containing a postal code as Candidate.


jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • January 6, 2016

I would probably go with the NeighborFinder as per erik_jan and built the list of close candidates. That way you can check if all the surrounding polygons contain the same postal code, or if there are different postal codes, then you can you some other logic to decide which one to use (eg. largest adjacent area, most number of adjacent).


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • Best Answer
  • January 6, 2016

With or without buffering the boundary of the zero value polygon (in case it don't touch) you can just use a spatialrelator. (intersect, as the sort of relation is not relevant )

The use a listconcatenator on the related_candidates list.

Then listduplicateremover to remove the duplicate postcode's (in case it is surrended by different zones).

If listelement counter is 0 , u can listindex{0} the _concatenated list.

Else it is surrounded by multiple postcode zones.


  • Author
  • January 7, 2016

@gio, I also think the spatialrelator is the best suitable for this occasion. When I run it it gives only the count of the suitable neighbors. Is it possible to make it save the postal code of the neighbor? I read the webpage a few times already and tried every option but don't get it to work.


  • Author
  • January 7, 2016

Never mind, figured it out;) thanks for your help guys


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings