mapbox / mapbox/mapbox-java

TurfsJoins pointsWithinPolygon => Need more informations

オープン
#1,311 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Java
スター
438
フォーク
117
PR マージ指標
30日以内にマージされた PR はありません

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

TurfJoins.pointsWithinPolygon から始め、提供された FeatureCollection の構築と、メソッドが期待するポリゴン座標を比較します。提示された Kotlin サービスコード、特にフィルタリングと座標の順序を確認します。同じポイントとポリゴンを使って空の結果を再現し、原因が特定され、メソッドが期待されるポイントを返すか、必要な入力修正が文書化された時点で issue の対応完了とします。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java, kotlin
領域
backend
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。