• Stars
    star
    132
  • Rank 274,205 (Top 6 %)
  • Language Vue
  • License
    MIT License
  • Created over 7 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

markercluster plugin extension for vue2-leaflet package

vue2-leaflet-markercluster

This is a markercluster plugin extension for vue2-leaflet package

Install

npm install --save vue2-leaflet-markercluster

Demo

git clone [email protected]:jperelli/vue2-leaflet-markercluster.git
cd vue2-leaflet-markercluster
yarn
yarn example

# or alternatively using npm
npm install
npm run example

Then you should be able to navigate with your browser and see the demo in http://localhost:4000/

You can see the demo code in the file example.vue

Usage

on <template> add

something like this

<v-map :zoom=10 :center="initialLocation">
  <v-icondefault :image-path="'/statics/leafletImages/'"></v-icondefault>
  <v-tilelayer url="http://{s}.tile.osm.org/{z}/{x}/{y}.png"></v-tilelayer>
  <v-marker-cluster>
    <v-marker v-for="c in cases" v-if="c.location !== null" :lat-lng="c.latlng">
      <v-popup :content="c.tooltipContent"></v-popup>
    </v-marker>
  </v-marker-cluster>
</v-map>

if you want to set some options, use

<v-marker-cluster :options="{foo: 'bar'}">
    .....
</v-marker-cluster>

See Leaflet doc : https://github.com/Leaflet/Leaflet.markercluster#all-options for all available options

on <script> add

option 1

In the same template file, at <script> part, this will make the component available only to the template in this file

import Vue2LeafletMarkerCluster from 'vue2-leaflet-markercluster'
...
export default {
  ...
  components: {
    'v-marker-cluster': Vue2LeafletMarkerCluster
    ...
  },
  ...
}

option 2

At main Vue configuration, this will make the component available to all templates in your app

import Vue from 'vue'
import Vue2LeafletMarkerCluster from 'vue2-leaflet-markercluster'
...
Vue.component('v-marker-cluster', Vue2LeafletMarkerCluster)

on <style> add

@import "~leaflet.markercluster/dist/MarkerCluster.css";
@import "~leaflet.markercluster/dist/MarkerCluster.Default.css";

Access markercluster layer directly

If you need to access other markecluster methods, like refreshClusters(), you can do it with a ref on the markercluster vue element and using the mapObject property

...
<v-marker-cluster ref="clusterRef">
  ...
</v-marker-cluster>
...

...
this.$refs.clusterRef.mapObject.refreshClusters()
...

Develop and build

npm install
npm run build

Author

Julián Perelli

Contributors

License

MIT

More Repositories

1

osm-static-maps

Openstreetmap static maps is a nodejs lib, CLI and server open source inspired on google static map service
JavaScript
147
star
2

Redmine-Periodic-Task

A redmine plugin that lets you schedule an issue to fire every x days/weeks/months
Ruby
64
star
3

vue2-leaflet-googlemutant

GoogleMutant plugin extension for vue2-leaflet package
Vue
21
star
4

vue2-leaflet-polylinedecorator

polylinedecorator plugin extension for vue2-leaflet package
Vue
5
star
5

eucovidcert

EU digital covid certificate QR decoder
TypeScript
4
star
6

Constitucion_Argentina

Constitución de la Nación Argentina
3
star
7

run279

TypeScript
3
star
8

vercel-python-gis

Vercel runtime with geos, gdal and proj for geodjango
Python
2
star
9

redmine_print_style_black

A super-simple plugin to change the css style to print in B&W printers
Ruby
2
star
10

redmine_contacter

Redmine plugin to add multiple contacts to an issue. A contact has name, direction and telephones. You manage the contacts in one place, and use them in any project.
SQL
2
star
11

multiplechoiceshuffler

TypeScript
2
star
12

proteccionista-app

proteccionista.org frontend web y mobile
Vue
1
star
13

exponent-react-native-workshop-2

Workshop: Intro to React Native with Exponent - Project 2
JavaScript
1
star
14

cuantosabortos.org

Contador de numeros de abortos en argentina
Vue
1
star
15

Qplanif

Simulador de planificacion de la CPU
C++
1
star
16

cordova-plugin-register-filetype

Register a filetype to be opened with your app when tapping on a file
JavaScript
1
star
17

dolar-notify

mostrar desktop notification cuando el precio del dolar cambia en el banco nacion argentino
JavaScript
1
star
18

jperelli.github.io

Personal website
CSS
1
star
19

cualbondi-issues

1
star
20

notion-jira-link-chrome-extension

Chrome extension that makes jira links in Notion appear as in confluence
JavaScript
1
star
21

proteccionista.org

proteccionista.org API server
JavaScript
1
star