mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-30 03:39:36 +02:00
Correctly gather the community index resources
- old code assumed that each resource had a link back to a single geojson featureId - this isn't the case anymore so we need to link them in data/index.js
This commit is contained in:
+13
-3
@@ -27,16 +27,26 @@ import whichPolygon from 'which-polygon';
|
||||
|
||||
|
||||
// index the osm-community-index
|
||||
let ociFeatures = {};
|
||||
const loco = new LocationConflation({ type: 'FeatureCollection', features: ociCustomFeatures });
|
||||
const ociFeatures = Object.values(ociResources)
|
||||
.map(resource => loco.resolveLocationSet(resource.locationSet));
|
||||
|
||||
Object.values(ociResources).forEach(resource => {
|
||||
const feature = loco.resolveLocationSet(resource.locationSet);
|
||||
let ociFeature = ociFeatures[feature.id];
|
||||
if (!ociFeature) {
|
||||
ociFeature = JSON.parse(JSON.stringify(feature)); // deep clone
|
||||
ociFeature.properties.resourceIDs = new Set();
|
||||
ociFeatures[feature.id] = ociFeature;
|
||||
}
|
||||
ociFeature.properties.resourceIDs.add(resource.id);
|
||||
});
|
||||
|
||||
|
||||
export let data = {
|
||||
community: {
|
||||
features: ociFeatures,
|
||||
resources: ociResources,
|
||||
query: whichPolygon({ type: 'FeatureCollection', features: ociFeatures })
|
||||
query: whichPolygon({ type: 'FeatureCollection', features: Object.values(ociFeatures) })
|
||||
},
|
||||
imagery: dataImagery, //legacy
|
||||
presets: {
|
||||
|
||||
Reference in New Issue
Block a user