Hello community,
I've got a set of longitude and lattitude points in excel, Which I've used to create points and then built a polygon using the tools Create Points and Poly-Build.
However, what I would like to do is divide the polygon into 2 or 3 or more equal spaces. Is this possible?
With kind regards,
Lazzanova.
Solved! Go to Solution.
@Lazzanova Anything is possible with Alteryx. But I would suggest that instead of going from points to polygon to separate polygons, you go from points to multiple polygons.
Here's how I would do it:
Take the list of points. Pick two or three points furthest away from each other.
Use the Find Nearest tool to find each point closest to one of far points. Then, you can use a Unique tool to ensure you only have the first/closest matching point. From there, build your polygons.
Hi @Lazzanova ,
as far as I'm aware there's no functionality to split it into equal parts, so to achieve this you would need to define the line on which you which you want to split the polygon and then create an intersection to perform the split.
I might be wrong, but as far as I'm aware that's the only way to do it.
M.
These are the coördinates of the polygon. Regarding this, I have 2 questions:
30.99052 40.77667
30.99047 40.77619
30.99025 40.77619
30.99024 40.77659
30.99032 40.77672
1) I need to split this polygon into 10 pieces which have the same amount of squared meters. Any advice how to do this?
2) Is it possible that Alteryx can calculate the total squared meters of the polygon? If so, how?
* Nevermind question number 2. With a bit more research I found out that the Spatial Info covers this.
With kind regards,
Önder Kandemir.
Hi @Lazzanova
Splitting something into equal parts kind of depends on what you mean.
Does the orientation of the pieces matter?
What about the shape?
I did a quick set-up that uses the grid tool to (approximately) split the shape into sections, but you end up with this stripey effect.
I did this by taking the area of the whole shape, then splitting the shape to 10cm grid.
I then worked out what a tenth of the total area was and added up the grid squares until I got to that value.
You can then summarise the grids back together to get the overall shape.
The results you get depend on the size of the grid - here's a 1m grid
I've attached a (very) crude routine for you to look at.
Regards,
Ben
Wow I am amazed 😶 nicely done @Ben_H 🙂
This seemed like an interesting algorithm to tackle.
Since the Export Workflow tool (as of 20.1) doesn't recursively include all of the dependencies, I've attached a set of files to this post. (Save them all into the same folder and then open the Test.yxmd file.)
The algorithm basically starts at 0 degrees (north) and iterates around the clock face until that wedge approximates the exact portion desired. The two options into the macro are Number of Parts and Error Rate. Because it may be impossible to find the exact degree at which to split the polygon, I allow the user to determine the allowable error rate.
You will note that the last wedge that is created will often have the largest error. That is because when I get to the last portion, I just set the final vector back at zero. Therefore, all of the errors in the preceding wedges will compound into the last wedge.
If you want to really get really precise and dial the error rate way down, then you may have to go into the IterateSplitPolygonEqually.yxmc macro and bump the maximum number of iterations way up in order for the macro to finish.
P.S. I'm pleased to see @Ben_H has tackled this a different way. When I was noodling on this algorithm, a grid-based option was my second choice. But I already had some 'iterate around a clockface' parts laying around and so chose this path first.
I forgot to mention that in addition to all of the fields from the original input record, two fields (PolyID and PercentError) are added to the output.
Ugh. I just found a dependency that I omitted.
Please find it and put it into the folder with the others. You may have to 'find the missing macro' to get it to work.
User | Count |
---|---|
18 | |
14 | |
13 | |
9 | |
8 |