Skip to main content
Solved

Constrain Voronoi polygons to another layer


Hi all,

I am currently creating Voronoi polygons (using the VoronoiDiagrammer) and I can use the Clipper to cut the polygons created using polygons from another layer (Layer B).

Is there a way to constrain the created Voronoi polygons to this other polygon layer before clipping? i.e. All information in the points used to create the Voronoi polygons, should stay within the bounds of the polygons of Layer B which they are contained in.

Many thanks.

Edit: Please see diagram added below as a sample. I would like the create Voronoi polygons from the purple points only to the edge of the green polygons.

UPDATE:

  • SpatialFilter to remove polygons with no points within them.
  • Clone & Offsetter (x2) to ensure there are at least 3 points in every polygon.
  • PoinOnAreaOverlayer to insert foreign key to the points from the PK of the polygons.
  • VoronoiDiagrammer with Group By parameter set to the foreign key field.
  • Dissolver to remove the small triangles.
  • Clipper to clip back to to original polygons.

Where polygons originally contained only one point from Layer B, the VoronoiDiagrammer outputs only the tiny triangles I created using the Cloner & Offsetter and not to extent of the Layer A polygon.

Best answer by markatsafe

No, you can't constrain the creation of the voronoi cells to the areas of interest (green). But I think if you use Group By in the VoronoiDiagrammer you'll probably get a better result. i.e. use a PointOnAreaOverlayer to match the points to the areas and then use that to Group By in the VoronoiDiagrammer. Then Clip to the area. See the attached workspace

View original
Did this help you find an answer to your question?

7 replies

LizAtSafe
Safer
Forum|alt.badge.img+15
  • Safer
  • July 31, 2017
Hi @willd would you be able to upload your diagram again, it appears the image is broken.

  • Author
  • July 31, 2017
LizAtSafe wrote:
Hi @willd would you be able to upload your diagram again, it appears the image is broken.
Hi @lizsanderson, should be fixed now.

Forum|alt.badge.img+2
  • Best Answer
  • August 1, 2017

No, you can't constrain the creation of the voronoi cells to the areas of interest (green). But I think if you use Group By in the VoronoiDiagrammer you'll probably get a better result. i.e. use a PointOnAreaOverlayer to match the points to the areas and then use that to Group By in the VoronoiDiagrammer. Then Clip to the area. See the attached workspace


  • Author
  • August 2, 2017
markatsafe wrote:

No, you can't constrain the creation of the voronoi cells to the areas of interest (green). But I think if you use Group By in the VoronoiDiagrammer you'll probably get a better result. i.e. use a PointOnAreaOverlayer to match the points to the areas and then use that to Group By in the VoronoiDiagrammer. Then Clip to the area. See the attached workspace

Hi Mark, thanks for getting back to me. 

 

 

I am now getting the error:

 

 

VoronoiDiagrammer(SurfaceModelFactory): Fail to set up the Surface Model. A minimum of 3 points are required for the Surface Model
Many of my 'Layer B' polygons only contain 2 points.

 

 

If I clone all the points, can I randomly offset the clones before the VoronoiDiagrammer?

david_r
Evangelist
  • August 2, 2017
willd wrote:
Hi Mark, thanks for getting back to me. 

 

 

I am now getting the error:

 

 

VoronoiDiagrammer(SurfaceModelFactory): Fail to set up the Surface Model. A minimum of 3 points are required for the Surface Model
Many of my 'Layer B' polygons only contain 2 points.

 

 

If I clone all the points, can I randomly offset the clones before the VoronoiDiagrammer?
The polygons need at least 3 coordinates for them to be considered a valid polygon. 

 

 

You could use a GeometryValidator and a GeometryFilter to prevent invalid polygons from entering the VoronoiDiagrammer.

  • Author
  • August 2, 2017
david_r wrote:
The polygons need at least 3 coordinates for them to be considered a valid polygon. 

 

 

You could use a GeometryValidator and a GeometryFilter to prevent invalid polygons from entering the VoronoiDiagrammer.
Isn't it the points entering the VoronoiDiagrammer? I think there needs to be 3 or more points per 'Group By' area. 

 

 

If I create clones of the points and offset them (then use a dissolver later). Wouldn't that work? 

 

 

Problem is if I use the Offsetter with a constant offset I get this error: 

 

 

Surface Model cannot be constructed. Either all points are linear or initial set of points did not consist of 3 non NAN elevations

Forum|alt.badge.img+2
markatsafe wrote:

No, you can't constrain the creation of the voronoi cells to the areas of interest (green). But I think if you use Group By in the VoronoiDiagrammer you'll probably get a better result. i.e. use a PointOnAreaOverlayer to match the points to the areas and then use that to Group By in the VoronoiDiagrammer. Then Clip to the area. See the attached workspace

@willd You definitely do need 3+ points to generate a Voronoi diagram. I don't think I'd recommend cloning an offsetting points to generate the Voronoi Diagram. Which raises the question - is the voronoi the appropriate tool for your task? If many of your areas only contain 2 points then this would mean the voronoi doesn't have much meaning in this context.

 

Perhaps reviewing the goal of the workflow might help others come up with a solution based on different FME transformers.

 


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