Concept for rendering maproulette tasks

This commit is contained in:
Robin van der Linde 2022-07-09 21:41:33 +00:00 committed by GitHub
parent 063d7e4637
commit a7f2c26a1d
2 changed files with 167 additions and 0 deletions

View file

@ -82,6 +82,28 @@ export default class GeoJsonSource implements FeatureSourceForLayer, Tiled {
Utils.downloadJsonCached(url, 60 * 60)
.then(json => {
self.state.setData("loaded")
// TODO: move somewhere else, just for testing
// Check for maproulette data
if (url.startsWith("https://maproulette.org/api/v2/")) {
console.log("MapRoulette data detected")
const data = json;
let maprouletteFeatures: any[] = [];
data.forEach(element => {
maprouletteFeatures.push({
type: "Feature",
geometry: {
type: "Point",
coordinates: [element.point.lng, element.point.lat]
},
properties: {
// Map all properties to the feature
...element,
}
});
});
json.features = maprouletteFeatures;
}
if (json.features === undefined || json.features === null) {
return;
}