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

feature: infowindow for search #1920

Merged
merged 1 commit into from
Feb 13, 2024
Merged
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
7 changes: 3 additions & 4 deletions src/controls/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import Point from 'ol/geom/Point';
import Awesomplete from 'awesomplete';
import { Component, Element as El, Button, Collapse, CollapseHeader, dom } from '../ui';
import generateUUID from '../utils/generateuuid';
import getAttributes from '../getattributes';
import getCenter from '../geometry/getcenter';
import getFeature from '../getfeature';
import mapUtils from '../maputils';
Expand Down Expand Up @@ -134,7 +133,8 @@ const Search = function Search(options = {}) {
let featureWkt;
let coordWkt;
if (res.length > 0) {
showFeatureInfo(res, layer.get('title'), getAttributes(res[0], layer, map));
const featLayerName = layer.get('name');
featureInfo.showFeatureInfo({ feature: res, layerName: featLayerName }, { maxZoomLevel });
} else if (geometryAttribute) {
// Fallback if no geometry in response
featureWkt = mapUtils.wktToFeature(data[geometryAttribute], projectionCode);
Expand All @@ -144,8 +144,7 @@ const Search = function Search(options = {}) {
});
} else if (geometryAttribute && layerName) {
feature = mapUtils.wktToFeature(data[geometryAttribute], projectionCode);
layer = viewer.getLayer(data[layerName]);
showFeatureInfo([feature], layer.get('title'), getAttributes(feature, layer, map));
featureInfo.showFeatureInfo({ feature: [feature], layerName }, { maxZoomLevel });
} else if (titleAttribute && contentAttribute && geometryAttribute) {
feature = mapUtils.wktToFeature(data[geometryAttribute], projectionCode);

Expand Down
Loading