Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions public/lib/dragAndDroplayercontrol/DndLayerControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -430,14 +430,16 @@ function getExtendedMapControl() {

resp.responses.forEach(spatialPathDoc => {
if (spatialPathDoc.hits.hits.length === 1) {
const spaitalPathSource = spatialPathDoc.hits.hits[0]._source;
const spatialPathSource = spatialPathDoc.hits.hits[0]._source;

let geometryType = 'point';
if (spaitalPathSource.geometry.type.includes('Polygon')) {
if (spatialPathSource.geometry.type.includes('Polygon')) {
geometryType = 'polygon';
} else if (spatialPathSource.geometry.type.includes('Line')) {
geometryType = 'line';
}

layerTypes[spaitalPathSource.spatial_path] = geometryType;
layerTypes[spatialPathSource.spatial_path] = geometryType;
}
});
return layerTypes;
Expand Down Expand Up @@ -488,7 +490,7 @@ function getExtendedMapControl() {
// a check if there are any stored layers
if (resp) {
const aggs = resp.aggregations[2].buckets;
geometryTypeOfSpatialPaths = _getGeometryTypeOfSpatialPaths(aggs);
geometryTypeOfSpatialPaths = await _getGeometryTypeOfSpatialPaths(aggs);
const savedStoredLayers = [];

aggs.forEach(agg => {
Expand Down
22 changes: 18 additions & 4 deletions public/vislib/vector_layer_types/EsLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ export default class EsLayer {
layer.unbindPopup();
};
self.bindPopup(layer, options);
} else if ('geo_shape' === geo.type || 'polygon' === geo.type || 'multipolygon' === geo.type) {
} else if ('geo_shape' === geo.type ||
'polygon' === geo.type ||
'multipolygon' === geo.type ||
'linestring' === geo.type ||
'multilinestring' === geo.type) {
const shapesWithGeometry = _.remove(hits, hit => {
return _.get(hit, `_source[${geo.field}]`);
});
Expand All @@ -59,7 +63,11 @@ export default class EsLayer {

geometry.type = self.capitalizeFirstLetter(geometry.type);
if (geometry.type === 'Multipolygon') {
geometry.type === 'MultiPolygon';
geometry.type = 'MultiPolygon';
} else if (geometry.type === 'Linestring') {
geometry.type = 'LineString';
} else if (geometry.type === 'Multilinestring') {
geometry.type = 'MultiLineString';
}

if (type === 'es_ref') {
Expand Down Expand Up @@ -130,7 +138,11 @@ export default class EsLayer {
}
);
self.bindPopup(layer, options);
layer.icon = `<i class="far fa-stop" style="color:${layerControlColor};"></i>`;
if (geo.type === 'linestring' || geo.type === 'multilinestring') {
layer.icon = `<i class="far fa-horizontal-rule" style="color:${layerControlColor};"></i>`;
} else {
layer.icon = `<i class="far fa-draw-square" style="color:${layerControlColor};"></i>`;
}
layer.type = type + '_shape';
layer.destroy = () => layer.options.destroy();
} else {
Expand Down Expand Up @@ -165,8 +177,10 @@ export default class EsLayer {

if (geo.type === 'point') {
layer.icon = `<i class="${options.icon}" style="color:${options.color};"></i>`;
} else if (geo.type === 'line') {
layer.icon = `<i class="far fa-horizontal-rule" style="color:${options.color};"></i>`;
} else {
layer.icon = `<i class="far fa-stop" style="color:${options.color};"></i>`;
layer.icon = `<i class="far fa-draw-square" style="color:${options.color};"></i>`;
}

layer.options = { pane: 'overlayPane' };
Expand Down