Git Product home page Git Product logo

vuelayers's Introduction


Web map Vue components with the power of OpenLayers

Build Status Coverage Status GitHub tag NPM version License Downloads Dependencies

Overview

VueLayers is components library that brings the powerful OpenLayers API to the Vue.js reactive world. It can display maps with tiled, raster or vector layers loaded from different sources.

Versions

VueLayers Branch Vue OpenLayers NPM tag
Current 0.12 master ^2.3 ^6.0 latest
Previous 0.11 v0.11.x ^2.3 ^5.0 0.11.x
Previous 0.10 v0.10.x ^2.0 ^4.0 0.10.x

Links

Requirements

Install

# install Vue
npm install vue

# install current VueLayers version 
npm install vuelayers

# install next VueLayers version
npm install vuelayers@next

Build Setup

NOTE: Node v10+ is required.

git clone --recursive -j8 https://github.com/ghettovoice/vuelayers.git
cd vuelayers

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm start

# build for production
npm run build

# run unit tests
npm run test:unit

# run e2e tests
npm run test:e2e

# run all tests
npm test

License

MIT (c) 2017-2022, Vladimir Vershinin
Based on Vue and OpenLayers

vuelayers's People

Contributors

agmt5989 avatar ardaa avatar baspeeters avatar become-iron avatar categulario avatar chrudosvorlicek avatar ghettovoice avatar janlazo avatar jemasfox avatar jsdelivrbot avatar kodami avatar likeke1997 avatar lol2x avatar lorev avatar pdelaby avatar qiuzuhui avatar remidesgrange avatar silvester-pari avatar skymaze avatar tmszi avatar vruzhentsov avatar yamashita-arcuss avatar yyuri avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vuelayers's Issues

How to set color and style of a geom-point?

            <vl-feature v-if="geoloc.position" id="geoloc-feature">
              <vl-geom-point class="hello" :coordinates="geoloc.position"></vl-geom-point>
              <vl-style-box>
                <vl-style-stroke :color="colour" :width="3"></vl-style-stroke>
                <vl-style-fill :color="colour"></vl-style-fill>
              </vl-style-box>
            </vl-feature>

colour is a string #ff0000
What am i doing wrong? The icon has disapeared from my map when i apply the stylebox.
Looks good following the documentation and example..

Vuelayers do not work in Internet Explorer.

Vuelayers do not work in Internet Explorer.

My version IE 11.

I created simple page HTML for testing.
index.html

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script src="https://unpkg.com/vue"></script>
<script src="https://unpkg.com/openlayers"></script>
<link rel="stylesheet" href="https://unpkg.com/vuelayers/lib/style.css">
<script src="https://unpkg.com/vuelayers"></script>

<main id="app">
  <vl-map :load-tiles-while-animating="true" :load-tiles-while-interacting="true">
    <vl-view :zoom="2" :center="[0, 0]" :rotation="0"></vl-view>

    <vl-geoloc>
      <template scope="ctx">
        <vl-feature v-if="ctx.position" id="geoloc-feature">
          <vl-geom-point :coordinates="ctx.position"></vl-geom-point>
        </vl-feature>
      </template>
    </vl-geoloc>

    <vl-layer-tile id="osm">
      <vl-source-osm></vl-source-osm>
    </vl-layer-tile>
  </vl-map>
</main>

<script>
Vue.use(VueLayers)
new Vue({
  el: "#app",
  data: {
  }
})
</script>

</body>
</html>

in browser IE 11 get errors:

[Vue warn]: Injection "$services" not found

found in

---> <VlMap>
       <Root>

[Vue warn]: Error in created hook: "Error: no Promise impl found"

found in

---> <VlMap>
       <Root>
Error: no Promise impl found
   {
      [functions]: ,
      __proto__: { },
      description: "no Promise impl found",
      message: "no Promise impl found",
      name: "Error",
      stack: "Error: no Promise impl found
   at Observable.prototype.toPromise (https://unpkg.com/vuelayers:2265:13)
   at created (https://unpkg.com/vuelayers:18666:5)
   at callHook (https://unpkg.com/vue:2895:9)
   at Vue.prototype._init (https://unpkg.com/vue:4547:5)
   at VueComponent (https://unpkg.com/vue:4715:7)
   at createComponentInstanceForVnode (https://unpkg.com/vue:4236:3)
   at init (https://unpkg.com/vue:4053:7)
   at createComponent (https://unpkg.com/vue:5499:9)
   at createElm (https://unpkg.com/vue:5447:5)
   at createChildren (https://unpkg.com/vue:5573:9)",
      Symbol(identityMap)_i.2duz5kehxv0: undefined,
      Symbol(options)_j.2duz5kehxv0: undefined,
      Symbol(services)_h.2duz5kehxv0: undefined
   }

Npm import

Would be great ability to import individual components from npm. For example,
import buttonControl from 'ol3-ext/control/buttoncontrol'

thanks.

Use of font awesome in vl-style-text

Hi,

I'd like to use and font awesome to style point feature as it usually works fine in a classical javascript method.

My code is like that:

But, on the map, it just displays the text \uf041 instead of the icon. On other part of my application fontAwesome is correctly loaded.

I've searched for the correct syntaxt without founding anything.

If someone has got an idea, I'd be grateful

Franรงois

Updating features

Thank you for library! Awesome job.

My situation:
I have a cluster of points with real-time updates(via EventSource). Points have different styling depends on properties.
How I can update existing features' properties and refresh them?

webpack build issue

I import a single Map Component๏ผŒbut when I build a project, the bundle.js is as large as by using whole components in vuelayers .
these two is all the same:
import { Map } from 'vuelayers'
import VueLayers from 'vuelayers'.

am I doing something wrong?

import Map from 'vuelayers/lib/map'
import TileLayer from 'vuelayers/lib/tile-layer'
import XyzSource from 'vuelayers/lib/xyz-source'
import Overlay from 'vuelayers/lib/overlay'
this works the same way

How to turn off map events

Hi @ghettovoice,
Thanks for the great library.

Is there a way to make the subscription to open layers map events optional? I'm asking because there are so many events fired from the map that the Vue Devtools chrome extension crashes when set to record events. I realise this is really an issue with Vue Devtools but I'm just wondering if you have any thoughts on this? So many events also makes it difficult to debug other events in an app.

Cheers

Performance issues with vl-source-cluster

Hi, first of all, I'd like to say that I'm new to OpenLayers and VueLayers and it therefore might be a problem in my understanding of how to use the framework. I'm testing whether to change from Leaflet.js to OpenLayers (with vuelayers) for an already existing application. I used Leaflet with Vue2leaflet and the marker-cluster plugin for Vue2leaflet in my application and I'm now trying to replace this with OpenLayers.

I'm trying to simply add a list of points to the map, where each point is designated by marker. I also then would like to be able to interact with the markers (clicking and hovering).
As a first step I simply implemented putting the list of points on the map and adding a vl-source-cluster following the example on the demo site, with some modifications.

The code I have so far is roughly:

<template>
  <vl-map :load-tiles-while-animating="true" 
    :load-tiles-while-interacting="true"
    :controls="false">
    <vl-view :center.sync="center" :zoom.sync="zoom" :rotation.sync="rotation"></vl-view>
    <vl-layer-tile>
        <!--<vl-source-osm></vl-source-osm>-->
        <vl-source-xyz :url="mapUrl"></vl-source-xyz>
    </vl-layer-tile>
    <vl-layer-vector>
      <vl-source-cluster :distance="200">
        <vl-source-vector>
          <vl-feature v-for="client in clientList" 
                      :key="client.customer_id">
              <vl-geom-point :coordinates="invert(client.position)"></vl-geom-point>
              <vl-style-box>
                <vl-style-icon src='../statics/icons/ort.png' :scale="0.5" />
              </vl-style-box>
          </vl-feature>
        </vl-source-vector>
        <vl-style-func :factory="clusterStyleFunc" />
      </vl-source-cluster>
    </vl-layer-vector>
  </vl-map>
</template>

here clientList is an array of about 700 objects. The problem is that it takes the map a really long time to generate the clusters (in comparison with leaflet) and it becomes very slow to interact with, even after it is generated.

Is this a good approach for what I'm trying to do? Or is it better to create the features array programatically and then pass it to the cluster? And if so, can I still make use of the reactivity of vue.js?

I've read here about the super cluster library which might be relevant. Is this something already in VueLayers? Do you think it will be difficult to combine with Vuelayers?

I would really appreciate any help you can give!
Thanks, Omri

Error geometryReader is not a function

I use library with nwjs, and make this component:

<template>
  <div class="vue-root">
    <div id="map">
      <vl-map :load-tiles-while-animating="true" :load-tiles-while-interacting="true">
        <vl-view :zoom="10" :center="center" :rotation="0"></vl-view>

        <vl-layer-tile id="osm">
          <vl-source-osm :url="map_source"></vl-source-osm>
        </vl-layer-tile>

        <vl-overlay class="feature-popup" v-for="feature in features" :key="feature.id" :id="feature.id" :position="pointOnSurface(feature.geometry)"
          :auto-pan="true">
          <component :is="feature.geometry.template" :coordinates="feature.geometry.coordinates"></component>
        </vl-overlay>

        <component v-for="layer in layers" :is="layer.template" v-if="layer.visible" :key="layer.id" v-bind="layer">

          <component :is="layer.source.template" v-bind="layer.source">
            <vl-feature v-for="feature in layer.source.features" :key="feature.id" :id="feature.id" :properties="feature.properties">
              <component :is="feature.geometry.template" :coordinates="feature.geometry.coordinates"></component>
            </vl-feature>

            <component v-if="layer.source.source" :is="layer.source.source.template" v-bind="layer.source.source">
              <vl-feature v-for="feature in layer.source.source.features" :key="feature.id" :id="feature.id" :properties="feature.properties">
                <component :is="feature.geometry.template" :coordinates="feature.geometry.coordinates" @click="alert(feature)"></component>
              </vl-feature>
            </component>
          </component>

          <component v-for="(style, i) in layer.style" :key="i" :is="style.template" v-bind="style">
            <component v-for="(s, template) in style.styles" :key="template" :is="template" v-bind="s">
              <vl-style-fill v-if="s.fill" v-bind="s.fill"></vl-style-fill>
              <vl-style-stroke v-if="s.stroke" v-bind="s.stroke"></vl-style-stroke>
            </component>
          </component>

        </component>

      </vl-map>
    </div>
  </div>
</template>

<script>
  import {
    core as vlCore
  } from 'vuelayers'

  export default {
    data() {
      return {
        center: [20.5502871, 54.732708099999996],
        map_source: "https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png", //"./map/images/{x}/{y}/{z}.png"
        map: undefined,
        features: [{
          type: 'Feature',
          id: 'random-1',
          geometry: {
            type: 'Point',
            coordinates: [20.5502871, 54.732708099999996],
          },
        }, {
          type: 'Feature 2',
          id: 'random-2',
          geometry: {
            type: 'Point',
            coordinates: [20.4502871, 54.632708099999996],
          },
        }],
        layers: [{
          id: 'cluster',
          title: 'Cluster',
          template: 'vl-layer-vector',
          visible: true,
          source: {
            template: 'vl-source-cluster',
            distance: 11,
            source: {
              template: 'vl-source-vector',
              features: [{
                template: 'Feature',
                id: 'random-1',
                geometry: {
                  template: 'vl-geom-point',
                  coordinates: [20.4502871, 54.632708099999996],
                }
              },{
                template: 'Feature',
                id: 'random-2',
                geometry: {
                  template: 'vl-geom-point',
                  coordinates: [20.3502871, 54.632708099999996],
                }
              }],
            },
          },
          style: [{
            template: 'vl-style-func',
            factory: this.clusterStyleFunc,
          }]
        }]
      }
    },
    mounted() {
      console.log('Component ยซClient Part Mapยป mounted.')
    },
    methods: {
      pointOnSurface: vlCore.geomHelper.pointOnSurface,
      clusterStyleFunc() {
        const cache = {}

        return function __clusterStyleFunc(feature) {
          const size = feature.get('features').length
          console.log('feature', feature)
          let style = cache[size]

          if (!style) {
            style = vlCore.styleHelper.style({
              imageRadius: 10,
              strokeColor: '#fff',
              fillColor: '#3399cc',
              text: size.toString(),
              textFillColor: '#fff',
              zIndex: 100,
            })
            cache[size] = style
          }
          console.log(style)
          return [style]
        }
      },
    }
  }
</script>

<style lang="scss" scoped>
  #map {
    min-height: 600px;
    height: calc(100vh - 40px - 150px - 15px);
    border-radius: 25px;
  }
</style>

developer tools - chrome-extension___ejfmbhmmphbiidaibgdkcejbidlfaidb_index html 2017-11-02 15 15 07

I try to comment some components, and error makes in vl-source-vector component.
What i do wrong? Where function exepted?

Documentation like a:
d6d

Don't work with electron-vue.

Uncaught (in promise) TypeError: this.$view.getProjection is not a function at VueComponent.createTileGrid (C:\Users\smart\Desktop\my-little-gis\node_modules\vuelayers\lib\core\index.js:4207) at VueComponent.boundFn [as createTileGrid] (vue.esm.js?efeb:191) at VueComponent.init (C:\Users\smart\Desktop\my-little-gis\node_modules\vuelayers\lib\core\index.js:4234) at boundFn (vue.esm.js?efeb:190) at <anonymous>
C:\Users\smart\Desktop\my-little-gis\node_modules\openlayers\dist\ol.js:47 Uncaught (in promise) TypeError: a.addEventListener is not a function
C:\Users\smart\Desktop\my-little-gis\node_modules\openlayers\dist\ol.js:114 Uncaught TypeError: a.xa is not a function

https://github.com/SmArtem/my-little-gis

weird erro

Uncaught TypeError: WEBPACK_IMPORTED_MODULE_0_ol_source_osm.a.ATTRIBUTION.getHTML is not a function

i dont know why i am getting this. i just follow the installation in npm but after this error prompts

Core package

Split core package to smaller subpackages:

  • each mixin as package
  • ol-ext package
  • rx-ext package
  • util package

ol components

Wrap other OpenLayers classes Layers, Sources, Controls, interactions, Styles, Geolocation & etc

Layers

  • ol.layer.Tile
  • ol.layer.Vector
  • ol.layer.VectorTile
  • ol.layer.Image
  • ol.layer.Heatmap

Sources

  • ol.source.OSM
  • ol.source.XYZ
  • ol.source.TileWMS
  • ol.source.Vector
  • ol.source.VectorTile
  • ol.source.Image*
    ...

Documentation

Do you need any help with documentation on this project? I love the structure of it, and would like to help any way possible.

How use View fit method?

Sorry if this is an obvious question, I am new to VUE. How do you call component methods - namely vl-view's "fit" method? It's not obvious to me how to hook into this - is it exposed to the view?

Global data projection doesn't work for maps

Docs here: https://github.com/ghettovoice/vuelayers/blob/master/docs/quickstart.md#global-data-projection
say that this should set data projection:

Vue.use(VueLayers, {
  dataProjection: 'EPSG:4326'
})

However, this doesn't work for this use:

vl-map(ref="map" :load-tiles-while-animating="true" :load-tiles-while-interacting="true", :controls="{attribution: false, zoom: true}")
    vl-view(v-if="xy.length > 0" :zoom="15" :center="[long,lat]" :rotation="0")

But this does work:

vl-map(data-projection="EPSG:4326" ref="map" :load-tiles-while-animating="true" :load-tiles-while-interacting="true", :controls="{attribution: false, zoom: true}")
    vl-view(v-if="xy.length > 0" :zoom="15" :center="xy" :rotation="0")

Global data projection vs view projection option

If I am working with EPSG:4326 data, what is the benefit of using the global dataProjection or map data-projection binding over setting the projection option of the View to EPSG:4326? Thank you.

v-vector url request response

Hi,

First of all, thank you for work. It's great and quite a life-saver. This helped me a lot in a recent project.

My issue is more of a question.
When i use with an url to query my WFS server, i receive, as intended, a json response with geometries i want to display.
But i don't know how to access them. For sure it's not displaying itself.
Should i provide a var in props for v-vector to store the answer ?

I don't know how to do it and there is no real hint in your code, neither in open-layers documentation.

Thanks in advance to shed some light on this question.

Rendering issue with mapbox vector layers

Hi @ghettovoice,

I'm seeing some interesting results rendering mapbox vector layers. The edges are a little blurry and there are gaps in the tiles (faint white lines).

Without vuelayers:
screen shot 2018-05-04 at 17 06 52

With vuelayers:
screen shot 2018-05-04 at 17 07 49

Do you know what might be causing this?

No Tiles

I'm attempting to build VueLayers with Webpack for my web application, and I'm not seeing any tiles, yet no errors.

WEBPACK:
require('openlayers'); window.Vue = require('vue'); import Map from 'vuelayers/lib/index.umd.js'; import 'vuelayers/lib/style.css' Vue.use(Map)

Vue Instance:
var v = new Vue({ el: '#test', data: { name: 'vld-demo-app', center: [-12459082.126126748, 3959846.702973134], zoom: 2, rotation: 0, clickCoordinate: undefined, }, methods: {} });

HTML:
<div id="test"> <vl-map :load-tiles-while-animating="true" :load-tiles-while-interacting="true"> <vl-view :center="[0, 0]" :zoom="3" :rotation="0" /> <vl-layer-tile> <vl-source-osm /> </vl-layer-tile> </vl-map> </div>

Any ideas?

Build in Electron

I failed to run a simple map in an electron-vue project.

I built a simple project from
vue init simulatedgreg/electron-vue mydemo

add imports:

import VueLayers from 'vuelayers'
import 'vuelayers/lib/style.css'
Vue.use(VueLayers)

then replace LandingPage.vue with

<template>
  <main id="app">
    <vl-map :load-tiles-while-animating="true" :load-tiles-while-interacting="true">
      <vl-view ref="view" :zoom="2" :center="[0, 0]" :rotation="0"></vl-view>

      <vl-geoloc @update:position="onUpdatePosition">
        <template slot-scope="ctx">
          <vl-feature v-if="ctx.position" id="geoloc-feature">
            <vl-geom-point :coordinates="ctx.position"></vl-geom-point>
          </vl-feature>
        </template>
      </vl-geoloc>

      <vl-layer-tile id="osm">
        <vl-source-osm></vl-source-osm>
      </vl-layer-tile>
    </vl-map>
  </main>
</template>

<script>
import { core as vlCore } from 'vuelayers'

export default {
  name: 'app',
  data () {
    return {
      zoomedToPosition: false,
      msg: 'Welcome to Your Vue.js App'
    }
  },
  methods: {
    onUpdatePosition (coordinate) {
      if (!this.zoomedToPosition) {
        this.zoomedToPosition = true
        this.$refs.view.animate({
          center: vlCore.projHelper.fromLonLat(coordinate, this.$refs.view.projection),
          zoom: 12,
          duration: 1000
        })
      }
    }
  }
}
</script>

It failed with a such stacktrace

/Users/ludoo/dev/vuejs/vuelayers/vuelayers-electron/node_modules/openlayers/dist/ol.js:114 Uncaught TypeError: a.xa is not a function
    at Wf (/Users/ludoo/dev/vuejs/vuelayers/vuelayers-electron/node_modules/openlayers/dist/ol.js:114)
    at X.k.Wp (/Users/ludoo/dev/vuejs/vuelayers/vuelayers-electron/node_modules/openlayers/dist/ol.js:134)
    at X.<anonymous> (/Users/ludoo/dev/vuejs/vuelayers/vuelayers-electron/node_modules/openlayers/dist/ol.js:120)

Uncaught (in promise) TypeError: a.addEventListener is not a function
    at z (/Users/ludoo/dev/vuejs/vuelayers/vuelayers-electron/node_modules/openlayers/dist/ol.js:47)
    at X.k.gm (/Users/ludoo/dev/vuejs/vuelayers/vuelayers-electron/node_modules/openlayers/dist/ol.js:132)
    at X.b (/Users/ludoo/dev/vuejs/vuelayers/vuelayers-electron/node_modules/openlayers/dist/ol.js:46)
    at X.Tc.b (/Users/ludoo/dev/vuejs/vuelayers/vuelayers-electron/node_modules/openlayers/dist/ol.js:49)
    at Zc (/Users/ludoo/dev/vuejs/vuelayers/vuelayers-electron/node_modules/openlayers/dist/ol.js:51)
    at X.k.set (/Users/ludoo/dev/vuejs/vuelayers/vuelayers-electron/node_modules/openlayers/dist/ol.js:51)
    at X.k.hh (/Users/ludoo/dev/vuejs/vuelayers/vuelayers-electron/node_modules/openlayers/dist/ol.js:136)
    at VueComponent.setView (/Users/ludoo/dev/vuejs/vuelayers/vuelayers-electron/node_modules/vuelayers/lib/map/index.js:336)
    at VueComponent.boundFn [as setView] (vue.esm.js?efeb:188)
    at VueComponent.mount (/Users/ludoo/dev/vuejs/vuelayers/vuelayers-electron/node_modules/vuelayers/lib/map/index.js:755)
/Users/ludoo/dev/vuejs/vuelayers/vuelayers-electron/node_modules/vuelayers/lib/core/index.js:3376 

Uncaught (in promise) TypeError: layer.get is not a function
    at VueComponent.addLayer (/Users/ludoo/dev/vuejs/vuelayers/vuelayers-electron/node_modules/vuelayers/lib/core/index.js:3376)
    at VueComponent.boundFn [as addLayer] (vue.esm.js?efeb:188)
    at VueComponent.mount (/Users/ludoo/dev/vuejs/vuelayers/vuelayers-electron/node_modules/vuelayers/lib/core/index.js:3234)
    at boundFn (vue.esm.js?efeb:188)
    at <anonymous>
addLayer @ /Users/ludoo/dev/vuejs/vuelayers/vuelayers-electron/node_modules/vuelayers/lib/core/index.js:3376
boundFn @ vue.esm.js?efeb:188
mount @ /Users/ludoo/dev/vuejs/vuelayers/vuelayers-electron/node_modules/vuelayers/lib/core/index.js:3234
boundFn @ vue.esm.js?efeb:188
/Users/ludoo/dev/vuejs/vuelayers/vuelayers-electron/node_modules/vuelayers/lib/core/index.js:3922 

Uncaught (in promise) TypeError: this.$view.getProjection is not a function
    at VueComponent.createTileGrid (/Users/ludoo/dev/vuejs/vuelayers/vuelayers-electron/node_modules/vuelayers/lib/core/index.js:3922)
    at VueComponent.boundFn [as createTileGrid] (vue.esm.js?efeb:189)
    at VueComponent.init (/Users/ludoo/dev/vuejs/vuelayers/vuelayers-electron/node_modules/vuelayers/lib/core/index.js:3938)
    at boundFn (vue.esm.js?efeb:188)
    at <anonymous>

The same code in a simple web page is ok. So Electron could introduce some different behaviors...
Any help to understand the root cause would be great !

thanks !

Style function

Re-implement wrapper of ol.StyleFunction as component, because it is more clearly gives to understand what type of styling layer uses.

Click event on map, layer and feature

  • Emit click event in map component.
  • Emit click on layer component.
  • Emit click on feautre component
  • Add forEachFeatureAtPixel, forEachFeatureAtCoordinate, forEachLayerAtPixel helper methods to map component, should return feautre in GeoJSOn format.

vl-view center prop problem

I'm using vl-view component like this:

vl-map(data-projection="EPSG:4326" ref="map" :load-tiles-while-animating="true" :load-tiles-while-interacting="true", :controls="{attribution: false, zoom: false}")
    vl-view(v-if="xycenter.length > 0" :zoom="mapZoom" :center="xycenter" :rotation="0")

where xycenter is a computed property that contains [long, lat] in 4326 projection.

However it seems this computed property needs to be set several times before the vl-view displays the correct centered map. It looks like for at least the first time, the vl-view computed properties are not correct:

resolvedDataProjection:"EPSG:4326"
viewCenter:Array[2]
0:0.0013400196419961843
1:-0.0003176205455872605
viewCenterViewProj:Array[2]
0:149.1703042
1:-35.3573574
viewProjection:"EPSG:3857"
viewResolution:4.777314267823516
viewRotation:0
viewZoom:15

This is when the center prop is set to:

center:Array[2]
0:149.1703042
1:-35.3573574

After being setting the xycenter computed property once or twice more, then the vl-view computed properties are correct and the map is centered as expected:

resolvedDataProjection:"EPSG:4326"
viewCenter:Array[2]
0:149.1703039
1:-35.35735649999999
viewCenterViewProj:Array[2]
0:16605562.27162587
1:-4212551.134875238
viewProjection:"EPSG:3857"
viewResolution:4.777314267823516
viewRotation:0
viewZoom:15

The center prop is now set to:

center:Array[2]
0:149.1703039
1:-35.3573565

Ruby on Rails, gem webpacker, vuelayers problems, bugs.

Vuelayers not work correctly with gem webpacker in Ruby on Rails project.
I create simple project demonstration it.
https://github.com/nPaul/webpacker_vuelayers

page http://localhost:3000/map1
work fine in Google Chrome, but not working in Internet Explorer.

import Vue from 'vue'
import VueLayers from 'vuelayers'
import TpMap from '../map.vue'
import 'vuelayers/lib/style.css'
Vue.use(VueLayers)

import TurbolinksAdapter from 'vue-turbolinks';
document.addEventListener('turbolinks:load', () => {
   var element = document.getElementById("map1")
   if (element != null) {
       const app = new Vue({
           el: '#map1',
           render: h => h(TpMap)
       })
   }
})

page http://localhost:3000/map2
does not work on all browsers

import Vue from 'vue/dist/vue.esm'
import VueLayers from 'vuelayers'
import TpMap from '../map.vue'
import 'vuelayers/lib/style.css'
Vue.use(VueLayers)

import TurbolinksAdapter from 'vue-turbolinks';
document.addEventListener('turbolinks:load', () => {
    var element = document.getElementById("map2")
    if (element != null) {
        const app = new Vue({
            el: '#map2',
            components: { TpMap  },
            template: '<TpMap />'
        })
    }
})

please help me

URL token replacement

G'Day Vladimir,

Thanks for the quick fix on the demo app yesterday. Today I've been try to add a Mapbox layer to the demo app but for some reason I can't get the layers source properties to parse into the url that gets generated to request the tiles.

This is what I have added to the demo app:
0
and in the vue dev tools the properties come through to the browser:
1
but the urlTmpl doesn't seem to replace the tokens so the url request isn't correct:
2

If I manually replace the tokens in postman I do get the correct tile returned. Is this another quick fix?

Thanks,
Leon.

Uncaught (in promise) TypeError: e.map(...).debounceTime is not a function

I just installed vuelayers on Vue 2.4.2

I placed code from the example with a little modification (center and zoomLavel) as below.

<vl-map :load-tiles-while-animating="true" :load-tiles-while-interacting="true">
    <vl-view :center="[ 100.4833, 13.7500 ]" :zoom="5" :rotation="0" />

    <vl-layer-tile>
        <vl-source-osm />
    </vl-layer-tile>
</vl-map>

The map loaded and control is working but there is an exception thrown by Vuelayers.

Uncaught (in promise) TypeError: e.map(...).debounceTime is not a function
    at VueComponent.R (index.umd.min.js?9289:11)
    at VueComponent.subscribeAll (index.umd.min.js?9289:11)
    at VueComponent.boundFn [as subscribeAll] (vue.esm.js?efeb:180)
    at VueComponent.mount (index.umd.min.js?9289:11)
    at boundFn (vue.esm.js?efeb:179)
    at <anonymous>

Will this affect anything is the future such as Marker and Clustering?

Rendering problem in Vue ES Module

Not working if use Vue ES Module

example:

import Vue from 'vue/dist/vue.esm'
import VueLayers from 'vuelayers'
import 'vuelayers/lib/style.css'

Vue.use(VueLayers)
import TpMap from '../components/tp_map.vue'

const app = new Vue({
    el: element,
    template: '<TpMap/>',
    components: { TpMap }
})

I got in browser error like:

pluggablemap.js:1139 Uncaught TypeError: view.isDef is not a function
    at _ol_Map_._ol_PluggableMap_.renderFrame_ (pluggablemap.js:1139)
    at _ol_Map_.<anonymous> (pluggablemap.js:87)

But if use Vue runtime module work fine

import Vue from 'vue/dist/runtime.esm'
const app = new Vue({
    el: element,
    render: h => h(TpMap)
})

but css styles in component TpMap not working
maybe in runtime mode styles in components not compilng

How i may fix this problem?

How to style feature point?

    vl-feature(id="vehiclemarker" ref="vehiclemarker" :properties="{prop: 'value', prop2: 'value'}")
      vl-geom-point(:coordinates="xy")

This gives a standard small blue point as expected, but how to style it eg. red or an icon, or a popover?

Projection issue with map height

I'm not sure if I'm the only one with this error, but using this projection EPSG:4326 causes my map to render sort of squashed. If I remove that projection, the map looks fine, but the points are, of course, in another places. Any clue anyone?

Instructions to run demo

It would be great if we could get information to run easily a simple boilerplate (like vue-cli + webpack + vuelayers only).
the whole setup of webpack is not easy to understand; Thanks !

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.