tldr; How do you union a series of polygons and remove redundant lines
Hi there,
Just started using RGeo. Firstly thought I would ask a broader question as you guys might know a better solution to the problem I'm trying to solve.
Basically I have a series of coordinates that I am mapping out into a cartesian space. For each of these, what can be described as lines, I have converted these to rectangles using some basic perpendicular maths. For each of these newly generated rectangles I want to merge these into a single polygon. So imagining you went for a walk, that single path would now be turned into a polygon representing an area.
My questions now are:
- What is the most cost effective way of union-ing all of these rectangle/polygons into one.
- How can I simplify the points on the newly created polygon to remove any redundant lines.
I ask this because I tried union-ing two rectangles:
- a = [[0, 0], [2, 0], [2, 10], [0, 10]]
- b = [[1, 0], [3, 0], [3, 10], [1, 10]]
- a.union(b)
Of which produced:
POLYGON ((1.0 0.0, 0.0 0.0, 0.0 10.0, 1.0 10.0, 2.0 10.0, 3.0 10.0, 3.0 0.0, 2.0 0.0, 1.0 0.0))
Immediately you can see (0.0, 0.0) among many others should be removed this this list.