Skip to content

Commit

Permalink
Refactoring layers set url
Browse files Browse the repository at this point in the history
  • Loading branch information
frodrigo committed May 13, 2024
1 parent b771c3c commit df9f26b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 27 deletions.
13 changes: 5 additions & 8 deletions web/src/pages/map/map.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import Vue from 'vue'
import ControlLayers from '../../../static/map/ControlLayers'
import { mapBases, mapOverlay, glStyle } from '../../../static/map/layers'
import OsmoseHeatmap from '../../../static/map/Osmose.Heatmap'
import OsmoseMarker from '../../../static/map/Osmose.Marker'
import '../../../static/map/ControlLayers.css'
Expand All @@ -39,11 +38,11 @@ export default Vue.extend({
data(): {
markerLayer: Object
heatmapLayer: Object
map: Map | null
} {
return {
markerLayer: null,
heatmapLayer: null,
map: null,
}
},
Expand All @@ -58,7 +57,7 @@ export default Vue.extend({
mounted(): void {
// Map
const map = new Map({
const map = this.map = new Map({
container: 'map',
center: [this.mapState.lon, this.mapState.lat],
zoom: this.mapState.zoom,
Expand Down Expand Up @@ -141,8 +140,6 @@ export default Vue.extend({
)
this.$emit('set-marker-layer', this.markerLayer)
this.heatmapLayer = new OsmoseHeatmap(map)
this.updateLayer()
})
Expand All @@ -165,8 +162,8 @@ export default Vue.extend({
.map(([k, v]) => encodeURIComponent(k) + '=' + encodeURIComponent(v))
.join('&')
this.markerLayer.setURLQuery(query)
this.heatmapLayer.setURLQuery(query)
this.map.getSource('markers').setTiles([API_URL + `/api/0.3/issues/{z}/{x}/{y}.mvt?${query}`])
this.map.getSource('heatmap').setTiles([API_URL + `/api/0.3/issues/{z}/{x}/{y}.heat.mvt?${query}`])
},
},
})
Expand Down
14 changes: 0 additions & 14 deletions web/static/map/Osmose.Heatmap.ts

This file was deleted.

5 changes: 0 additions & 5 deletions web/static/map/Osmose.Marker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,6 @@ export default class OsmoseMarker {
})
}

setURLQuery(query: string): void {
const newUrl = API_URL + `/api/0.3/issues/{z}/{x}/{y}.mvt?${query}`
this._map.getSource('markers').setTiles([newUrl])
}

_closePopup(): void {
this.highlight = undefined
this.setIssueUuid(null)
Expand Down

0 comments on commit df9f26b

Please sign in to comment.