|
5 | 5 | rel="stylesheet"
|
6 | 6 | href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700,400italic|Material+Icons"
|
7 | 7 | />
|
| 8 | + |
8 | 9 | <!-- spinner geoJSON services loading -->
|
9 | 10 | <div
|
10 | 11 | v-show="dataLoadingStatus"
|
|
41 | 42 | <div v-if="!dataLoadingStatus">
|
42 | 43 | <!-- block for map info -->
|
43 | 44 | <div class="map-info">
|
44 |
| - <!-- table with attributes --> |
45 | 45 | <transition-group name="fade">
|
| 46 | + <!-- table with attributes of selected Soil PygeoAPI Docker features --> |
46 | 47 | <div
|
47 | 48 | v-if="
|
48 | 49 | this.geoJSONdata.length > 0 && this.geoJSONserviceLayerComputed
|
|
77 | 78 | >Zoom to selected features</md-tooltip
|
78 | 79 | >
|
79 | 80 | </md-button>
|
80 |
| - |
81 | 81 | <md-button
|
82 | 82 | v-on:click="resetGeoJSONdata()"
|
83 | 83 | class="md-dense md-raised md-accent"
|
|
170 | 170 | </md-badge>
|
171 | 171 | </div>
|
172 | 172 | <vl-map
|
| 173 | + ref="map" |
173 | 174 | :data-projection="projComputed"
|
174 | 175 | :load-tiles-while-animating="true"
|
175 | 176 | :load-tiles-while-interacting="true"
|
176 |
| - @click="spatialQueryOnClick($event.coordinate)" |
| 177 | + @click="spatialQueryOnClick($event)" |
177 | 178 | >
|
178 | 179 | <vl-view
|
179 | 180 | :zoom.sync="zoomComputed"
|
|
233 | 234 | v-if="layer.type === 'vectortile'"
|
234 | 235 | >
|
235 | 236 | <vl-source-vector-tile :url="layer.source"></vl-source-vector-tile>
|
236 |
| - <vl-style-box> |
237 |
| - <vl-style-stroke |
238 |
| - :color="layer.style.strokeColor" |
239 |
| - :width="layer.style.strokeWidth" |
240 |
| - ></vl-style-stroke> |
241 |
| - <vl-style-fill :color="layer.style.fillColor"></vl-style-fill> |
242 |
| - </vl-style-box> </vl-layer-vector-tile |
| 237 | + <vl-style-func |
| 238 | + v-if="layer.id === 'EstoniaSoilMap'" |
| 239 | + :factory="EstSoilMapVectorTilesStyle" /></vl-layer-vector-tile |
243 | 240 | ></template>
|
244 | 241 |
|
245 | 242 | <!-- wmts layer -->
|
|
301 | 298 | const axios = require("axios");
|
302 | 299 | import { register } from "ol/proj/proj4";
|
303 | 300 | import proj4 from "proj4";
|
| 301 | +// import Style from "ol/style/Style"; |
| 302 | +import { createStyle } from "vuelayers/lib/ol-ext"; |
304 | 303 |
|
305 | 304 | // new CRS registration
|
306 | 305 | proj4.defs(
|
@@ -344,6 +343,7 @@ export default {
|
344 | 343 | // geoJSON service source error
|
345 | 344 | geoJSONdataSourceError: false,
|
346 | 345 | geoJSONdataSourceErrorText: "",
|
| 346 | + vectorTilesTransparency: 0.7, |
347 | 347 | };
|
348 | 348 | },
|
349 | 349 | computed: {
|
@@ -393,16 +393,28 @@ export default {
|
393 | 393 | return false;
|
394 | 394 | }
|
395 | 395 | },
|
| 396 | + EstSoilMapVectorTileComputed: function () { |
| 397 | + let list = this.selectedLayersProp; |
| 398 | + let vectorTileLayer = list.filter(function (el) { |
| 399 | + return el.id === "EstoniaSoilMap"; |
| 400 | + }); |
| 401 | + if (vectorTileLayer.length > 0) { |
| 402 | + return true; |
| 403 | + } else { |
| 404 | + return false; |
| 405 | + } |
| 406 | + }, |
396 | 407 | },
|
397 | 408 | methods: {
|
398 | 409 | // bbox query to EST soil map
|
399 |
| - spatialQueryOnClick(cursorCoordinates) { |
| 410 | + spatialQueryOnClick(event) { |
| 411 | + // select from Soil PygeoAPI Docker |
400 | 412 | if (this.geoJSONserviceLayerComputed) {
|
401 | 413 | this.geoJSONdata = [];
|
402 | 414 | this.dataLoadingStatus = true;
|
403 |
| - this.dataCursorCoordinates = cursorCoordinates; |
404 |
| - let x = cursorCoordinates[0]; |
405 |
| - let y = cursorCoordinates[1]; |
| 415 | + this.dataCursorCoordinates = event.coordinate; |
| 416 | + let x = event.coordinate[0]; |
| 417 | + let y = event.coordinate[1]; |
406 | 418 | let bbox = x + "," + y + "," + x + "," + y;
|
407 | 419 | setTimeout(() => {
|
408 | 420 | axios
|
@@ -430,14 +442,129 @@ export default {
|
430 | 442 | }, 1000);
|
431 | 443 | }
|
432 | 444 | },
|
| 445 | + // vector tiles: Estonia soil map styling |
| 446 | + EstSoilMapVectorTilesStyle() { |
| 447 | + let transparency = this.vectorTilesTransparency; |
| 448 | + // unknown |
| 449 | + const styleUnknown = createStyle({ |
| 450 | + fillColor: "rgba(255,255,255," + transparency + ")", |
| 451 | + strokeColor: "rgba(255,255,255," + transparency + ")", |
| 452 | + }); |
| 453 | + // S |
| 454 | + const styleS = createStyle({ |
| 455 | + fillColor: "rgba(196,4,17," + transparency + ")", |
| 456 | + strokeColor: "rgba(196,4,17," + transparency + ")", |
| 457 | + }); |
| 458 | + // LS |
| 459 | + const styleLS = createStyle({ |
| 460 | + fillColor: "rgba(244,134,0," + transparency + ")", |
| 461 | + strokeColor: "rgba(244,134,0," + transparency + ")", |
| 462 | + }); |
| 463 | + // SL |
| 464 | + const styleSL = createStyle({ |
| 465 | + fillColor: "rgba(243,187,64," + transparency + ")", |
| 466 | + strokeColor: "rgba(243,187,64," + transparency + ")", |
| 467 | + }); |
| 468 | + // L |
| 469 | + const styleL = createStyle({ |
| 470 | + fillColor: "rgba(255,247,78," + transparency + ")", |
| 471 | + strokeColor: "rgba(255,247,78," + transparency + ")", |
| 472 | + }); |
| 473 | + // SiL |
| 474 | + const styleSiL = createStyle({ |
| 475 | + fillColor: "rgba(81,214,177," + transparency + ")", |
| 476 | + strokeColor: "rgba(81,214,177," + transparency + ")", |
| 477 | + }); |
| 478 | + // SiCL |
| 479 | + const styleSiCL = createStyle({ |
| 480 | + fillColor: "rgba(48,175,210," + transparency + ")", |
| 481 | + strokeColor: "rgba(48,175,210," + transparency + ")", |
| 482 | + }); |
| 483 | + // CL |
| 484 | + const styleCL = createStyle({ |
| 485 | + fillColor: "rgba(43,155,162," + transparency + ")", |
| 486 | + strokeColor: "rgba(43,155,162," + transparency + ")", |
| 487 | + }); |
| 488 | + // C |
| 489 | + const styleC = createStyle({ |
| 490 | + fillColor: "rgba(59,123,233," + transparency + ")", |
| 491 | + strokeColor: "rgba(59,123,233," + transparency + ")", |
| 492 | + }); |
| 493 | + // HC |
| 494 | + const styleHC = createStyle({ |
| 495 | + fillColor: "rgba(43,87,186," + transparency + ")", |
| 496 | + strokeColor: "rgba(43,87,186," + transparency + ")", |
| 497 | + }); |
| 498 | + // PEAT |
| 499 | + const stylePEAT = createStyle({ |
| 500 | + fillColor: "rgba(112,71,1," + transparency + ")", |
| 501 | + strokeColor: "rgba(112,71,1," + transparency + ")", |
| 502 | + }); |
| 503 | + // GRAVELS |
| 504 | + const styleGRAVELS = createStyle({ |
| 505 | + fillColor: "rgba(140,164,173," + transparency + ")", |
| 506 | + strokeColor: "rgba(140,164,173," + transparency + ")", |
| 507 | + }); |
| 508 | +
|
| 509 | + return (feature) => { |
| 510 | + // S |
| 511 | + if (feature.get("lxtype1") == "S") { |
| 512 | + return styleS; |
| 513 | + } |
| 514 | + // LS |
| 515 | + if (feature.get("lxtype1") == "LS") { |
| 516 | + return styleLS; |
| 517 | + } |
| 518 | + // SL |
| 519 | + if (feature.get("lxtype1") == "SL") { |
| 520 | + return styleSL; |
| 521 | + } |
| 522 | + // L |
| 523 | + if (feature.get("lxtype1") == "L") { |
| 524 | + return styleL; |
| 525 | + } |
| 526 | + // SiL |
| 527 | + if (feature.get("lxtype1") == "SiL") { |
| 528 | + return styleSiL; |
| 529 | + } |
| 530 | + // SiCL |
| 531 | + if (feature.get("lxtype1") == "SiCL") { |
| 532 | + return styleSiCL; |
| 533 | + } |
| 534 | + // CL |
| 535 | + if (feature.get("lxtype1") == "CL") { |
| 536 | + return styleCL; |
| 537 | + } |
| 538 | + // C |
| 539 | + if (feature.get("lxtype1") == "C") { |
| 540 | + return styleC; |
| 541 | + } |
| 542 | + // HC |
| 543 | + if (feature.get("lxtype1") == "HC") { |
| 544 | + return styleHC; |
| 545 | + } |
| 546 | + // PEAT |
| 547 | + if (feature.get("lxtype1") == "PEAT") { |
| 548 | + return stylePEAT; |
| 549 | + } |
| 550 | + // GRAVELS |
| 551 | + if (feature.get("lxtype1") == "GRAVELS") { |
| 552 | + return styleGRAVELS; |
| 553 | + } |
| 554 | + return styleUnknown; |
| 555 | + }; |
| 556 | + }, |
| 557 | +
|
433 | 558 | resetGeoJSONdata() {
|
434 | 559 | this.geoJSONdata = [];
|
435 | 560 | this.clickOnMapDetection = false;
|
436 | 561 | },
|
| 562 | +
|
437 | 563 | fitSelectedJSONfeatures() {
|
438 | 564 | let geoJsonServicesSourceExtent = this.$refs.geoJsonServicesSource.$source.getExtent();
|
439 | 565 | this.$refs.view.fit(geoJsonServicesSourceExtent);
|
440 | 566 | },
|
| 567 | +
|
441 | 568 | fitViewDefault() {
|
442 | 569 | this.$refs.view.fit([
|
443 | 570 | 2335304.088168705,
|
|
0 commit comments