TurfsJoins pointsWithinPolygon => Need more informations
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
Start at TurfJoins.pointsWithinPolygon and compare the supplied FeatureCollection construction with the method's expected polygon coordinates; inspect the Kotlin service code shown, especially filtering and coordinate order. Reproduce the empty result with the same points and polygons, and consider the issue done when the cause is identified and the method returns the expected points or the required input correction is documented.
Written by the indexing model from the issue text.
Description
Hello !
First of all, thank you for your work!
I have a service that transforms data into geojson.
I have points and polygons. I want to check if the points are in the polygons. For this, I use "TurfJoins.pointsWithinPolygon()".
But when I pass my two FeatureCollections as parameters, it returns an empty list. Maybe I forgot something?
After several hours of searching, I decide to turn to you. I thank you in advance for your help. I code in Kotlin
class PointWithinPolygonService @Autowired constructor (val tblPolygonRepository: TblPolygonRepository, val pointsService: PointsService) {
fun withinPolygon(): FeatureCollection {
val polygons = tblPolygonRepository.findAll()
val points = pointsService.getPoints()
val pointsFeatureCollection = FeatureCollection
.fromFeatures(points
.filter { it.gpsLongitude != null }
.map { Feature.fromGeometry(Point.fromLngLat(BigDecimal(it.gpsLongitude!!).setScale(4, RoundingMode.CEILING).toDouble(), BigDecimal(it.gpsLatitude!!).setScale(4, RoundingMode.CEILING).toDouble()))
})
val polygonsFeatureCollection = FeatureCollection
.fromFeature(Feature
.fromGeometry(Polygon
.fromLngLats(polygons
.map {it.getListCoordinates()?.map { it -> Point.fromLngLat(it.longitude, it.latitude) } }))
)
return TurfJoins.pointsWithinPolygon(pointsFeatureCollection, polygonsFeatureCollection)
}
}
- Dominant language
- Java
- Stars
- 438
- Forks
- 117
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from mapbox/mapbox-java
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
mapbox/mapbox-java#1640 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
mapbox/mapbox-java#1635 ·
-
Difficulty 5/5 Over a week Newbie friendliness 15/100
mapbox/mapbox-java#1619 ·
-
Mapbox-java incompatible with gson 2.13.0 and up - call to internal GSON classes that were renamed Open
Difficulty 2/5 1-3 hours Newbie friendliness 48/100
mapbox/mapbox-java#1614 · 2 comments · 1 reaction ·
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
mapbox/mapbox-java#1612 · 1 reaction ·
All issues in mapbox/mapbox-java
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
checkstyle/test-configs#263 ·
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 90/100
apache/cloudstack#14222 ·
-
[BUG]茶杯方块在取茶时会引发崩溃 Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
1.0.0-alpha2 Type/Improvement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
wso2/dpdp-accelerator#272 ·