├── .eslintrc
├── .github
├── dependabot.yml
└── workflows
│ └── main.yml
├── .gitignore
├── LICENSE
├── README.md
├── index.html
├── package-lock.json
├── package.json
├── rollup.config.js
├── src
└── NonTiledLayer.ts
├── token.js
└── tsconfig.json
/.eslintrc:
--------------------------------------------------------------------------------
1 | {
2 | "root": true,
3 | "ignorePatterns": ["dist"],
4 | "parser": "@typescript-eslint/parser",
5 | "parserOptions": {
6 | "project": "./tsconfig.json"
7 | },
8 | "plugins": [
9 | "@typescript-eslint"
10 | ],
11 | "extends": [
12 | "airbnb-base",
13 | "airbnb-typescript/base"
14 | ],
15 | "rules": {
16 | "no-param-reassign": "off",
17 | "no-restricted-syntax": "off",
18 | "no-underscore-dangle": "off"
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | - package-ecosystem: npm
4 | directory: "/"
5 | open-pull-requests-limit: 999
6 | rebase-strategy: disabled
7 | schedule:
8 | interval: weekly
9 |
--------------------------------------------------------------------------------
/.github/workflows/main.yml:
--------------------------------------------------------------------------------
1 | name: CI
2 | on:
3 | push:
4 | branches: [master]
5 | pull_request:
6 | branches: [master]
7 | jobs:
8 | setup:
9 | runs-on: ubuntu-latest
10 | steps:
11 | - name: Check out repository
12 | uses: actions/checkout@v2
13 |
14 | - name: Set up Node
15 | uses: actions/setup-node@v2
16 | with:
17 | node-version: 17
18 | check-latest: true
19 | cache: npm
20 |
21 | - name: Cache Node modules
22 | id: cache-node-modules
23 | uses: actions/cache@v2
24 | with:
25 | path: node_modules
26 | key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
27 |
28 | - name: Install dependencies
29 | if: steps.cache-node-modules.outputs.cache-hit != 'true'
30 | run: npm ci
31 |
32 | - name: Cache setup
33 | uses: actions/cache@v2
34 | with:
35 | path: ./*
36 | key: ${{ github.sha }}
37 |
38 | run:
39 | needs: setup
40 | runs-on: ubuntu-latest
41 | strategy:
42 | matrix:
43 | command: [lint, build]
44 | steps:
45 | - name: Restore setup
46 | uses: actions/cache@v2
47 | with:
48 | path: ./*
49 | key: ${{ github.sha }}
50 |
51 | - name: Set up Node
52 | uses: actions/setup-node@v2
53 | with:
54 | node-version: 17
55 |
56 | - name: Run ${{ matrix.command }} task
57 | run: npm run ${{ matrix.command }}
58 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | dist/
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2016-17, PTV Group
2 |
3 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
4 |
5 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Leaflet.NonTiledLayer
2 |
3 | [](https://github.com/ptv-logistics/Leaflet.NonTiledLayer/actions/workflows/ci.yml)
4 | [](https://www.npmjs.com/package/leaflet.nontiledlayer)
5 | 
6 |
7 | ## Purpose
8 |
9 | While Leaflet handles the de-facto standard for stitching a map from tiles very well,
10 | there is no concept for imagery data that cannot be queried in tiles.
11 |
12 | Not all imagery providers can handle tiles properly, for example if they render labels dynamically.
13 | So we've added a Leaflet.NonTiledLayer, which gets the imagery for the complete map viewport whenever it changes.
14 | Leaflet.NonTiledLayer.WMS is the implementation that makes WMS requests, similar to the TileLayer.WMS.
15 |
16 | You can see a demo here:
17 |
18 | https://ptv-logistics.github.io/Leaflet.NonTiledLayer/index.html
19 |
20 | It uses the WMS service of [PTV xServer internet](https://www.ptvgroup.com/en/solutions/products/ptv-xserver/), which requires a tiled/non-tiled hybrid approach (and that is the reason we've built this).
21 | The sample also displays some 3rd-party WMS overlays that also cannot be requested in tiles.
22 |
23 | The layer supports Leaflet 1.7.x.
24 |
25 | ## Installation
26 |
27 | Install using [`npm`](https://www.npmjs.com/package/leaflet.nontiledlayer):
28 |
29 | ```bash
30 | npm install leaflet.nontiledlayer
31 | ```
32 |
33 | Or [`yarn`](https://yarnpkg.com/en/package/leaflet.nontiledlayer):
34 |
35 | ```bash
36 | yarn add leaflet.nontiledlayer
37 | ```
38 |
39 | Or use the latest build at https://unpkg.com/leaflet.nontiledlayer/dist/
40 |
41 | ## The supported options
42 |
43 | * *attribution* - the attribution text for the layer data. Default: ```''```
44 | * *opacity* - the opacity value between 0.0 and 1.0. Default: ```1.0```
45 | * *minZoom* - the minimum zoom level for which the overlay is requested. Default: ```0```
46 | * *maxZoom* - the maximum zoom level for which the overlay is requested. Default: ```18```
47 | * *bounds* - the geographic bounds of the layer. Default: ```L.latLngBounds([-85.05, -180], [85.05, 180])```
48 | * *zIndex* - z-index of the overlay. Default: ```undefined```
49 | * *pane* - the name of the pane where the child div is inserted. Default: ```'overlayPane'```
50 | * *pointerEvents* - the pointer-events style for the overlay. Default: ```null```
51 | * *errorImageUrl* - the url of the image displayed when the layer fails to load (invalid request or server error). Default: 1px transparent gif ```data:image/gif;base64,R0lGODlhAQABAHAAACH5BAUAAAAALAAAAAABAAEAAAICRAEAOw==```
52 | * *useCanvas* - use the canvas to render the images, fixes flickering issues with Firefox, doesn't work on IE8. Setting it to ```undefined``` will use canvas, if available. Default: ```undefined```
53 | * *detectRetina* - doubles the actual image size requested, if the Browser is in retina mode. Default: ```false```
54 | * *crossOrigin* - enables cross origin capabilities. Valid values are 'anonymous' and 'use-credentials'. Default: ```undefined```
55 |
56 | The pane and zIndex properties allow to fine-tune the layer ordering. For example, it is possible to insert a NonTiledLayer between two layers of the tilePane, like the labels [here](https://sharpmapwidgets.azurewebsites.net/), or on top of the vector shapes, like the labels [here](https://ptv-logistics.github.io/fl-labs/) or [here](https://api-eu-test.cloud.ptvgroup.com/samplebrowser/#samples/data-rendering-geoJson/view).
57 |
58 | You can build your own NonTiledLayer by inheriting from NonTiledLayer and implementing either the function getImageUrl or getImageUrlAsync. The getImageUrl just returns an uri and is used by the WMS implementation. The getImageUrlAsync can be used for services that not only return images, but also additional context information for interaction. The project [here](https://ptv-logistics.github.io/Leaflet.PtvLayer/) uses this method.
59 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |