-
-
Notifications
You must be signed in to change notification settings - Fork 55
Give out points of geometries #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Now the thing is using Makie
a = lines(decompose(Point{2, Int}, ls1))
b = lines(ls1.points.parent.data)
a==b
false The only thing is that will it be fast enough when we have a very large linestring and that would also result in a quite large array? |
How about overloading decompose? |
Ah. That's doable. BTW can we use the Since currently, using BenchmarkTools
pts = collect(Point{2, Float64}(x/2, (x+1)/3) for x in 1:10000)
ls = LineString(pts)
@btime decompose(Point{2, Float64}, ls)
925.390 μs (30012 allocations: 2.98 MiB)
@btime ls.points.parent.data
123.831 ns (6 allocations: 192 bytes) |
Add decompose for polygon
So the new overload is for giving out points of a polygon. pol = Polygon(LineString(Point{2, Int}[(5, 1), (3, 3), (4, 8), (1, 2), (5, 1)]), [LineString(Point{2, Int}[(2, 2), (3, 8),(5, 6) , (3, 4), (2, 2)]), LineString(Point{2, Int}[(3, 2), (4, 5),(6, 1) , (1, 4), (3, 2)])])
decompose(Point{2, Int}, pol)
2-element Array{Array{Union{Array, Point},N} where N,1}:
[[5, 1], [3, 3], [4, 8], [1, 2], [5, 1]]
[Point{2,Int64}[[2, 2], [3, 8], [5, 6], [3, 4], [2, 2]], Point{2,Int64}[[2, 2], [3, 8], [5, 6], [3, 4], [2, 2]]] Here the first element contains Array of exterior points and second contains arrays of interior linestrings' points. |
@visr @SimonDanisch can you take a look? |
@SimonDanisch Really sorry for pestering you this way, but I'd be nice if you can take a look at this PR and #79 too? |
PR for #69
So this overloads the
convert_simplex()
method to break down a linestring.The repetition of Points is the only visible issue currently. Expected is: