forked from MapComplete/MapComplete
Fix contributor count
This commit is contained in:
parent
43601987dc
commit
466dd16568
2 changed files with 21 additions and 3 deletions
|
@ -25,11 +25,22 @@ export default class GeoIndexedStore implements FeatureSource {
|
|||
*/
|
||||
public GetFeaturesWithin(bbox: BBox): Feature[] {
|
||||
// TODO optimize
|
||||
const bboxFeature = bbox.asGeoJson({})
|
||||
const bboxFeature = bbox.asGeojsonCached()
|
||||
return this.features.data.filter((f) => {
|
||||
if (f.geometry.type === "Point") {
|
||||
return bbox.contains(<[number, number]>f.geometry.coordinates)
|
||||
}
|
||||
if (f.geometry.type === "LineString") {
|
||||
const intersection = GeoOperations.intersect(
|
||||
BBox.get(f).asGeojsonCached(),
|
||||
bboxFeature
|
||||
)
|
||||
return intersection !== undefined
|
||||
}
|
||||
if (f.geometry.type === "Polygon" || f.geometry.type === "MultiPolygon") {
|
||||
return GeoOperations.intersect(f, bboxFeature) !== undefined
|
||||
}
|
||||
console.log("Calculating intersection between", bboxFeature, "and", f)
|
||||
return GeoOperations.intersect(f, bboxFeature) !== undefined
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue