Mercurial > gemma
changeset 4987:43ada68487ca
Merged
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Thu, 05 Mar 2020 11:55:39 +0100 |
parents | 136dc9e528c4 (current diff) 9d57c5765474 (diff) |
children | 61eb65394a13 |
files | |
diffstat | 1 files changed, 33 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/store/map.js Thu Mar 05 11:53:49 2020 +0100 +++ b/client/src/store/map.js Thu Mar 05 11:55:39 2020 +0100 @@ -14,18 +14,19 @@ * * Thomas Junk <thomas.junk@intevation.de> */ +import { Circle, Fill, Stroke, Style } from "ol/style"; +import { getArea, getLength } from "ol/sphere"; + import Draw from "ol/interaction/Draw"; -import { Stroke, Style, Fill, Circle } from "ol/style"; -import { fromLonLat } from "ol/proj"; -import { getLength, getArea } from "ol/sphere"; -import { transformExtent } from "ol/proj"; -import bbox from "@turf/bbox"; -import app from "@/main"; +import Feature from "ol/Feature"; import { HTTP } from "@/lib/http"; -import Feature from "ol/Feature"; import Point from "ol/geom/Point"; import { Vector as VectorLayer } from "ol/layer"; +import app from "@/main"; +import bbox from "@turf/bbox"; +import { fromLonLat } from "ol/proj"; import { toLonLat } from "ol/proj"; +import { transformExtent } from "ol/proj"; // initial state const init = () => { @@ -572,6 +573,31 @@ commit("addIdentifiedFeatures", features); }); } + + var fmSource = map.getLayer("FAIRWAYMARKS").getSource(); + var fmURL = fmSource.getGetFeatureInfoUrl( + event.coordinate, + currentResolution, + "EPSG:3857", + { INFO_FORMAT: "application/json" } + ); + if (fmSource) { + HTTP.get(fmURL, { + headers: { + "X-Gemma-Auth": localStorage.getItem("token") + } + }).then(response => { + let features = response.data.features.map(f => { + let feat = new Feature({ + geometry: new Point(f.geometry.coordinates) + }); + feat.setId(f.id); + feat.setProperties(f.properties); + return feat; + }); + commit("addIdentifiedFeatures", features); + }); + } }); }, refreshLayers({ state }) {