Leaflet plugin to render GeoJSON data over tile layer
npm install leaflet-tilelayer-geojson var style = {
"clickable": true,
"color": "#00D",
"fillColor": "#00D",
"weight": 1.0,
"opacity": 0.3,
"fillOpacity": 0.2
};
var hoverStyle = {
"fillOpacity": 0.5
};
var geojsonURL = 'http://tile.example.com/{z}/{x}/{y}.json';
var geojsonTileLayer = new L.TileLayer.GeoJSON(geojsonURL, {
clipTiles: true,
unique: function (feature) {
return feature.id;
}
}, {
style: style,
onEachFeature: function (feature, layer) {
if (feature.properties) {
var popupString = '
'http://{s}.somedomain.com/blabla/{z}/{x}/{y}.json'
clipTiles (boolean) (default = false): If true, clips tile feature geometries to their tile boundaries using SVG clipping.unique (function): If set, the feature's are grouped into GeometryCollection GeoJSON objects. Each group is defined by the key returned by this function, with the feature object as the first argument.