allow to add custom overpass queries
This commit is contained in:
parent
275b0f75a5
commit
06f0be719d
4 changed files with 71 additions and 26 deletions
|
|
@ -172,6 +172,21 @@ BR.LayersConfig = L.Class.extend({
|
|||
return result;
|
||||
},
|
||||
|
||||
createOverpassLayer: function (query) {
|
||||
return new OverpassLayer({
|
||||
overpassFrontend: this.overpassFrontend,
|
||||
query: query,
|
||||
minZoom: undefined,
|
||||
feature: {
|
||||
title: '{{ tags.name }}',
|
||||
body:
|
||||
'<table class="overpass-tags">{% for k, v in tags %}{% if k[:5] != "addr:" %}<tr><th>{{ k }}</th><td>{% if k matches "/email/" %}<a href="mailto:{{ v }}">{{ v }}</a>{% elseif v matches "/^http/" %}<a href="{{ v }}">{{ v }}</a>{% elseif v matches "/^www/" %}<a href="http://{{ v }}">{{ v }}</a>{% else %}{{ v }}{% endif %}</td></tr>{% endif %}{% endfor %}</table>',
|
||||
markerSymbol:
|
||||
'<img anchorX="13" anchorY="42" width="25" height="42" signAnchorX="0" signAnchorY="-30" src="dist/images/marker-icon.png">',
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
createLayer: function (layerData) {
|
||||
var props = layerData.properties;
|
||||
var url = props.url;
|
||||
|
|
@ -255,18 +270,7 @@ BR.LayersConfig = L.Class.extend({
|
|||
layer.subdomains = props.subdomains;
|
||||
}
|
||||
} else if (props.dataSource === 'OverpassAPI') {
|
||||
layer = new OverpassLayer({
|
||||
overpassFrontend: this.overpassFrontend,
|
||||
query: props.query,
|
||||
minZoom: undefined,
|
||||
feature: {
|
||||
title: '{{ tags.name }}',
|
||||
body:
|
||||
'<table class="overpass-tags">{% for k, v in tags %}{% if k[:5] != "addr:" %}<tr><th>{{ k }}</th><td>{% if k matches "/email/" %}<a href="mailto:{{ v }}">{{ v }}</a>{% elseif v matches "/^http/" %}<a href="{{ v }}">{{ v }}</a>{% elseif v matches "/^www/" %}<a href="http://{{ v }}">{{ v }}</a>{% else %}{{ v }}{% endif %}</td></tr>{% endif %}{% endfor %}</table>',
|
||||
markerSymbol:
|
||||
'<img anchorX="13" anchorY="42" width="25" height="42" signAnchorX="0" signAnchorY="-30" src="dist/images/marker-icon.png">',
|
||||
},
|
||||
});
|
||||
layer = this.createOverpassLayer(props.query);
|
||||
} else {
|
||||
// JOSM
|
||||
var josmUrl = url;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue