diff --git a/README.md b/README.md index c6df1ca..5cea457 100755 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Together with a dedicated [μlogger mobile client](https://github.com/bfabiszews - multiple users - user authentication - Google Maps API v3 -- OpenLayers v2 (OpenStreet and other layers) +- OpenLayers v2 or v3 (OpenStreet and other layers) - ajax - user preferences stored in cookies - simple admin menu diff --git a/config.default.php b/config.default.php index 4a6a6c1..7a891e3 100755 --- a/config.default.php +++ b/config.default.php @@ -21,19 +21,18 @@ // Copy it to config.php and customize // default map drawing framework -// (gmaps = google maps, openlayers = openlayers/osm) -//$mapapi = "gmaps"; -$mapapi = "openlayers"; +//$mapapi = "gmaps"; // google maps +//$mapapi = "openlayers"; // openlayers 2 +$mapapi = "openlayers3"; // openlayers 3+ + +// openlayers additional map layers in XYZ format +// name => url +$ol_layers['OpenCycleMap'] = 'https://{a-c}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey='; // api key needed +$ol_layers['OpenTopoMap'] = 'https://{a-c}.tile.opentopomap.org/{z}/{x}/{y}.png'; +$ol_layers['ESRI'] = 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}'; +$ol_layers['UMP'] = 'http://{1-3}.tiles.ump.waw.pl/ump_tiles/{z}/{x}/{y}.png'; +$ol_layers['Osmapa.pl'] = 'http://{a-c}.tile.openstreetmap.pl/osmapa.pl/{z}/{x}/{y}.png'; -// openlayers additional map layers -// OpenCycleMap (0 = no, 1 = yes) -$layer_ocm = 1; -// MapQuest-OSM (0 = no, 1 = yes) -$layer_mq = 1; -// osmapa.pl (0 = no, 1 = yes) -$layer_osmapa = 1; -// UMP (0 = no, 1 = yes) -$layer_ump = 1; // default coordinates for initial map $init_latitude = 52.23; diff --git a/css/main.css b/css/main.css index ed73ff8..4e5563c 100755 --- a/css/main.css +++ b/css/main.css @@ -322,4 +322,95 @@ button { @keyframes blink { 50% { opacity: 0; } +} + +/* openlayers 3 popup */ +.ol-popup { + position: absolute; + background-color: white; + -webkit-filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2)); + filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2)); + padding: 15px; + border-radius: 10px; + border: 1px solid #cccccc; + bottom: 12px; + left: -50px; + min-width: 280px; +} +.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: "✖"; +} + +#switcher { + display: none; + position: absolute; + bottom: 12px; + left: 10px; + min-width: 200px; +} +.ol-layerswitcher { + margin: 1px; + color: #fff; + background-color: rgba(0, 60, 136, .5); + border: none; + border-radius: 2px; + font-family: sans-serif; + font-weight: bold; + font-size: .9em; + padding: 0.5em; +} +.ol-layerswitcher:hover { + background-color: rgba(0, 60, 136, .7) +} +.ol-layerswitcher label { + display: block; + clear: both; + margin: .5em 0; + cursor: pointer; +} +.ol-layerswitcher label:hover { + color: #c8dcf2; +} +.ol-layerswitcher input { + margin-right: 1em; +} +label.ol-datalayer { + margin-top: 1.5em; +} +.ol-datalayer ~ .ol-datalayer { + margin-top: .5em; +} +.ol-switcher-button { + top: 6.6em; + left: .5em; +} +.ol-touch .ol-switcher-button { + top: 10em; } \ No newline at end of file diff --git a/helpers/config.php b/helpers/config.php index 4cc3361..0c8658d 100644 --- a/helpers/config.php +++ b/helpers/config.php @@ -37,14 +37,7 @@ static $gkey = null; // openlayers additional map layers - // OpenCycleMap (0 = no, 1 = yes) - static $layer_ocm = 1; - // MapQuest-OSM (0 = no, 1 = yes) - static $layer_mq = 1; - // osmapa.pl (0 = no, 1 = yes) - static $layer_osmapa = 1; - // UMP (0 = no, 1 = yes) - static $layer_ump = 1; + static $ol_layers = []; // default coordinates for initial map static $init_latitude = 52.23; @@ -114,10 +107,7 @@ if (isset($mapapi)) { self::$mapapi = $mapapi; } if (isset($gkey)) { self::$gkey = $gkey; } - if (isset($layer_ocm)) { self::$layer_ocm = $layer_ocm; } - if (isset($layer_mq)) { self::$layer_mq = $layer_mq; } - if (isset($layer_osmapa)) { self::$layer_osmapa = $layer_osmapa; } - if (isset($layer_ump)) { self::$layer_ump = $layer_ump; } + if (isset($ol_layers)) { self::$ol_layers = $ol_layers; } if (isset($init_latitude)) { self::$init_latitude = $init_latitude; } if (isset($init_longitude)) { self::$init_longitude = $init_longitude; } if (isset($dbhost)) { self::$dbhost = $dbhost; } diff --git a/images/marker-gold.png b/images/marker-gold.png new file mode 100644 index 0000000..82dd7c4 Binary files /dev/null and b/images/marker-gold.png differ diff --git a/images/marker-green.png b/images/marker-green.png new file mode 100644 index 0000000..653fbf4 Binary files /dev/null and b/images/marker-green.png differ diff --git a/images/marker-red.png b/images/marker-red.png new file mode 100644 index 0000000..a20eff5 Binary files /dev/null and b/images/marker-red.png differ diff --git a/images/marker-white.png b/images/marker-white.png new file mode 100644 index 0000000..6e70481 Binary files /dev/null and b/images/marker-white.png differ diff --git a/index.php b/index.php index 5da234e..eb770ae 100755 --- a/index.php +++ b/index.php @@ -73,26 +73,15 @@ var units = ''; var mapapi = ''; var gkey = ''; - var layer_ocm = ''; - var layer_mq = ''; - var layer_osmapa = ''; - var layer_ump = ''; - var init_latitude = ''; - var init_longitude = ''; + var ol_layers = ; + var init_latitude = ; + var init_longitude = ; var lang = ; var admin = isAdmin()) ?>; var auth = 'isAuthenticated()) ? $auth->user->login : "null" ?>'; var pass_regex = ; - - - - - - - - isAdmin()): ?> @@ -106,7 +95,7 @@ - + '; } - popup = + var popup = '