Add survey markers layer
This commit is contained in:
parent
4ac53a4733
commit
8cd1ee414d
5 changed files with 92 additions and 0 deletions
39
layers/survey-markers/index.js
Normal file
39
layers/survey-markers/index.js
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
import VectorLayer from 'ol/layer/Vector';
|
||||
import {Vector as VectorSource} from 'ol/source.js';
|
||||
import GeoJSON from 'ol/format/GeoJSON.js';
|
||||
|
||||
import {Style} from 'ol/style.js';
|
||||
import Icon from 'ol/style/Icon.js';
|
||||
|
||||
import pin from './pin.svg?url';
|
||||
import states from './states.js';
|
||||
|
||||
let survey_markers = {
|
||||
name: "National Geodetic Survey Markers",
|
||||
details: `These are extremely large, and loading too many at once may crash your browser.<br><a href="#" onclick="this.closest('details').querySelectorAll('ul li input').forEach(e => e.checked || e.click()); return false;">Enable All (will <i>definitely</i> crash your browser)</a>`,
|
||||
layers: [],
|
||||
};
|
||||
|
||||
for (let [state, url] of Object.entries(states)) {
|
||||
const vectorLayer = new VectorLayer({
|
||||
source: new VectorSource({
|
||||
url: url,
|
||||
format: new GeoJSON,
|
||||
}),
|
||||
style: new Style({
|
||||
image: new Icon({
|
||||
anchor: [0.5, 1],
|
||||
src: pin,
|
||||
}),
|
||||
}),
|
||||
});
|
||||
|
||||
survey_markers.layers.push({
|
||||
name: state,
|
||||
layer: vectorLayer,
|
||||
});
|
||||
}
|
||||
|
||||
survey_markers.layers.sort((a, b) => a.name > b.name ? 1 : -1); // Names are always unique
|
||||
|
||||
export default survey_markers;
|
||||
Loading…
Add table
Add a link
Reference in a new issue