1.1.1 • Published 10 months ago

leaflet-infowms v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Leaflet.InfoWMS

You can create a URL with "GetFeatureInfo" WMS request data about a map image coordinate and get it from the click event

Requirement

Leaflet Versión

Test on leaflet 1.7.1

Demo

Demo

Installing

npm install leaflet-infowms

or using Yarn

yarn add leaflet-infowms

Getting started

import { Map } from 'leaflet';
import 'leaflet/dist/leaflet.css';
import { TileLayer } from 'leaflet-infowms';

const map = new Map('mapa');
const baseLayerUrl = 'https://tile.openstreetmap.org/{z}/{x}/{y}.png';
const baseLayer = new TileLayer(baseLayerUrl, {
    attribution:
        ' <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
});

const wmsLayerUrl = 'https://public-mapservice.lf.goteborg.se/geoserver/LF_Externwebb/wms?'
const wmsLayer = new TileLayer.InfoWMS(wmsLayerUrl, {
        layers: 'Utrustning',
        format: 'image/png',
        transparent: true,
        attribution: 'Public Geoserver LF Goteborg City',
        feature_count: 1
    }
);

wmsLayer.on('click', function (e) {
    console.log(e);
    fetch(e.url)
        .then((response) => response.json() )
        .then((response) => {
            console.log(response);
        });
});

API reference

TODO

1.1.1

10 months ago

1.1.0

11 months ago

1.0.15

11 months ago

1.0.14

11 months ago

1.0.13

11 months ago

1.0.12

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago