Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Maps] Vector tiles for Elasticsearch Data #57248

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
53b9a04
tmp
thomasneirynck Dec 5, 2019
c0b743c
Merge branch 'master' into maps/tiled_vector
thomasneirynck Jan 27, 2020
709cb92
more boilerplate
thomasneirynck Jan 27, 2020
c630e0d
more boilerplate
thomasneirynck Jan 28, 2020
ff049ff
more boilerplate
thomasneirynck Jan 29, 2020
c6e5a26
ordering
thomasneirynck Jan 29, 2020
3e2fd61
cleanup
thomasneirynck Jan 29, 2020
58b8fb3
show filter bar
thomasneirynck Jan 29, 2020
5efc3f1
update on layer changes
thomasneirynck Jan 29, 2020
7d79a14
update on quyery
thomasneirynck Jan 29, 2020
dd7a94a
filtering tooltips
thomasneirynck Jan 30, 2020
e40cf86
cat styling on vector data
thomasneirynck Jan 30, 2020
f0495c6
parse fields
thomasneirynck Jan 30, 2020
a382bb0
cleanup logs
thomasneirynck Jan 30, 2020
ee45dc6
more edits
thomasneirynck Jan 30, 2020
9ac73a1
Merge branch 'master' into maps/tiled_vector
thomasneirynck Jan 30, 2020
f829071
start refactoring
thomasneirynck Jan 30, 2020
e74b1ac
more settings
thomasneirynck Jan 31, 2020
6b0759c
use callwithrequest
thomasneirynck Jan 31, 2020
6a4cceb
boilerplate
thomasneirynck Feb 1, 2020
d79e00a
add point support
thomasneirynck Feb 1, 2020
f2950fc
run count first
thomasneirynck Feb 1, 2020
54f7354
add too mny features
thomasneirynck Feb 2, 2020
0b7cd44
add hatchimage
thomasneirynck Feb 2, 2020
342445f
ensure not empty tile
thomasneirynck Feb 3, 2020
0c87f57
remove logs
thomasneirynck Feb 3, 2020
d6f3143
hack for count coloring
thomasneirynck Feb 5, 2020
dc41c1d
Merge branch 'master' into maps/tiled_vector
thomasneirynck Feb 10, 2020
a5163f6
default countable scale
thomasneirynck Feb 10, 2020
439c96c
stats
thomasneirynck Feb 11, 2020
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
12 changes: 12 additions & 0 deletions x-pack/legacy/plugins/maps/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ export const APP_ID = 'maps';
export const APP_ICON = 'gisApp';
export const TELEMETRY_TYPE = 'maps-telemetry';

export const MVT_GETTILE_API_PATH = 'mvt/getTile';
export const MVT_GETGRIDTILE_API_PATH = 'mvt/getGridTile';

export const MAP_APP_PATH = `app/${APP_ID}`;
export const GIS_API_PATH = `api/${APP_ID}`;
export const INDEX_SETTINGS_API_PATH = `${GIS_API_PATH}/indexSettings`;
Expand All @@ -37,9 +40,13 @@ export function createMapPath(id: string) {
return `${MAP_BASE_URL}/${id}`;
}

export const MVT_SOURCE_ID = 'geojsonLayer';
export const KBN_TOO_MANY_FEATURES_PROPERTY = '__kbn_too_many_features__';

export const LAYER_TYPE = {
TILE: 'TILE',
VECTOR: 'VECTOR',
TILED_VECTOR: 'TILED_VECTOR',
VECTOR_TILE: 'VECTOR_TILE',
HEATMAP: 'HEATMAP',
};
Expand All @@ -49,11 +56,14 @@ export const SORT_ORDER = {
DESC: 'desc',
};

// sources
export const EMS_TMS = 'EMS_TMS';
export const EMS_FILE = 'EMS_FILE';
export const ES_GEO_GRID = 'ES_GEO_GRID';
export const ES_SEARCH = 'ES_SEARCH';
export const ES_PEW_PEW = 'ES_PEW_PEW';
export const ES_MVT_SEARCH = 'ES_MVT_SEARCH';
export const ES_MVT_GEO_GRID = 'ES_MVT_GEO_GRID';

export const FIELD_ORIGIN = {
SOURCE: 'source',
Expand Down Expand Up @@ -158,3 +168,5 @@ export const SYMBOLIZE_AS_TYPES = {
};

export const DEFAULT_ICON = 'airfield';

export const DEFAULT_COUNTABLE_SCALE = 2048;
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
import React from 'react';
import { EuiFormRow, EuiSwitch } from '@elastic/eui';

export function GlobalFilterCheckbox({ applyGlobalQuery, label, setApplyGlobalQuery }) {
export function GlobalFilterCheckbox({ applyGlobalQuery, label, setApplyGlobalQuery, enableSwitch}) {
const onApplyGlobalQueryChange = event => {
setApplyGlobalQuery(event.target.checked);
};

return (
<EuiFormRow display="columnCompressedSwitch">
<EuiSwitch
disabled={!enableSwitch}
label={label}
checked={applyGlobalQuery}
onChange={onApplyGlobalQueryChange}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,14 @@ export class FilterEditor extends Component {

{filterByBoundsSwitch}


<GlobalFilterCheckbox
label={i18n.translate('xpack.maps.filterEditor.applyGlobalQueryCheckboxLabel', {
defaultMessage: `Apply global filter to layer data`,
})}
applyGlobalQuery={this.props.layer.getSource().getApplyGlobalQuery()}
setApplyGlobalQuery={this._onApplyGlobalQueryChange}
enableSwitch={this.props.layer.getSource().isQueryAwareTogglable()}
/>
</Fragment>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ export class FeatureProperties extends React.Component {
this._fetchProperties({
nextFeatureId: this.props.featureId,
nextLayerId: this.props.layerId,
meta: this.props.meta
});
};

_fetchProperties = async ({ nextLayerId, nextFeatureId }) => {
_fetchProperties = async ({ nextLayerId, nextFeatureId, meta }) => {
if (this.prevLayerId === nextLayerId && this.prevFeatureId === nextFeatureId) {
// do not reload same feature properties
return;
Expand All @@ -64,6 +65,7 @@ export class FeatureProperties extends React.Component {
properties = await this.props.loadFeatureProperties({
layerId: nextLayerId,
featureId: nextFeatureId,
meta: meta,
});
} catch (error) {
if (this._isMounted) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export class FeaturesTooltip extends React.Component {
return this.props.loadPreIndexedShape({
layerId: this.state.currentFeature.layerId,
featureId: this.state.currentFeature.id,
meta: this.state.currentFeature.meta
});
};

Expand All @@ -104,6 +105,7 @@ export class FeaturesTooltip extends React.Component {
const currentFeatureGeometry = this.props.loadFeatureGeometry({
layerId: this.state.currentFeature.layerId,
featureId: this.state.currentFeature.id,
meta: this.state.currentFeature.meta,
});
const geoFields = this._filterGeoFields(currentFeatureGeometry);

Expand Down Expand Up @@ -132,6 +134,7 @@ export class FeaturesTooltip extends React.Component {
<FeatureProperties
featureId={this.state.currentFeature.id}
layerId={this.state.currentFeature.layerId}
meta={this.state.currentFeature.meta}
loadFeatureProperties={this.props.loadFeatureProperties}
showFilterButtons={!!this.props.addFilters && this.props.isLocked}
onCloseTooltip={this.props.closeTooltip}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,14 @@ export class TooltipControl extends React.Component {
uniqueFeatures.push({
id: featureId,
layerId: layerId,
meta: {
docId: mbFeature.properties._id, //hacky for now
indexName: mbFeature.properties._index //hacky for now
}
});
}
}

return uniqueFeatures;
}

Expand Down Expand Up @@ -242,45 +247,32 @@ export class TooltipControl extends React.Component {

// Must load original geometry instead of using geometry from mapbox feature.
// Mapbox feature geometry is from vector tile and is not the same as the original geometry.
_loadFeatureGeometry = ({ layerId, featureId }) => {
_loadFeatureGeometry = ({ layerId, featureId, meta }) => {

const tooltipLayer = this._findLayerById(layerId);
if (!tooltipLayer) {
return null;
}

const targetFeature = tooltipLayer.getFeatureById(featureId);
if (!targetFeature) {
return null;
}

return targetFeature.geometry;
return tooltipLayer.getGeometryByFeatureId(featureId);
};

_loadFeatureProperties = async ({ layerId, featureId }) => {
_loadFeatureProperties = async ({ layerId, featureId, meta }) => {
const tooltipLayer = this._findLayerById(layerId);
if (!tooltipLayer) {
return [];
}

const targetFeature = tooltipLayer.getFeatureById(featureId);
if (!targetFeature) {
return [];
}
return await tooltipLayer.getPropertiesForTooltip(targetFeature.properties);

return await tooltipLayer.getFeaturePropertiesByFeatureId(featureId, meta);
};

_loadPreIndexedShape = async ({ layerId, featureId }) => {
_loadPreIndexedShape = async ({ layerId, featureId, meta}) => {
const tooltipLayer = this._findLayerById(layerId);
if (!tooltipLayer) {
return null;
}

const targetFeature = tooltipLayer.getFeatureById(featureId);
if (!targetFeature) {
return null;
}

return await tooltipLayer.getSource().getPreIndexedShape(targetFeature.properties);
return await tooltipLayer.loadPreIndexedShapeByFeatureId(featureId, meta);
};

_findLayerById = layerId => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,18 @@ export class MBMapContainer extends React.Component {
mbMap.addControl(new mapboxgl.NavigationControl({ showCompass: false }), 'top-left');
}

const hatchImageBase64 =
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKTWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVN3WJP3Fj7f92UPVkLY8LGXbIEAIiOsCMgQWaIQkgBhhBASQMWFiApWFBURnEhVxILVCkidiOKgKLhnQYqIWotVXDjuH9yntX167+3t+9f7vOec5/zOec8PgBESJpHmomoAOVKFPDrYH49PSMTJvYACFUjgBCAQ5svCZwXFAADwA3l4fnSwP/wBr28AAgBw1S4kEsfh/4O6UCZXACCRAOAiEucLAZBSAMguVMgUAMgYALBTs2QKAJQAAGx5fEIiAKoNAOz0ST4FANipk9wXANiiHKkIAI0BAJkoRyQCQLsAYFWBUiwCwMIAoKxAIi4EwK4BgFm2MkcCgL0FAHaOWJAPQGAAgJlCLMwAIDgCAEMeE80DIEwDoDDSv+CpX3CFuEgBAMDLlc2XS9IzFLiV0Bp38vDg4iHiwmyxQmEXKRBmCeQinJebIxNI5wNMzgwAABr50cH+OD+Q5+bk4eZm52zv9MWi/mvwbyI+IfHf/ryMAgQAEE7P79pf5eXWA3DHAbB1v2upWwDaVgBo3/ldM9sJoFoK0Hr5i3k4/EAenqFQyDwdHAoLC+0lYqG9MOOLPv8z4W/gi372/EAe/tt68ABxmkCZrcCjg/1xYW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xRiGa/F3Er0KTwzDaPUSvQpdDMdg8xK9CmsMwO8YgV6FNIZqdwvApWUDhmlWi0CtZQKGbVYKwKVlEYZlnBQgrBbPHnECpYSQGYXS+GhKkg9PffLobEqGA1Za3Zw2JIhArWU1aaPS6G+K+AQFln1rAY4r0CBmWVWdNiiO8KKJQ1Zo2LIZ4r4FBWmDUvhvitgETRN+tYDPFaAYuibda1GOKzAhpF16xzMcRjBTyKpln3Yoi/CogUPbOBxRBvFTApWmYlK6BSdMyKFohbAZeiYVa0QHoZTxR5s9+ruBWwKdJmmxdRK6BTZM12jzEr4FMkzf4D1UTxKQcwH9sAAAAASUVORK5CYII=';

const hatchImage = new Image();
hatchImage.onload = () => {
mbMap.addImage('__kbn_too_many_features__', hatchImage);
};
hatchImage.src = hatchImageBase64;



let emptyImage;
mbMap.on('styleimagemissing', e => {
if (emptyImage) {
Expand All @@ -155,6 +167,7 @@ export class MBMapContainer extends React.Component {
emptyImage.src =
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=';
emptyImage.crossOrigin = 'anonymous';

resolve(mbMap);
});
});
Expand Down
19 changes: 16 additions & 3 deletions x-pack/legacy/plugins/maps/public/layers/fields/es_agg_field.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { AbstractField } from './field';
import { COUNT_AGG_TYPE } from '../../../common/constants';
import { COUNT_AGG_TYPE, METRIC_TYPE } from '../../../common/constants';
import { isMetricCountable } from '../util/is_metric_countable';
import { ESAggMetricTooltipProperty } from '../tooltips/es_aggmetric_tooltip_property';

Expand Down Expand Up @@ -79,10 +79,23 @@ export class ESAggMetricField extends AbstractField {

supportsFieldMeta() {
// count and sum aggregations are not within field bounds so they do not support field meta.
return !isMetricCountable(this.getAggType());
// return !isMetricCountable(this.getAggType());
return ![METRIC_TYPE.SUM, METRIC_TYPE.UNIQUE_COUNT].includes(this.getAggType());
}

async getOrdinalFieldMetaRequest(config) {
return this._esDocField.getOrdinalFieldMetaRequest(config);
if (this._esDocField) {
return this._esDocField.getOrdinalFieldMetaRequest(config);
} else {
return {
type_count: {
value_count: {
script: {
source: '1',
},
},
},
};
}
}
}
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/maps/public/layers/layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class AbstractLayer {
}

supportsElasticsearchFilters() {
return this._source.isESSource();
return this._source.supportsESFilters();
}

async supportsFitToBounds() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,14 @@ import { KibanaTilemapSource } from './kibana_tilemap_source';
import { ESGeoGridSource } from './es_geo_grid_source';
import { ESSearchSource } from './es_search_source';
import { ESPewPewSource } from './es_pew_pew_source/es_pew_pew_source';
import { MVTVectorSource } from './mvt_vector_source/mvt_vector_source';
import { ESMVTSearchSource } from './es_mvt_search_source/es_mvt_search_source';
import {ESMVTGeoGridSource} from "./es_mvt_geo_grid_source/es_mvt_geo_grid_source";

export const ALL_SOURCES = [
// MVTVectorSource,
ESMVTSearchSource,
ESMVTGeoGridSource,
GeojsonFileSource,
ESSearchSource,
ESGeoGridSource,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ export class AbstractESAggSource extends AbstractESSource {
}

createMetricAggConfigs() {
return this.getMetricFields().map(esAggMetric => esAggMetric.makeMetricAggConfig());
const mf = this.getMetricFields().map(esAggMetric => esAggMetric.makeMetricAggConfig());

return mf;
}

async getNumberFields() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ import { npStart } from 'ui/new_platform';
const { IndexPatternSelect } = npStart.plugins.data.ui;

const requestTypeOptions = [
{
label: i18n.translate('xpack.maps.source.esGeoGrid.pointsDropdownOption', {
defaultMessage: 'clusters',
}),
value: RENDER_AS.POINT,
},
{
label: i18n.translate('xpack.maps.source.esGeoGrid.gridRectangleDropdownOption', {
defaultMessage: 'grid rectangles',
Expand All @@ -36,12 +42,6 @@ const requestTypeOptions = [
}),
value: RENDER_AS.HEATMAP,
},
{
label: i18n.translate('xpack.maps.source.esGeoGrid.pointsDropdownOption', {
defaultMessage: 'clusters',
}),
value: RENDER_AS.POINT,
},
];

export class CreateSourceEditor extends Component {
Expand Down Expand Up @@ -184,6 +184,8 @@ export class CreateSourceEditor extends Component {
return null;
}

const options = this.props.clustersOnly ? requestTypeOptions.slice(0, 1) : requestTypeOptions;

return (
<EuiFormRow
label={i18n.translate('xpack.maps.source.esGeoGrid.showAsLabel', {
Expand All @@ -195,7 +197,7 @@ export class CreateSourceEditor extends Component {
defaultMessage: 'Select a single option',
})}
singleSelection={{ asPlainText: true }}
options={requestTypeOptions}
options={options}
selectedOptions={[this.state.requestType]}
onChange={this._onRequestTypeSelect}
isClearable={false}
Expand Down
Loading