This plugin can be used for creating maps using OpenLayers library.
yarn add bojko108/vue-ol-plugin
Add it to Vue:
import Vue from 'vue';
import OLPlugin from 'vue-ol-plugin';
Vue.use(OLPlugin);
Or if using Quasar Framework:
Add a new boot file:
quasar new boot openlayers
import OLPlugin from 'vue-ol-plugin';
export default async ({ Vue }) => {
Vue.use(OLPlugin);
};
In your quasar.conf.js
:
boot: [..., 'openlayers'],
export default {
name: "MyComponent"
created() {
// access to the plugin
this.$ol...
}
}
this.$ol.lib
- access to OpenLayers librarythis.$ol.app
- access to created applicationthis.$ol.map
- access to created map (same asthis.$ol.app.map
)this.$ol.config
- access to the initial config
<template>
<ol-map :configUrl="url_to_your_config" />
</template>
List of props, used for creating the mapp:
Name | Description | Required | Type | Default value |
---|---|---|---|---|
cssClasses |
Name of CSS classes to add to the mapp HTMLElement . Default CSS class map is not removed. |
false |
String |
map |
configUrl |
Url to the mapp config | false |
String |
undefined |
latitude |
Lattitude of mapp's center. If set, it will override config.map.map.view.latitude |
false |
Number |
undefined |
longitude |
Longitude of mapp's center. If set, it will override config.map.map.view.longitude |
false |
Number |
undefined |
zoom |
Zoom level for the mapp. If set, it will override config.map.map.view.zoomLevel |
false |
Number |
undefined |
basemap |
Sets the basemap for this mapp. This prop has two required properties: name and provider . If set it will override config.map.layers.basemaps |
false |
Object |
undefined |
List of events used to communicate with the parent element:
Name | Description | Arguments |
---|---|---|
@config-ready |
Emitted when the config is parsed, but before creating the mapp | config |
@app-ready |
Emitted when OpenLayers application is created. You can access the mapp from app.map , but this event is emitted before the mapp rendered for first time. |
app |
@map-rendered |
Emitted when the mapp is renderend for first time | map |
vue-ol-plugin is MIT License @ bojko108