@geosdi/ngx-leaflet-cursor-position-plugin
TypeScript icon, indicating that this package has built-in type declarations

1.1.2 • Public • Published

NgxLeafletCursorPositionPlugin

This library was generated with Angular CLI version 13.0.0.

General information

Service to wrap leaflet-mouse-position. See documentation https://github.com/danwild/Leaflet.MousePosition#readme

Installation

npm i @geosdi/ngx-leaflet-cursor-position --save

It depends on :

"@angular/common": ">=13.0.0",
"@angular/core": ">=13.0.0",
"leaflet": "1.7.1"
"leaflet-mouse-position": "^1.2.0"

Usage

import { Injectable } from '@angular/core'; 
import {NgxLeafletCursorPositionPluginService} from "./ngx-leaflet-cursor-position-plugin.service"; 

@Injectable({
 providedIn: 'root'
})
export class Service {

   constructor(private mapCursorPositionPluginService: NgxLeafletCursorPositionPluginService,) {
   }

  public addPlugin() {
   this.mapCursorPositionPluginService
     .withMap(this.map)
     .addMouseCursorPlugin();
   }

}

Methods

Method action
withMap(map: any): void map to add plugin
addMouseCursorPlugin() apply plugin
withPosition(position: "topleft" or "topright" or "bottomleft" or "bottomright"): ILeafletCursorPositionService The standard Leaflet.Control position parameter. Defaults to 'bottomleft'
withSeparator(separator: string): ILeafletCursorPositionService To separate longitude\latitude values. Defaults to ' : '
withEmptyString(emptryString: string): ILeafletCursorPositionService Initial text to display. Defaults to 'Unavailable'
withLngFirst(lngFirst: boolean): ILeafletCursorPositionService Weather to put the longitude first or not. Defaults to false
witFractionDigits(fractionDigits: number): ILeafletCursorPositionService Custom function to format the longitude value. Argument: numerical longitude and latitudine value. Return value: formatted string. Defaults to undefined.
witPrefix(prefix: string): ILeafletCursorPositionService A string to be prepended to the coordinates. Defaults to the empty string ‘’.

Package Sidebar

Install

npm i @geosdi/ngx-leaflet-cursor-position-plugin

Weekly Downloads

2

Version

1.1.2

License

MIT

Unpacked Size

28.7 kB

Total Files

9

Last publish

Collaborators

  • vito.salvia