diff --git a/packages/web/src/datagrid/DataGridCore.svelte b/packages/web/src/datagrid/DataGridCore.svelte
index 108813fd..8ab9cf65 100644
--- a/packages/web/src/datagrid/DataGridCore.svelte
+++ b/packages/web/src/datagrid/DataGridCore.svelte
@@ -393,7 +393,7 @@
import { apiCall } from '../utility/api';
import getElectron from '../utility/getElectron';
import { isCtrlOrCommandKey, isMac } from '../utility/common';
- import { selectionCouldBeShownOnMap } from '../elements/SelectionMapView.svelte';
+ import { createGeoJsonFromSelection, selectionCouldBeShownOnMap } from '../elements/SelectionMapView.svelte';
import ErrorMessageModal from '../modals/ErrorMessageModal.svelte';
import EditCellDataModal, { shouldOpenMultilineDialog } from '../modals/EditCellDataModal.svelte';
import { getDatabaseInfo, useDatabaseStatus } from '../utility/metadataLoaders';
@@ -682,13 +682,21 @@
showModal(ErrorMessageModal, { message: 'There is nothing to be shown on map' });
return;
}
+
+ const geoJson = createGeoJsonFromSelection(selection);
+ if (!geoJson) {
+ showModal(ErrorMessageModal, { message: 'There is nothing to be shown on map' });
+ return;
+ }
+
+
openNewTab(
{
title: 'Map',
icon: 'img map',
tabComponent: 'MapTab',
},
- { editor: selection.map(x => _.omit(x, ['engine'])) }
+ { editor: geoJson }
);
return;
}
diff --git a/packages/web/src/elements/MapView.svelte b/packages/web/src/elements/MapView.svelte
index 2f43fc18..40f89f4c 100644
--- a/packages/web/src/elements/MapView.svelte
+++ b/packages/web/src/elements/MapView.svelte
@@ -17,6 +17,7 @@
function addObjectToMap() {
if (!map) return;
+ if (!geoJson) return;
for (const layer of layers) {
layer.remove();
diff --git a/packages/web/src/elements/SelectionMapView.svelte b/packages/web/src/elements/SelectionMapView.svelte
index 2fb5dcc5..ec64fde5 100644
--- a/packages/web/src/elements/SelectionMapView.svelte
+++ b/packages/web/src/elements/SelectionMapView.svelte
@@ -11,10 +11,10 @@
return res;
}
export function findLatPaths(obj) {
- return findLatLonPaths(obj, x => x.includes('lat'));
+ return findLatLonPaths(obj, x => x.toLowerCase()?.includes('lat'));
}
export function findLonPaths(obj) {
- return findLatLonPaths(obj, x => x.includes('lon') || x.includes('lng'));
+ return findLatLonPaths(obj, x => x.toLowerCase()?.includes('lon') || x.toLowerCase()?.includes('lng'));
}
export function findAllObjectPaths(obj) {
return findLatLonPaths(obj, (_k, v) => v != null && !_.isNaN(Number(v)));
@@ -33,21 +33,6 @@
}
return false;
}
-
-
-
+
+