{"id":23463724,"url":"https://github.com/ptv-logistics/leaflet-xserver","last_synced_at":"2025-06-14T01:35:44.189Z","repository":{"id":17069498,"uuid":"80657110","full_name":"ptv-logistics/leaflet-xserver","owner":"ptv-logistics","description":"Leaflet classes for extended PTV xServer functionalities","archived":false,"fork":false,"pushed_at":"2024-06-11T21:25:13.000Z","size":326,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-06-05T04:42:27.466Z","etag":null,"topics":["javascript","leaflet","leaflet-plugin","ptv-xserver"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ptv-logistics.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-02-01T19:47:39.000Z","updated_at":"2024-08-07T09:10:07.000Z","dependencies_parsed_at":"2025-04-12T12:08:48.049Z","dependency_job_id":null,"html_url":"https://github.com/ptv-logistics/leaflet-xserver","commit_stats":{"total_commits":75,"total_committers":5,"mean_commits":15.0,"dds":0.3866666666666667,"last_synced_commit":"c27db65fc1f15d9e6ba96709b0ef0151108411c5"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ptv-logistics/leaflet-xserver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ptv-logistics%2Fleaflet-xserver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ptv-logistics%2Fleaflet-xserver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ptv-logistics%2Fleaflet-xserver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ptv-logistics%2Fleaflet-xserver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ptv-logistics","download_url":"https://codeload.github.com/ptv-logistics/leaflet-xserver/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ptv-logistics%2Fleaflet-xserver/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259745511,"owners_count":22905110,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","leaflet","leaflet-plugin","ptv-xserver"],"created_at":"2024-12-24T09:15:34.571Z","updated_at":"2025-06-14T01:35:44.163Z","avatar_url":"https://github.com/ptv-logistics.png","language":"JavaScript","readme":"[![NPM version](https://img.shields.io/npm/v/leaflet-xserver.svg)](https://www.npmjs.com/package/leaflet-xserver)\n![XServer 2.x!](https://img.shields.io/badge/XServer-2.x-blue.svg?style=flat)\n![Leaflet compatible!](https://img.shields.io/badge/Leaflet-1.x-blue.svg?style=flat)\n\n## Purpose\n\nleaflet-xserver provides classes to add xMapServer specific features to Leaflet.\n\n## Components\n\n* [Auto Attribution](#autoattribution)\n* [L.TileLayer.XServer](#tilelayerxserver)\n\n## How to build\n\n```npm install``` \n\nor use the latest build at https://unpkg.com/leaflet-xserver/dist/\n\n\u003ca name=\"autoattribution\"\u003e\u003c/a\u003e\n### Auto Attribution \n\nIf included to the script, `leaflet-xserver.js` automatically sets the correct attribution text for every\nlayer that uses the xMapServer-2 `rest` or `rs` api.\n\n\u003ca name=\"tilelayerxserver\"\u003e\u003c/a\u003e\n### L.TileLayer.XServer\n\nThe Layer class `L.TileLayer.XServer` can be used to make xServer elements clickable or request tiles with specific parameters.\n\n#### Additional options\n\n* *disableMouseEvents* - disables all mouse click and hover events. Default: ```false```\n\n#### As single map\n[Demo](https://ptv-logistics.github.io/xserverjs/boilerplate/Leaflet-Clickable.1.0.html)\n\nThe easiest way to add a clickable layer is to use class `L.TileLayer.XServer`, append a clickable xServer-Layer (e.g. `PTV_TruckAttributes`) to the profile and set the `\u0026contentType=JSON` parameter. The icons of the layer can now be clicked to display the object information. The options are the same as for `L.TileLayer`\n\n```javascript\nvar map = L.map('map').setView(new L.LatLng(49.01405, 8.4044), 14);\n\nvar interactiveTileLayer = L.tileLayer.xserver(\n    'https://s0{s}-xserver2-europe-test.cloud.ptvgroup.com/services/rest/XMap/tile/{z}/{x}/{y}' +\n    '?storedProfile={profile}\u0026layers=background,transport,labels,PTV_TruckAttributes\u0026contentType=JSON\u0026xtok={token}',\n    {\n        profile: 'silkysand',\n        token: window.token,\n        subdomains: '1234',\n        maxZoom: 22,\n        pane: 'tilePane'\n    }).addTo(map);\n```\n\n#### As layered map\n[Demo](https://ptv-logistics.github.io/xserverjs/boilerplate/Leaflet-Clickable-Layered.1.0.html)\n\nIt's also possible to split the xMapServer map into separate Leaflet layers. This sample creates a standard xMapServer basemap-layer and a clickable truck attributes overlay. A client-side layer `L.Circle`can then be added between the two xMapServer layers by assigning them to different panes (`tilePane`, `overlayPane` and  `shadowPane`).\n\n```javascript\nvar coordinate = L.latLng(49.01405, 8.4044); // KA\nvar radius = 500; // m\n\nvar map = L.map('map').setView(coordinate, 14);\n\nvar basemapLayer = L.tileLayer(\n    'https://s0{s}-xserver2-europe-test.cloud.ptvgroup.com/services/rest/XMap/tile/{z}/{x}/{y}' +\n    '?storedProfile={profile}\u0026layers={layers}\u0026xtok={token}', {\n        profile: 'silkysand',\n        layers: 'background,transport',\n        token: window.token,\n        subdomains: '1234',\n        maxZoom: 22,\n        pane: 'tilePane'\n    }).addTo(map);\n\nvar circle = L.circle(coordinate, radius, {\n    color: 'red',\n    fillColor: 'orange',\n    fillOpacity: 0.5,\n    pane: 'overlayPane',\n    attribution: 'My Circle'\n}).addTo(map).bindPopup(\"I am a circle.\");\n\nvar truckAttributesLayer = L.tileLayer.xserver(\n    'https://s0{s}-xserver2-europe-test.cloud.ptvgroup.com/services/rest/XMap/tile/{z}/{x}/{y}' +\n    '?storedProfile={profile}\u0026layers={layers}\u0026contentType=JSON\u0026xtok={token}', {\n        profile: 'silkysand',\n        layers: 'labels,PTV_TruckAttributes',\n        token: window.token,\n        subdomains: '1234',\n        maxZoom: 22,\n        pane: 'clickableTiles'\n    }).addTo(map);\n```\n\n#### Using the JSON API\n[Demo](https://ptv-logistics.github.io/xserverjs/boilerplate/Leaflet-Clickable.1.0-rs.html)\n\nIf you need more than the standard `rest` parameters, `L.TileLayer.XServer` can be initialized with a `requestExtension` property. This property then contains parameters which are sent using the JSON api.\n\n```javascript\nvar map = L.map('map').setView(new L.LatLng(49.01405, 8.4044), 14);\n\nvar interactiveTileLayer = L.tileLayer.xserver(\n    'https://s0{s}-xserver2-europe-test.cloud.ptvgroup.com/services/rs/XMap/renderMap',\n    {\n        requestExtension: {\n            \"storedProfile\": \"gravelpit\",\n            \"requestProfile\": {\n                \"featureLayerProfile\": {\n                    \"themes\": [{\n                        \"enabled\": true,\n                        \"id\": \"PTV_TruckAttributes\"\n                    }]\n                }\n            },\n            \"resultFields\": {\n                \"featureThemeIds\": [\"PTV_TruckAttributes\"]\n                }\n        },\n        username: 'xtok',\n        password: window.token,\n        subdomains: '1234',\n        maxZoom: 22,\n        pane: 'tilePane'\n    }).addTo(map);\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fptv-logistics%2Fleaflet-xserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fptv-logistics%2Fleaflet-xserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fptv-logistics%2Fleaflet-xserver/lists"}