mapbox / mapbox/mapbox-java

TurfsJoins pointsWithinPolygon => Need more informations

Đang mở
#1,311 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
Java
Star
438
Fork
117
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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)
    }
}

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu từ TurfJoins.pointsWithinPolygon và so sánh cách xây dựng FeatureCollection được cung cấp với các tọa độ polygon mà phương thức mong đợi; kiểm tra mã service Kotlin được cung cấp, đặc biệt là việc lọc và thứ tự tọa độ. Tái hiện kết quả rỗng với cùng các điểm và polygon, đồng thời xem issue là hoàn tất khi đã xác định được nguyên nhân và phương thức trả về các điểm mong đợi hoặc đã ghi lại cách sửa input cần thiết.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
java, kotlin
Lĩnh vực
backend
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.