-
Notifications
You must be signed in to change notification settings - Fork 168
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
Intersection between two routes (linestrings) #159
Comments
Yes. Each route is a LineString, and you could test intersection against a circle (point-radius).
Yes.
This is the same as the previous question? At least, in Spatial4j, you can test routes against each other. This is O(N) with the number of routes to test if you want to know the intersecting routes for a particular route. If you have many, you'll have to look elsewhere for some persistent indexing approach (e.g. Lucene/Solr).
No, sorry. The primary geometry/shape feature in Spatial4j is computing a relationship between a pair of shapes. There is no further information on where shapes touch/intersect. |
Thanks, at least if I know to be interacting I can test for segments and apply simple math to that there are about 60 tracks with no more than 20 points each so a pre-calculation would not be that much of a burden and it can be cached. Regards |
Hello, Could you show me an example that test intersection of LineString against a circle? Best regards |
Ouch; I was wrong! Anything can be intersected against a rectangle or point, but relations that don't involve either (circle, line, polygon) are not universally supported. It would be really nice if circle-line intersection was supported; ah well. As an alternative, consider using JTS. JTS has a LineString. For a circle you can approximate it. JTS has a utility somewhere for producing a polygonal circle given a center point and radius. |
Thanks for your information. org.locationtech.jts.io.WKTReader wktReader = new org.locationtech.jts.io.WKTReader(); |
Oops; I was wrong; that was embarrassing. I was looking at the Spatial4j-native BufferedLineString shape but forgot that the JtsGeometry wrapper is in play here which does relate with a Circle. Just be aware that this logic works in a cartesian space, so will be inaccurate if you're using it in a "geo" context ("geo" is Spatial4j's lingo for a spherical world model). Thus if your points are decimal degrees lat/lon, this relation will become increasingly inaccurate away from the equator. |
Hi
I'm really sorry for asking such a noob question, but is this library the correct one to estimate:
I plan to use this on Android /offline
The text was updated successfully, but these errors were encountered: