Use background property for vector layers

This commit is contained in:
Tim Schaub
2022-01-01 11:51:06 -07:00
parent 9b0878a94a
commit 275ecca473
7 changed files with 95 additions and 8 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@@ -0,0 +1,33 @@
import GeoJSON from '../../../../src/ol/format/GeoJSON.js';
import Map from '../../../../src/ol/Map.js';
import VectorLayer from '../../../../src/ol/layer/Vector.js';
import VectorSource from '../../../../src/ol/source/Vector.js';
import View from '../../../../src/ol/View.js';
import {Fill, Stroke, Style} from '../../../../src/ol/style.js';
new Map({
target: 'map',
view: new View({
center: [0, 0],
zoom: 1,
}),
layers: [
new VectorLayer({
background: '#a9d3df',
source: new VectorSource({
url: '/data/countries.json',
format: new GeoJSON(),
}),
style: new Style({
stroke: new Stroke({
color: '#ccc',
}),
fill: new Fill({
color: 'white',
}),
}),
}),
],
});
render();

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@@ -0,0 +1,33 @@
import GeoJSON from '../../../../src/ol/format/GeoJSON.js';
import Map from '../../../../src/ol/Map.js';
import VectorImageLayer from '../../../../src/ol/layer/VectorImage.js';
import VectorSource from '../../../../src/ol/source/Vector.js';
import View from '../../../../src/ol/View.js';
import {Fill, Stroke, Style} from '../../../../src/ol/style.js';
new Map({
target: 'map',
view: new View({
center: [0, 0],
zoom: 1,
}),
layers: [
new VectorImageLayer({
background: '#a9d3df',
source: new VectorSource({
url: '/data/countries.json',
format: new GeoJSON(),
}),
style: new Style({
stroke: new Stroke({
color: '#ccc',
}),
fill: new Fill({
color: 'white',
}),
}),
}),
],
});
render();