# HG changeset patch # User Sascha Wilde # Date 1583405739 -3600 # Node ID 43ada68487ca119d7e61c95d64ed25c5f259706d # Parent 136dc9e528c41a1e77abafd2fad948257f45a485# Parent 9d57c5765474a1dc48cc04a6680b1092514055cd Merged diff -r 136dc9e528c4 -r 43ada68487ca client/src/store/map.js --- 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 */ +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 }) {