Allow layers to be rendered without datasources.
This commit is contained in:
parent
0e0bac0e5c
commit
be78202e0b
@ -20,9 +20,11 @@ tree.LayerXML = function(obj, styles) {
|
||||
styles.reverse().map(function(s) {
|
||||
return '<StyleName>' + s + '</StyleName>';
|
||||
}).join('\n ') +
|
||||
(dsoptions.length ?
|
||||
'\n <Datasource>\n ' +
|
||||
dsoptions.join('\n ') +
|
||||
'\n </Datasource>\n' +
|
||||
'\n </Datasource>\n'
|
||||
: '') +
|
||||
' </Layer>\n';
|
||||
};
|
||||
|
||||
|
10
test/rendering/layer_nodatasource.mml
Normal file
10
test/rendering/layer_nodatasource.mml
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
|
||||
"Stylesheet": [
|
||||
"layer_nodatasource.mss"
|
||||
],
|
||||
"Layer": [{
|
||||
"name": "world",
|
||||
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over"
|
||||
}]
|
||||
}
|
4
test/rendering/layer_nodatasource.mss
Normal file
4
test/rendering/layer_nodatasource.mss
Normal file
@ -0,0 +1,4 @@
|
||||
#world {
|
||||
polygon-fill: green;
|
||||
line-color: hsl(30, 40%, 90%);
|
||||
}
|
17
test/rendering/layer_nodatasource.result
Normal file
17
test/rendering/layer_nodatasource.result
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE Map[]>
|
||||
<Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over" maximum-extent="-20037508.34,-20037508.34,20037508.34,20037508.34">
|
||||
|
||||
|
||||
<Style name="world" filter-mode="first">
|
||||
<Rule>
|
||||
<PolygonSymbolizer fill="#008000" />
|
||||
<LineSymbolizer stroke="#f0e6db" />
|
||||
</Rule>
|
||||
</Style>
|
||||
<Layer name="world"
|
||||
srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over">
|
||||
<StyleName>world</StyleName>
|
||||
</Layer>
|
||||
|
||||
</Map>
|
@ -195,6 +195,7 @@ helper.removeAbsoluteImages = function(xml) {
|
||||
helper.removeAbsoluteDatasources = function(xml) {
|
||||
xml.Map.forEach(function(map) {
|
||||
if (map.Layer) map.Layer.forEach(function(layer) {
|
||||
if (!layer.Datasource) return;
|
||||
layer.Datasource.forEach(function(datasource) {
|
||||
datasource.Parameter.forEach(function(param) {
|
||||
if (param.name === 'file') {
|
||||
|
Loading…
Reference in New Issue
Block a user