Don't filter points of GeoJSON layer (#727)
This commit is contained in:
parent
b772924106
commit
43b1b70a0a
3 changed files with 10 additions and 6 deletions
|
|
@ -296,7 +296,7 @@ BR.routeLoader = function (map, layersControl, routing, pois) {
|
||||||
},
|
},
|
||||||
|
|
||||||
addTrackOverlay: function (geoJSON) {
|
addTrackOverlay: function (geoJSON) {
|
||||||
this._trackLayer = L.geoJSON(geoJSON, BR.Track.getGeoJsonOptions(layersControl)).addTo(map);
|
this._trackLayer = L.geoJSON(geoJSON, BR.Track.getGeoJsonOptions(layersControl, true)).addTo(map);
|
||||||
|
|
||||||
layersControl.addOverlay(this._trackLayer, BR.Util.sanitizeHTMLContent(this._layerName));
|
layersControl.addOverlay(this._trackLayer, BR.Util.sanitizeHTMLContent(this._layerName));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ BR.tracksLoader = function (map, layersControl, routing, pois) {
|
||||||
options: {
|
options: {
|
||||||
// `layer` allows to use a customized version of `L.geoJson` with the same signature
|
// `layer` allows to use a customized version of `L.geoJson` with the same signature
|
||||||
layer: createGeoJsonLayer,
|
layer: createGeoJsonLayer,
|
||||||
layerOptions: BR.Track.getGeoJsonOptions(layersControl),
|
layerOptions: BR.Track.getGeoJsonOptions(layersControl, true),
|
||||||
addToMap: false,
|
addToMap: false,
|
||||||
// File size limit in kb (default: 1024) ?
|
// File size limit in kb (default: 1024) ?
|
||||||
fileSizeLimit: BR.conf.trackSizeLimit || 1024 * 10,
|
fileSizeLimit: BR.conf.trackSizeLimit || 1024 * 10,
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,12 @@ BR.Track = {
|
||||||
/**
|
/**
|
||||||
* Returns common options for styling and appearance of tracks
|
* Returns common options for styling and appearance of tracks
|
||||||
*
|
*
|
||||||
* @param {BR.ControlLayers} layersControl Layers control instance
|
* @param {BR.ControlLayers} [layersControl] Layers control instance
|
||||||
|
* @param {boolean} [filterPois=false] exclude points not of type from/via/to, set true when also calling `addPoiMarkers`
|
||||||
*
|
*
|
||||||
* @returns {Object} to pass as `options` parameter to `L.geoJson`
|
* @returns {Object} to pass as `options` parameter to `L.geoJson`
|
||||||
*/
|
*/
|
||||||
getGeoJsonOptions: function (layersControl) {
|
getGeoJsonOptions: function (layersControl, filterPois = false) {
|
||||||
// https://github.com/mapbox/simplestyle-spec/tree/master/1.1.0
|
// https://github.com/mapbox/simplestyle-spec/tree/master/1.1.0
|
||||||
const styleMapping = [
|
const styleMapping = [
|
||||||
['stroke', 'color'],
|
['stroke', 'color'],
|
||||||
|
|
@ -34,8 +35,11 @@ BR.Track = {
|
||||||
},
|
},
|
||||||
interactive: false,
|
interactive: false,
|
||||||
filter: function (geoJsonFeature) {
|
filter: function (geoJsonFeature) {
|
||||||
// remove POIs, added separately
|
if (filterPois) {
|
||||||
return !BR.Track.isPoiPoint(geoJsonFeature);
|
// remove POIs, added separately, see `addPoiMarkers`
|
||||||
|
return !BR.Track.isPoiPoint(geoJsonFeature);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
},
|
},
|
||||||
pointToLayer: function (geoJsonPoint, latlng) {
|
pointToLayer: function (geoJsonPoint, latlng) {
|
||||||
// route waypoint (type=from/via/to)
|
// route waypoint (type=from/via/to)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue