Add airports layer
This commit is contained in:
parent
5553b815f6
commit
69e777033e
4 changed files with 83 additions and 0 deletions
40
layers/airports/index.js
Normal file
40
layers/airports/index.js
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
import GeoJSON from 'ol/format/GeoJSON.js';
|
||||
import VectorLayer from 'ol/layer/Vector.js';
|
||||
import VectorSource from 'ol/source/Vector.js';
|
||||
|
||||
import types from './data/types.js';
|
||||
|
||||
import { Circle, Fill, Stroke, Style } from 'ol/style.js';
|
||||
|
||||
const layers = {
|
||||
name: "Airports",
|
||||
layers: [],
|
||||
};
|
||||
|
||||
for (let [name, url] of Object.entries(types)) {
|
||||
const layer = new VectorLayer({
|
||||
source: new VectorSource({
|
||||
url,
|
||||
format: new GeoJSON,
|
||||
}),
|
||||
style: new Style({
|
||||
image: new Circle({
|
||||
radius: name == 'large_airport' ? 10 : name == "small_airport" ? 3 : 5,
|
||||
fill: new Fill({
|
||||
color: 'rgba(255,255,255,0.4)',
|
||||
}),
|
||||
stroke: new Stroke({
|
||||
color: 'red',
|
||||
width: name == 'large_airport' ? 4 : 2,
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
});
|
||||
|
||||
layers.layers.push({
|
||||
name,
|
||||
layer,
|
||||
});
|
||||
}
|
||||
|
||||
export default layers;
|
||||
Loading…
Add table
Add a link
Reference in a new issue