inital commit

This commit is contained in:
Raphael Martin 2023-12-04 16:44:09 +01:00
commit 4bb7f03ec1
21 changed files with 5267 additions and 0 deletions

9
LICENSE Executable file
View File

@ -0,0 +1,9 @@
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

247
README.md Executable file
View File

@ -0,0 +1,247 @@
# a2g_openlayers
## build withOpenLayers + Vite
This package uses the `ol` packages with [Vite](https://vitejs.dev/).
(requires Node 12+)
To get started change into your `a2g_openlayers` directory and start a development server (available at http://localhost:3000):
cd a2g_openlayers
npm start
To generate a build ready for production:
npm run build
Then deploy the contents of the `dist` directory to your server. You can also run `npm run serve` to serve the results of the `dist` directory for preview.
## suportet map layers
data-map-layers = '
[
{
"layer": "stamen",
"config": {
"layer": "terrain"
},
"label": "stamen terrain (free)",
"active": false
},
{
"layer": "stamen",
"config": {
"layer": "watercolor"
},
"label": "stamen watercolor (free)",
"active": true
},
{
"layer": "osm",
"config":[],
"label": "osm (free)",
"active": true
},
{
"layer": "stamen",
"config": {
"layer": "toner"
},
"label": "stamen toner (free)",
"active": false
},
{
"layer": "thunderforest",
"config": {
"layer": "cycle"
},
"label": "thunderforest openCycleMap (cycle)",
"active": false
},
{
"layer": "thunderforest",
"config": {
"layer": "transport"
},
"label": "thunderforest transport",
"active": false
},
{
"layer": "thunderforest",
"config": {
"layer": "landscape"
},
"label": "thunderforest landscape",
"active": false
},
{
"layer": "thunderforest",
"config": {
"layer": "outdoors"
},
"label": "thunderforest outdoors",
"active": false
},
{
"layer": "thunderforest",
"config": {
"layer": "atlas"
},
"label": "thunderforest atlas",
"active": false
},
{
"layer": "thunderforest",
"config": {
"layer": "transport-dark"
},
"label": "thunderforest transport-dark",
"active": false
},
{
"layer": "thunderforest",
"config": {
"layer": "spinal-map"
},
"label": "thunderforest spinal-map",
"active": false
},
{
"layer": "thunderforest",
"config": {
"layer": "pioneer"
},
"label": "thunderforest pioneer",
"active": false
},
{
"layer": "thunderforest",
"config": {
"layer": "neighbourhood"
},
"label": "thunderforest neighbourhood",
"active": false
},
{
"layer": "thunderforest",
"config": {
"layer": "mobile-atlas"
},
"label": "thunderforest mobile-atlas",
"active": false
},
{
"layer": "maptiler",
"config": {
"layer": "basic"
},
"label": "maptiler basic",
"active": false
},
{
"layer": "maptiler",
"config": {
"layer": "basic-4326"
},
"label": "maptiler basic (EPSG:4326)",
"active": false
},
{
"layer": "maptiler",
"config": {
"layer": "bright"
},
"label": "maptiler bright",
"active": false
},
{
"layer": "maptiler",
"config": {
"layer": "openstreetmap"
},
"label": "maptiler openstreetmap",
"active": false
},
{
"layer": "maptiler",
"config": {
"layer": "bright"
},
"label": "maptiler bright",
"active": false
},
{
"layer": "maptiler",
"config": {
"layer": "outdoor"
},
"label": "maptiler outdoor",
"active": false
},
{
"layer": "maptiler",
"config": {
"layer": "pastel"
},
"label": "maptiler pastel",
"active": false
},
{
"layer": "maptiler",
"config": {
"layer": "hybrid"
},
"label": "maptiler satelite hybrid",
"active": false
},
{
"layer": "maptiler",
"config": {
"layer": "streets"
},
"label": "maptiler streets",
"active": false
},
{
"layer": "maptiler",
"config": {
"layer": "toner"
},
"label": "maptiler toner",
"active": false
},
{
"layer": "maptiler",
"config": {
"layer": "topo"
},
"label": "maptiler topo",
"active": false
},
{
"layer": "maptiler",
"config": {
"layer": "topographique"
},
"label": "maptiler topographique",
"active": false
},
{
"layer": "maptiler",
"config": {
"layer": "voyager"
},
"label": "maptiler voyager",
"active": false
},
{
"layer": "maptiler",
"config": {
"layer": "winter"
},
"label": "maptiler winter",
"active": false
}
]
'

184
data/countries.geojson Executable file

File diff suppressed because one or more lines are too long

1077
data/fells_loop.gpx Executable file

File diff suppressed because it is too large Load Diff

343
data/geojson/photovoltaic.json Executable file
View File

@ -0,0 +1,343 @@
{
"type": "FeatureCollection",
"totalFeatures": 1046,
"features": [
{
"type": "Feature",
"id": "ENGEFPVANLOGD.fid-52fe0c36_17dec082096_4f67",
"geometry": {
"type": "Point",
"coordinates": [
16.349805849210597,
48.25017142860945
]
},
"geometry_name": "SHAPE",
"properties": {
"LEISTUNG": 5.7,
"icon": 2,
"popup": "test"
}
},
{
"type": "Feature",
"id": "ENGEFPVANLOGD.fid-52fe0c36_17dec082096_4f68",
"geometry": {
"type": "Point",
"coordinates": [
16.31467754920881,
48.15703986239329
]
},
"geometry_name": "SHAPE",
"properties": {
"OBJECTID": 3559,
"BEZ": 1230,
"BAUJAHR": 2012,
"PVID": "PV842",
"LEISTUNG": 6.24,
"SE_ANNO_CAD_DATA": null
}
},
{
"type": "Feature",
"id": "ENGEFPVANLOGD.fid-52fe0c36_17dec082096_4f69",
"geometry": {
"type": "Point",
"coordinates": [
16.308305377224514,
48.22034516003518
]
},
"geometry_name": "SHAPE",
"properties": {
"OBJECTID": 3560,
"BEZ": 1160,
"BAUJAHR": 2013,
"PVID": "PV844",
"LEISTUNG": 4.29,
"SE_ANNO_CAD_DATA": null,
"author": 5
}
},
{
"type": "Feature",
"id": "ENGEFPVANLOGD.fid-52fe0c36_17dec082096_4f6a",
"geometry": {
"type": "Point",
"coordinates": [
16.33275095625591,
48.16179398555423
]
},
"geometry_name": "SHAPE",
"properties": {
"OBJECTID": 3561,
"BEZ": 1120,
"BAUJAHR": 2013,
"PVID": "PV845",
"LEISTUNG": 3.9,
"SE_ANNO_CAD_DATA": null,
"author": 2
}
},
{
"type": "Feature",
"id": "ENGEFPVANLOGD.fid-52fe0c36_17dec082096_4f6b",
"geometry": {
"type": "Point",
"coordinates": [
16.504359669913917,
48.24089953373162
]
},
"geometry_name": "SHAPE",
"properties": {
"OBJECTID": 3562,
"BEZ": 1220,
"BAUJAHR": 2013,
"PVID": "PV846",
"LEISTUNG": 3.36,
"SE_ANNO_CAD_DATA": null,
"author": 1
}
},
{
"type": "Feature",
"id": "ENGEFPVANLOGD.fid-52fe0c36_17dec082096_4f6c",
"geometry": {
"type": "Point",
"coordinates": [
16.40266752923873,
48.20312696321299
]
},
"geometry_name": "SHAPE",
"properties": {
"OBJECTID": 3563,
"BEZ": 1020,
"BAUJAHR": 2013,
"PVID": "PV847",
"LEISTUNG": 7.99,
"SE_ANNO_CAD_DATA": null,
"author": 2
}
},
{
"type": "Feature",
"id": "ENGEFPVANLOGD.fid-52fe0c36_17dec082096_4f6d",
"geometry": {
"type": "Point",
"coordinates": [
16.511705685818,
48.208327900902106
]
},
"geometry_name": "SHAPE",
"properties": {
"OBJECTID": 3564,
"BEZ": 1220,
"BAUJAHR": 2012,
"PVID": "PV849",
"LEISTUNG": 3.12,
"SE_ANNO_CAD_DATA": null,
"author": 2
}
},
{
"type": "Feature",
"id": "ENGEFPVANLOGD.fid-52fe0c36_17dec082096_4f6e",
"geometry": {
"type": "Point",
"coordinates": [
16.421723096267158,
48.25005414108675
]
},
"geometry_name": "SHAPE",
"properties": {
"OBJECTID": 3565,
"BEZ": 1210,
"BAUJAHR": 2013,
"PVID": "PV850",
"LEISTUNG": 2.2,
"SE_ANNO_CAD_DATA": null,
"author": 2
}
},
{
"type": "Feature",
"id": "ENGEFPVANLOGD.fid-52fe0c36_17dec082096_4f6f",
"geometry": {
"type": "Point",
"coordinates": [
16.277447919342887,
48.19733447095196
]
},
"geometry_name": "SHAPE",
"properties": {
"OBJECTID": 3566,
"BEZ": 1140,
"BAUJAHR": 2013,
"PVID": "PV852",
"LEISTUNG": 8.33,
"SE_ANNO_CAD_DATA": null,
"author": 2
}
},
{
"type": "Feature",
"id": "ENGEFPVANLOGD.fid-52fe0c36_17dec082096_4f69",
"geometry": {
"type": "Point",
"coordinates": [
16.308305377224514,
48.22034516003518
]
},
"geometry_name": "SHAPE",
"properties": {
"OBJECTID": 3560,
"BEZ": 1160,
"BAUJAHR": 2013,
"PVID": "PV844",
"LEISTUNG": 4.29,
"SE_ANNO_CAD_DATA": null,
"author": 5
}
},
{
"type": "Feature",
"id": "ENGEFPVANLOGD.fid-52fe0c36_17dec082096_4f6a",
"geometry": {
"type": "Point",
"coordinates": [
16.33275095625591,
-48.16179398555423
]
},
"geometry_name": "SHAPE",
"properties": {
"OBJECTID": 3561,
"BEZ": 1120,
"BAUJAHR": 2013,
"PVID": "PV845",
"LEISTUNG": 3.9,
"SE_ANNO_CAD_DATA": null,
"author": 2
}
},
{
"type": "Feature",
"id": "ENGEFPVANLOGD.fid-ee",
"geometry": {
"type": "Point",
"coordinates": [
16.504359669913917,
-48.24089953373162
]
},
"geometry_name": "SHAPE",
"properties": {
"OBJECTID": 3562,
"BEZ": 1220,
"BAUJAHR": 2013,
"PVID": "PV846",
"LEISTUNG": 3.36,
"SE_ANNO_CAD_DATA": null,
"author": 1
}
},
{
"type": "Feature",
"id": "ENGEFPVANLOGD.fid-ff",
"geometry": {
"type": "Point",
"coordinates": [
16.40266752923873,
-48.20312696321299
]
},
"geometry_name": "SHAPE",
"properties": {
"OBJECTID": 3563,
"BEZ": 1020,
"BAUJAHR": 2013,
"PVID": "PV847",
"LEISTUNG": 7.99,
"SE_ANNO_CAD_DATA": null,
"author": 2
}
},
{
"type": "Feature",
"id": "ENGEFPVANLOGD.fid-dd",
"geometry": {
"type": "Point",
"coordinates": [
16.511705685818,
-48.208327900902106
]
},
"geometry_name": "SHAPE",
"properties": {
"OBJECTID": 3564,
"BEZ": 1220,
"BAUJAHR": 2012,
"PVID": "PV849",
"LEISTUNG": 3.12,
"SE_ANNO_CAD_DATA": null,
"author": 2
}
},
{
"type": "Feature",
"id": "ENGEFPVANLOGD.fid-a",
"geometry": {
"type": "Point",
"coordinates": [
-16.421723096267158,
48.25005414108675
]
},
"geometry_name": "SHAPE",
"properties": {
"OBJECTID": 3565,
"BEZ": 1210,
"BAUJAHR": 2013,
"PVID": "PV850",
"LEISTUNG": 2.2,
"SE_ANNO_CAD_DATA": null,
"author": 2
}
},
{
"type": "Feature",
"id": "ENGEFPVANLOGD.fid-d",
"geometry": {
"type": "Point",
"coordinates": [
-16.277447919342887,
48.19733447095196
]
},
"geometry_name": "SHAPE",
"properties": {
"OBJECTID": 3566,
"BEZ": 1140,
"BAUJAHR": 2013,
"PVID": "PV852",
"LEISTUNG": 8.33,
"SE_ANNO_CAD_DATA": null,
"author": 2
}
}
],
"crs": {
"type": "name",
"properties": {
"name": "urn:ogc:def:crs:EPSG::4326"
}
}
}

3
data/geojson/travel.json Executable file
View File

@ -0,0 +1,3 @@
{
"name": "raphael"
}

172
data/icons/frog.svg Executable file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 94 KiB

177
data/icons/logo-slim.svg Executable file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 114 KiB

139
data/icons/markerSolid.svg Executable file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 12 KiB

219
data/layerConfig.json Executable file
View File

@ -0,0 +1,219 @@
[
{
"layer": "osm",
"config": {
},
"label": "osm (free)",
"active": false
},
{
"layer": "stamen",
"config": {
"layer": "terrain"
},
"label": "stamen terrain (free)",
"active": false
},
{
"layer": "stamen",
"config": {
"layer": "watercolor"
},
"label": "stamen watercolor (free)",
"active": true
},
{
"layer": "stamen",
"config": {
"layer": "toner"
},
"label": "stamen toner (free)",
"active": false
},
{
"layer": "thunderforest",
"config": {
"layer": "cycle"
},
"label": "thunderforest openCycleMap (cycle)",
"active": false
},
{
"layer": "thunderforest",
"config": {
"layer": "transport"
},
"label": "thunderforest transport",
"active": false
},
{
"layer": "thunderforest",
"config": {
"layer": "landscape"
},
"label": "thunderforest landscape",
"active": false
},
{
"layer": "thunderforest",
"config": {
"layer": "outdoors"
},
"label": "thunderforest outdoors",
"active": false
},
{
"layer": "thunderforest",
"config": {
"layer": "atlas"
},
"label": "thunderforest atlas",
"active": false
},
{
"layer": "thunderforest",
"config": {
"layer": "transport-dark"
},
"label": "thunderforest transport-dark",
"active": false
},
{
"layer": "thunderforest",
"config": {
"layer": "spinal-map"
},
"label": "thunderforest spinal-map",
"active": false
},
{
"layer": "thunderforest",
"config": {
"layer": "pioneer"
},
"label": "thunderforest pioneer",
"active": false
},
{
"layer": "thunderforest",
"config": {
"layer": "neighbourhood"
},
"label": "thunderforest neighbourhood",
"active": false
},
{
"layer": "thunderforest",
"config": {
"layer": "mobile-atlas"
},
"label": "thunderforest mobile-atlas",
"active": false
},
{
"layer": "maptiler",
"config": {
"layer": "basic"
},
"label": "maptiler basic",
"active": false
},
{
"layer": "maptiler",
"config": {
"layer": "basic-4326"
},
"label": "maptiler basic (EPSG:4326)",
"active": false
},
{
"layer": "maptiler",
"config": {
"layer": "bright"
},
"label": "maptiler bright",
"active": false
},
{
"layer": "maptiler",
"config": {
"layer": "openstreetmap"
},
"label": "maptiler openstreetmap",
"active": false
},
{
"layer": "maptiler",
"config": {
"layer": "outdoor"
},
"label": "maptiler outdoor",
"active": false
},
{
"layer": "maptiler",
"config": {
"layer": "pastel"
},
"label": "maptiler pastel",
"active": false
},
{
"layer": "maptiler",
"config": {
"layer": "hybrid"
},
"label": "maptiler satelite hybrid",
"active": false
},
{
"layer": "maptiler",
"config": {
"layer": "streets"
},
"label": "maptiler streets",
"active": false
},
{
"layer": "maptiler",
"config": {
"layer": "toner"
},
"label": "maptiler toner",
"active": false
},
{
"layer": "maptiler",
"config": {
"layer": "topo"
},
"label": "maptiler topo",
"active": false
},
{
"layer": "maptiler",
"config": {
"layer": "topographique"
},
"label": "maptiler topographique",
"active": false
},
{
"layer": "maptiler",
"config": {
"layer": "voyager"
},
"label": "maptiler voyager",
"active": false
},
{
"layer": "maptiler",
"config": {
"layer": "winter"
},
"label": "maptiler winter",
"active": false
}
]

1
dist/assets/index.2f260c05.css vendored Executable file

File diff suppressed because one or more lines are too long

10
dist/assets/index.4e9346ea.js vendored Executable file

File diff suppressed because one or more lines are too long

1
dist/assets/index.4e9346ea.js.map vendored Executable file

File diff suppressed because one or more lines are too long

134
dist/index.html vendored Executable file
View File

@ -0,0 +1,134 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/x-icon" href="https://openlayers.org/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Using OpenLayers with Vite</title>
<script type="module" crossorigin src="/assets/index.4e9346ea.js"></script>
<link rel="stylesheet" href="/assets/index.2f260c05.css">
</head>
<body>
<div id="a2g-costum-icons" data-content='[{"uid": 1, "name": "Raphael Martin","icon":"data/icons/frog.svg"},{"uid": 2, "name": "Anna Siller","icon":"data/icons/logo-slim.svg"}]'></div>
<div id="a2g-map-style" data-content=''></div>
<div class="a2g-map-wrap">
<div class="ol-popup a2g-map-popup d-none">
<a href="#" class="ol-popup-closer a2g-map-popup-closer"></a>
<div class="a2g-map-popup-content"></div>
</div>
<div class="form-check form-switch">
<input class="form-check-input a2g-map-marker-visible-switcher" type="checkbox">
<label class="form-check-label">hide marker</label>
</div>
<div class="form-check form-switch">
<input class="form-check-input a2g-map-geolocate-me" type="checkbox">
<label class="form-check-label">locate me</label>
</div>
<div>
<label>Geometry type &nbsp;</label>
<select class="a2g-map-layer-select">
</select>
</div>
<input class="a2g-map-layer-swipe" type="range" style="width: 100%; display: none;" value="0">
<div id="random1" class="a2g-map"
data-map-config='{
"markerSource": "data/geojson/photovoltaic.json",
"defaultMarkerIcon": "data/icons/frog.svg",
"zoom": 6,
"maxZoom": 13,
"centerLon": 19,
"centerLat": -30.1,
"useLayerSlider": false,
"centerCountry": true,
"style": {
"featureOverlay":{
"stroke":{
"color": "rgba(240,145,48,0.7)",
"width": 4
}
}
},
"mapLayers": [
{
"layer": "country",
"config": {
"layer": "country",
"countryGeoSource": "/data/countries.geojson"
},
"label": "country (free)",
"active": true
},{
"layer": "stamen",
"config": {
"layer": "terrain"
},
"label": "stamen terrain (free)",
"active": true
},
{
"layer": "stamen",
"config": {
"layer": "watercolor"
},
"label": "stamen watercolor (free)",
"active": false
},
{
"layer": "osm",
"config":[],
"label": "osm (free)",
"active": true
},
{
"layer": "stamen",
"config": {
"layer": "toner"
},
"label": "stamen toner (free)",
"active": false
}
]
}'></div>
<div class="form-check form-switch">
<input class="form-check-input a2g-map-marker-visible-switcher" type="checkbox">
<label class="form-check-label">hide marker</label>
</div>
<div class="form-check form-switch">
<input class="form-check-input a2g-map-geolocate-me" type="checkbox">
<label class="form-check-label">locate me</label>
</div>
<form class="form-inline">
<label>Geometry type &nbsp;</label>
<select class="a2g-map-layer-select">
</select>
</form>
</div>
<div class="a2g-map-wrap">
<div class="ol-popup a2g-map-popup" >
<!--<a href="#" class="ol-popup-closer a2g-map-popup-closer"></a>-->
<div class="a2g-map-popup-content"></div>
</div>
<input class="a2g-map-layer-swipe" type="range" style="width: 100%; display: none;" value="40">
<div class="a2g-map"
data-map-config='{"zoom":1,"maxZoom":18,"centerLon":0,"centerLat":0,"mapLayers":[{"layer":"osm","config":[],"label":"osm_map_layer","active":true},{"layer":"stamen","config":{"layer":"watercolor"},"label":"stamen_map_watercolor","active":true}]}'
></div>
<!--
<input id="external-map-button" type="button" value="Open external map"></input>
<span id="blocker-notice" hidden>Could not open map in external window. If you are using a popup or ad blocker you may need to disable it for this example.</span>
-->
</div>
</body>
</html>

132
index.html Executable file
View File

@ -0,0 +1,132 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/x-icon" href="https://openlayers.org/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Using OpenLayers with Vite</title>
</head>
<body>
<div id="a2g-costum-icons" data-content='[{"uid": 1, "name": "Raphael Martin","icon":"data/icons/frog.svg"},{"uid": 2, "name": "Anna Siller","icon":"data/icons/logo-slim.svg"}]'></div>
<div id="a2g-map-style" data-content=''></div>
<div class="a2g-map-wrap">
<div class="ol-popup a2g-map-popup d-none">
<a href="#" class="ol-popup-closer a2g-map-popup-closer"></a>
<div class="a2g-map-popup-content"></div>
</div>
<div class="form-check form-switch">
<input class="form-check-input a2g-map-marker-visible-switcher" type="checkbox">
<label class="form-check-label">hide marker</label>
</div>
<div class="form-check form-switch">
<input class="form-check-input a2g-map-geolocate-me" type="checkbox">
<label class="form-check-label">locate me</label>
</div>
<div>
<label>Geometry type &nbsp;</label>
<select class="a2g-map-layer-select">
</select>
</div>
<input class="a2g-map-layer-swipe" type="range" style="width: 100%; display: none;" value="0">
<div id="random1" class="a2g-map"
data-map-config='{
"markerSource": "data/geojson/photovoltaic.json",
"defaultMarkerIcon": "data/icons/frog.svg",
"zoom": 6,
"maxZoom": 13,
"centerLon": 19,
"centerLat": -30.1,
"useLayerSlider": false,
"centerCountry": true,
"style": {
"featureOverlay":{
"stroke":{
"color": "rgba(240,145,48,0.7)",
"width": 4
}
}
},
"mapLayers": [
{
"layer": "country",
"config": {
"layer": "country",
"countryGeoSource": "/data/countries.geojson"
},
"label": "country (free)",
"active": true
},{
"layer": "stamen",
"config": {
"layer": "terrain"
},
"label": "stamen terrain (free)",
"active": true
},
{
"layer": "stamen",
"config": {
"layer": "watercolor"
},
"label": "stamen watercolor (free)",
"active": false
},
{
"layer": "osm",
"config":[],
"label": "osm (free)",
"active": true
},
{
"layer": "stamen",
"config": {
"layer": "toner"
},
"label": "stamen toner (free)",
"active": false
}
]
}'></div>
<div class="form-check form-switch">
<input class="form-check-input a2g-map-marker-visible-switcher" type="checkbox">
<label class="form-check-label">hide marker</label>
</div>
<div class="form-check form-switch">
<input class="form-check-input a2g-map-geolocate-me" type="checkbox">
<label class="form-check-label">locate me</label>
</div>
<form class="form-inline">
<label>Geometry type &nbsp;</label>
<select class="a2g-map-layer-select">
</select>
</form>
</div>
<div class="a2g-map-wrap">
<div class="ol-popup a2g-map-popup" >
<!--<a href="#" class="ol-popup-closer a2g-map-popup-closer"></a>-->
<div class="a2g-map-popup-content"></div>
</div>
<input class="a2g-map-layer-swipe" type="range" style="width: 100%; display: none;" value="40">
<div class="a2g-map"
data-map-config='{"zoom":1,"maxZoom":18,"centerLon":0,"centerLat":0,"mapLayers":[{"layer":"osm","config":[],"label":"osm_map_layer","active":true},{"layer":"stamen","config":{"layer":"watercolor"},"label":"stamen_map_watercolor","active":true}]}'
></div>
<!--
<input id="external-map-button" type="button" value="Open external map"></input>
<span id="blocker-notice" hidden>Could not open map in external window. If you are using a popup or ad blocker you may need to disable it for this example.</span>
-->
</div>
<script type="module" src="./main.js"></script>
</body>
</html>

1021
main.js Executable file

File diff suppressed because it is too large Load Diff

1256
package-lock.json generated Executable file

File diff suppressed because it is too large Load Diff

15
package.json Executable file
View File

@ -0,0 +1,15 @@
{
"name": "a2g_openlayers",
"version": "1.0.0",
"scripts": {
"start": "vite",
"build": "vite build",
"serve": "vite preview"
},
"devDependencies": {
"vite": "^2.6.7"
},
"dependencies": {
"ol": "latest"
}
}

30
resources/external-map-map.html Executable file
View File

@ -0,0 +1,30 @@
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<style>
body {
margin: 0;
}
.map {
height: 100%;
}
.map.unusable .ol-mask {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
user-select: none;
background-color: rgba(0, 0, 0, .7);
color: white;
font: bold 3rem 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.map.unusable .ol-control {
display: none;
}
</style>
</head>
<body>
<div id="map" class="map"></div>
</body>
</html>

92
style.css Executable file
View File

@ -0,0 +1,92 @@
@import "node_modules/ol/ol.css";
html, body {
margin: 0;
height: 100%;
}
.a2g-map {
/*max-width:*/
width: 100%;
height:450px;
background: #85ccf9;
position: relative;
}
@keyframes spinner {
to {
transform: rotate(360deg);
}
}
.spinner:after {
content: "";
box-sizing: border-box;
position: absolute;
top: 50%;
left: 50%;
width: 40px;
height: 40px;
margin-top: -20px;
margin-left: -20px;
border-radius: 50%;
border: 5px solid rgba(180, 180, 180, 0.6);
border-top-color: rgba(0, 0, 0, 0.6);
animation: spinner 0.6s linear infinite;
}
.ol-popup {
position: absolute;
background-color: white;
box-shadow: 0 1px 4px rgba(0,0,0,0.2);
padding: 15px;
border-radius: 5px;
border: 1px solid #cccccc;
bottom: 12px;
left: -50px;
min-width: 250px;
}
.ol-popup:after, .ol-popup:before {
top: 100%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.ol-popup:after {
border-top-color: white;
border-width: 10px;
left: 48px;
margin-left: -10px;
}
.ol-popup:before {
border-top-color: #cccccc;
border-width: 11px;
left: 48px;
margin-left: -11px;
}
.ol-popup-closer {
text-decoration: none;
position: absolute;
top: 2px;
right: 8px;
}
.ol-popup-closer:after {
content: "✖";
}
.a2g-map:-webkit-full-screen {
height: 100%;
margin: 0;
}
.a2g-map:-ms-fullscreen {
height: 100%;
}
.a2g-map:fullscreen {
height: 100%;
}
.a2g-map .ol-rotate {
top: 3em;
}

5
vite.config.js Executable file
View File

@ -0,0 +1,5 @@
export default {
build: {
sourcemap: true,
}
}