-
Notifications
You must be signed in to change notification settings - Fork 382
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
#8578 SEARCH_WITH_FILTER action: add popup support #8673
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ import toBbox from 'turf-bbox'; | |
import pointOnSurface from '@turf/point-on-surface'; | ||
import assign from 'object-assign'; | ||
import {isNil, sortBy} from 'lodash'; | ||
import uuid from 'uuid'; | ||
|
||
import {centerToMarkerSelector, getLayerFromName, queryableLayersSelector} from '../selectors/layers'; | ||
|
||
|
@@ -44,14 +45,16 @@ import { | |
ZOOM_ADD_POINT | ||
} from '../actions/search'; | ||
|
||
import CoordinatesUtils from '../utils/CoordinatesUtils'; | ||
import CoordinatesUtils, { reproject } from '../utils/CoordinatesUtils'; | ||
import {defaultIconStyle, layerIsVisibleForGFI, showGFIForService} from '../utils/SearchUtils'; | ||
import {generateTemplateString} from '../utils/TemplateUtils'; | ||
|
||
import {API} from '../api/searchText'; | ||
import {getFeatureSimple} from '../api/WFS'; | ||
import {getDefaultInfoFormatValueFromLayer} from '../utils/MapInfoUtils'; | ||
import {identifyOptionsSelector} from '../selectors/mapInfo'; | ||
import {identifyOptionsSelector, isMapPopup} from '../selectors/mapInfo'; | ||
import { addPopup } from '../actions/mapPopups'; | ||
import { IDENTIFY_POPUP } from '../components/map/popups'; | ||
|
||
const getInfoFormat = (layerObj, state) => getDefaultInfoFormatValueFromLayer(layerObj, {...identifyOptionsSelector(state)}); | ||
|
||
|
@@ -321,9 +324,14 @@ export const searchOnStartEpic = (action$, store) => | |
.switchMap(({ type, geometry, typeName }) => { | ||
let coord = pointOnSurface({ type, geometry }).geometry.coordinates; | ||
const latlng = {lng: coord[0], lat: coord[1] }; | ||
const {x, y} = reproject(coord, 'EPSG:4326', 'EPSG:3857'); | ||
|
||
if (coord) { // trigger get feature info | ||
return Rx.Observable.of(featureInfoClick({latlng}, typeName, [typeName], {[typeName]: {cql_filter: cqlFilter}}), showMapinfoMarker()); | ||
return Rx.Observable.of(featureInfoClick({latlng}, typeName, [typeName], {[typeName]: {cql_filter: cqlFilter}}), showMapinfoMarker()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a marker on the map after closing the popup and this is due to the showMapinfoMarker() action. marker-popup-bug.mp4There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also think it's better to hide the marker when we use popup display option. |
||
.merge(Rx.Observable.of(addPopup(uuid(), | ||
{component: IDENTIFY_POPUP, maxWidth: 600, position: {coordinates: [x, y]}})) | ||
.filter(() => isMapPopup(store.getState())) | ||
); | ||
} | ||
return Rx.Observable.empty(); | ||
}).catch(() => { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the current map could have a different projection from EPSG:3857 so please use
projectionSelector
from the map selectors to get the correct one