Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 01 2018 17:48
    @jnh5y banned @matrixbot
Martin Davis
@dr-jts
Of particular note is that this includes a fast Constrained Delaunay Triangulation for polygons, which gives much better quality.
Here's an example:
image.png
It's also going to serve as the basis for some other interesting algorithms, such as Skeleton and possibly a vertex-based subdivision.
James Hughes
@jnh5y
As a note, Apache Jena is using JTS for its GeoSPARQL support! (I'm helping co-chair a spatial track for Apache Con @ Home and the speaker just mentioned using JTS!)
Martin Davis
@dr-jts
w00t!
Thanks to the relicensing, I guess?
Jody Garnett
@jodygarnett
That is good, so glad to avoid forking.
@dr-jts sorry I got busy the other week during our chat on package names. Did you get a way forward you agreed with?
Martin Davis
@dr-jts
yes, I put the new code in the old triangulate package. Maybe not ideal, but it will do for now.
TidalPoo
@TidalPoo
hi all!
I have been trying for several days to find instructions on how to make a multipolygon from several polygons.
And then how to determine to which polygon the coordinates in multipolygons belong.
I would be grateful for any help.
Jody Garnett
@jodygarnett
What have you figured out so far? MultiPolygon is created from a collection of polygons …
You can use getGeometryN to retrieve a specific geometry to check
I am not sure exactly what you mean by “belong” ?
TidalPoo
@TidalPoo
Perhaps I wrote the question incorrectly. I have a task. I need to make several polygons with names on the plane. A point will move randomly along these polygons. I need to get the name of the polygon where the point is.
Jody Garnett
@jodygarnett
Okay, that tends to be considered a feature (ie geometry with an attribute - in this case a name).
JTS provides one user data object which you could use to store a name. Or you could use a library that supports features such as GeoTools (which has a feature data type and a uses JTS for the geometry attribute(s) of each feature).
How many polygons are you working with? Hundreds, thousands, millions?
TidalPoo
@TidalPoo
thanks for your reply. Yes, I am considering working with geometry. i don't want to use GeoTools. It should be a very light project. I will have several planes (levels), each with its own set of polygons, no more than 50.
TidalPoo
@TidalPoo
The point will be moved by keyboard control. I need to understand which polygon the point is in now. I worked with jmonkey, but it is too heavy a library to perform such a simple function.
Can you show some example code? Do I need to create geometry, assign a name, and add it to multigeometry?
TidalPoo
@TidalPoo
is this ok, or are there any better ideas?
Martin Davis
@dr-jts
That looks fine. You can also just keep the polygons in a regular Java List. The only reason to keep them in a GeometryCollection would be if you want to perform other geometric operations on them.
James Hughes
@jnh5y
@dr-jts sorry for my confusion on that ZM issue;) I'm calling it a night now:)
Martin Davis
@dr-jts
np... get some sleep!
James Hughes
@jnh5y
indeed! I'm liking the suggestion of a single XYZM Test calling out to the operations
Martin Davis
@dr-jts
cool
Björn Harrtell
@bjornharrtell
I have a case where need to union sets of bboxes. It's done in PostGIS and AFAIK it converts bboxes to polygons and uses plain GEOS general polygon union on them which is expensive when the amount is large. Any ideas if this case could deserve an optimized path in JTS?
Martin Davis
@dr-jts
In general unioning rectangles can produce an arbitrarily complex output, so I'm not sure much optimization is possible. Are you aware of a fast algorithm?
Chris Hodgson
@cmhodgson
If you just want an enclosing bounding box for everything then you could use st_extent(), that will be fast but you'll only get the min of the mins and the max of the maxes, not a jagged-edged mass of unioned boxes
Björn Harrtell
@bjornharrtell
@dr-jts: I see you point and unfortunately not..
@cmhodgson: problem is I need to eliminate overlaps to calculate non overlapping area.
Martin Davis
@dr-jts
@jnh5y @jodygarnett any thoughts on #805 and#806? I'm not keen on introducing another dependency, and this is the only complaint about this change so far, so I"m -1 on this
James Hughes
@jnh5y
@dr-jts Neat! That is not adding a dependency to JTS. It is only adding a dependency to the JTS build.
The approach is to have the build generate backwards compatible bytecode
that's actually kinda cool
Martin Davis
@dr-jts
image.png
Just landed: locationtech/jts#810
James Hughes
@jnh5y
Very nice!
DonoG
@DonoG
I’ve got a series of line segments that I’m trying to polygonise. But I’ve got some lines that intersect other lines, but not at a start or end point of another line. To get all the lines to correctly polygonise, I was thinking I might need to test each line for intersections, find the intersection point and then split lines of there are intersections. Or is there an easier way to do this?
Chris Hodgson
@cmhodgson
@DonoG You will want to look at the noding package and noder class - this will do all the intersections for you.
DonoG
@DonoG
@cmhodgson Thanks. I've tried both SimplerNoder and MCIndexNoder - without any luck. I am trying to take a series of linestrings and then polygonise them. If I first compute the nodes, and then use Polygonizer polygonizer = new Polygonizer(false); I can get seven polygons out of the following linestrings. But visually, if I plot the lines, they form nine polygons. The linestrings are: [LINESTRING (450 466, 450 514), LINESTRING (450 562, 450 610), LINESTRING (450 658, 450 706), LINESTRING (228.29750061035156 530, 450 658), LINESTRING (450 562, 228.29750061035156 434), LINESTRING (228.29750061035156 338, 450 466), LINESTRING (671.7025146484375 530, 450 658), LINESTRING (450 562, 671.7025146484375 434), LINESTRING (671.7025146484375 338, 450 466), LINESTRING (228.29750061035156 338, 228.29750061035156 386), LINESTRING (228.29750061035156 434, 228.29750061035156 482), LINESTRING (228.29750061035156 530, 228.29750061035156 578), LINESTRING (671.7025146484375 578, 671.7025146484375 530), LINESTRING (671.7025146484375 482, 671.7025146484375 434), LINESTRING (671.7025146484375 386, 671.7025146484375 338), LINESTRING (450 706, 228.29750061035156 578), LINESTRING (228.29750061035156 482, 450 610), LINESTRING (450 514, 228.29750061035156 386), LINESTRING (630.13330078125 506, 671.7025146484375 530), LINESTRING (671.7025146484375 434, 630.13330078125 410), LINESTRING (450 210, 671.7025146484375 338), LINESTRING (671.7025146484375 578, 450 706), LINESTRING (450 610, 671.7025146484375 482), LINESTRING (671.7025146484375 386, 450 514), LINESTRING (228.29750061035156 530, 269.8667297363281 506), LINESTRING (269.8667297363281 410, 228.29750061035156 434), LINESTRING (228.29750061035156 338, 450 210)]
Martin Davis
@dr-jts
This is because your linework has a couple of places where the lines don't actually touch. This can be observed using the Magnify Topology mode in the JTS TestBuilder:
image.png
So running noding results in this output, where the gap are still present:
image.png
And thus Polygonize only forms polygons in the closed spaces:
image.png
That should be Reveal Topology mode... (I changed the name a while back!)
image.png