From 5fcaaf8a67a68ff8c1d969a478b4755f76494034 Mon Sep 17 00:00:00 2001 From: Dominik Pfennig <dominik@suma-ev.de> Date: Mon, 23 Jul 2018 15:31:52 +0200 Subject: [PATCH] The Labels are now again rendered on one Tile but all Labels should render now correctly --- resources/assets/js/map.js | 32 ++++------------------------- routes/web.php | 41 -------------------------------------- 2 files changed, 4 insertions(+), 69 deletions(-) diff --git a/resources/assets/js/map.js b/resources/assets/js/map.js index fac315f..f9acadb 100644 --- a/resources/assets/js/map.js +++ b/resources/assets/js/map.js @@ -41,7 +41,6 @@ InteractiveMap.prototype.initMap = function() { return ol.proj.transform(point, 'EPSG:3857', 'EPSG:4326'); } var source = null; - var labels = null; if(typeof android === "undefined"){ // We are not serving this for the app so we'll use our regular Tile-Serve source = new ol.source.OSM({ @@ -58,23 +57,8 @@ InteractiveMap.prototype.initMap = function() { ol.source.OSM.ATTRIBUTION, ], //url: 'https://tiles.metager.de/{z}/{x}/{y}.png' - url: '/tiles/tile/{z}/{x}/{y}.png' - }); - labels = new ol.source.OSM({ - attributions: [ - new ol.Attribution({ - html: '© ' + '<a href="https://metager.de/">MetaGer.de</a>' - }), - new ol.Attribution({ - html: '| <a href="https://metager.de/impressum">Impressum</a>' - }), - new ol.Attribution({ - html: '| © ' + '<a href="http://nominatim.openstreetmap.org/">Nominatim</a>' - }), - ol.source.OSM.ATTRIBUTION, - ], - //url: 'https://tiles.metager.de/{z}/{x}/{y}.png' - url: '/tiles/label/{z}/{x}/{y}.png' + url: '/tile_cache/{z}/{x}/{y}.png', + maxZoom: 21 }); }else{ // This is for our Android App we'll use another Tile-Server that has it's cache Disabled @@ -110,15 +94,7 @@ InteractiveMap.prototype.initMap = function() { layers.push( new ol.layer.Tile({ preload: 0, - source: source - }) - ) - } - if(labels != null){ - layers.push( - new ol.layer.Tile({ - preload: 0, - source: labels + source: source, }) ) } @@ -133,7 +109,7 @@ InteractiveMap.prototype.initMap = function() { new ol.control.ScaleLine() ]), view: new ol.View({ - maxZoom: 18, + maxZoom: 21, minZoom: 6, center: ol.proj.transform( //[9.45824, 52.48812], 'EPSG:4326', 'EPSG:3857'), diff --git a/routes/web.php b/routes/web.php index 40a812f..15c3b92 100644 --- a/routes/web.php +++ b/routes/web.php @@ -47,47 +47,6 @@ Route::get('tile_cache/{z}/{x}/{y}.png', function($z, $x, $y){ return $response; }); -Route::group(['prefix' => 'tiles'], function(){ - Route::get('tile/{z}/{x}/{y}.png', function($z, $x, $y){ - $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); - socket_connect($socket, env("TILESERVER_HOST"), env("TILESERVER_PORT")); - - socket_write($socket, "tile-tile;$z;$x;$y\n", strlen("generate-tile;$z;$x,$y\n")); - - $content = ""; - while(true){ - $tmp = socket_read($socket, 4096); - if($tmp == "") break; - else $content .= $tmp; - } - $response = Response::make($content, 200); - $response->header('Content-Type', 'image/png'); - $response->header('Cache-Control', 'max-age=0, no-cache, no-store, must-revalidate'); - $response->header('Pragma', 'no-cache'); - $response->header('Expires', 'Wed, 11 Jan 1984 05:00:00 GMT'); - return $response; - }); - Route::get('label/{z}/{x}/{y}.png', function($z, $x, $y){ - $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); - socket_connect($socket, env("TILESERVER_HOST"), env("TILESERVER_PORT")); - - socket_write($socket, "tile-label;$z;$x;$y\n", strlen("generate-tile;$z;$x,$y\n")); - - $content = ""; - while(true){ - $tmp = socket_read($socket, 4096); - if($tmp == "") break; - else $content .= $tmp; - } - $response = Response::make($content, 200); - $response->header('Content-Type', 'image/png'); - $response->header('Cache-Control', 'max-age=0, no-cache, no-store, must-revalidate'); - $response->header('Pragma', 'no-cache'); - $response->header('Expires', 'Wed, 11 Jan 1984 05:00:00 GMT'); - return $response; - }); -}); - Route::group(['prefix' => 'map'], function () { Route::get('/', function () { return view('map')->with('css', [elixir('css/general.css'), elixir('css/mapSearch.css'), elixir('css/routing.css')]); -- GitLab