Fix import helper

This commit is contained in:
pietervdvn 2022-02-09 19:11:04 +01:00
parent ae68a09775
commit 244e4c294d
3 changed files with 3 additions and 12 deletions

View file

@ -35,17 +35,11 @@ export class CompareToAlreadyExistingNotes extends Combine implements FlowStep<{
constructor(state, params: { bbox: BBox, layer: LayerConfig, geojson: { features: any[] } }) {
const convertState: DesugaringContext = {
sharedLayers: new Map(),
tagRenderings: new Map()
}
const layerConfig = known_layers.layers.filter(l => l.id === params.layer.id)[0]
if (layerConfig === undefined) {
console.error("WEIRD: layer not found in the builtin layer overview")
}
const importLayerJson = new CreateNoteImportLayer(365).convertStrict(convertState, <LayerConfigJson>layerConfig, "CompareToAlreadyExistingNotes")
const importLayerJson = new CreateNoteImportLayer(365).convertStrict(<LayerConfigJson>layerConfig, "CompareToAlreadyExistingNotes")
const importLayer = new LayerConfig(importLayerJson, "import-layer-dynamic")
const flayer: FilteredLayer = {
appliedFilters: new UIEventSource<Map<string, FilterState>>(new Map<string, FilterState>()),

View file

@ -87,7 +87,7 @@ export class MapPreview extends Combine implements FlowStep<{ bbox: BBox, layer:
const matching: UIEventSource<{ properties: any, geometry: { coordinates: [number, number] } }[]> = layerPicker.GetValue().map((layer: LayerConfig) => {
if (layer === undefined) {
return undefined;
return [];
}
const matching: { properties: any, geometry: { coordinates: [number, number] } }[] = []

View file

@ -22,9 +22,7 @@ export class PreviewPanel extends Combine implements FlowStep<{ features: { prop
state: UserRelatedState,
geojson: { features: { properties: any, geometry: { coordinates: [number, number] } }[] }) {
const t = Translations.t.importHelper;
console.log("Datapanel received", geojson)
const propertyKeys = new Set<string>()
for (const f of geojson.features) {
Object.keys(f.properties).forEach(key => propertyKeys.add(key))
@ -36,7 +34,6 @@ export class PreviewPanel extends Combine implements FlowStep<{ features: { prop
for (const key of Array.from(propertyKeys)) {
const values = Utils.NoNull(geojson.features.map(f => f.properties[key]))
console.log("There are ", values.length, "features with attribute", key, "namely", values)
const allSame = !values.some(v => v !== values[0])
let countSummary: BaseUIElement
if (values.length === n) {