-
-
Notifications
You must be signed in to change notification settings - Fork 366
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
Marker outside oddly shaped target area #4965
Comments
I've seen this a few times, afaik always for the leaf type quest, but it didn't bother me because it was clear enough (so far) which oddly shaped forest it was asked about. |
The code to calculate the center of a polygon is here: StreetComplete/app/src/main/java/de/westnordost/streetcomplete/util/math/SphericalEarthMath.kt Lines 362 to 386 in 49f23da
so, currently the center of the polygon is used, not the centroid. There is no particular reason for that. Maybe using the center of the polygon can be calculated faster, not sure. In any case, the centroid algorithm would need to be added in a PR, we do not use a geo-math-library for such calculations |
It's a minor issue. I spotted it for the first time. It got aggravated in this rare case by the area being very narrow, i.e., hardly visible on the map. In most other cases the user can probably guess which area the question belongs to. Thanks for providing a pointer to the current algorithm! Maybe I'll find time to create a PR. |
I'll release a new minor update in a week or so, so now is a good timeframe to implement this when you want to see this change live quickly. If you are not interested anymore in implementing this, I will mark this as "help wanted". |
Unfortunately, I'm not able to spend time on this issue, at the moment. Feel free to mark it as "help wanted"! |
Correction: "centroid" is by definition not necessarily within the boundary of the polygon. MapBox implemented an algorithm finding the polygon pole of inaccessibility, the most distant internal point from the polygon outline in JavaScript: https://github.com/mapbox/polylabel There is not one port of it to Java, ... but three??
I am reluctant to add a Java dependency for this. Mabye someone would like to port this to platform independent Kotlin code (Kotlin multiplatform)? It is about 200 lines of code (production code, not counting unit tests). |
For the "J"-shaped forest area in the above screenshot, Street Complete asks for forest's the leaf type. The marker for the questions is located on a meadow outside the area (probably at its geometrical center).
How to Reproduce
Go to N 51,0356643, E 7,3105947 in the StreetComplete app
Expected Behavior
The question's map marker is located inside the corresponding area.
Versions affected
Android, v52.0.
The text was updated successfully, but these errors were encountered: