Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MetaGerMaps
Frontend
Commits
e7558053
Commit
e7558053
authored
6 years ago
by
Dominik Hebeler
Browse files
Options
Downloads
Patches
Plain Diff
The Browser Version of Maps will now use the Label Layer
parent
b659fa99
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/Http/Controllers/DownloadController.php
+4
-1
4 additions, 1 deletion
app/Http/Controllers/DownloadController.php
resources/assets/js/map.js
+33
-10
33 additions, 10 deletions
resources/assets/js/map.js
routes/web.php
+61
-18
61 additions, 18 deletions
routes/web.php
with
98 additions
and
29 deletions
app/Http/Controllers/DownloadController.php
+
4
−
1
View file @
e7558053
...
@@ -25,6 +25,9 @@ public function listFiles($minLon, $minLat, $maxLon, $maxLat){
...
@@ -25,6 +25,9 @@ public function listFiles($minLon, $minLat, $maxLon, $maxLat){
}
}
socket_close
(
$socket
);
socket_close
(
$socket
);
if
(
$content
==
""
)
abort
(
404
,
"File not found"
);
$response
=
Response
::
make
(
$content
,
200
);
$response
=
Response
::
make
(
$content
,
200
);
$response
->
header
(
'Content-Type'
,
'application/json'
);
$response
->
header
(
'Content-Type'
,
'application/json'
);
$response
->
header
(
'Cache-Control'
,
'max-age=0, no-cache, no-store, must-revalidate'
);
$response
->
header
(
'Cache-Control'
,
'max-age=0, no-cache, no-store, must-revalidate'
);
...
@@ -53,7 +56,7 @@ public function downloadFiles($minLon, $minLat, $maxLon, $maxLat){
...
@@ -53,7 +56,7 @@ public function downloadFiles($minLon, $minLat, $maxLon, $maxLat){
socket_close
(
$socket
);
socket_close
(
$socket
);
# The result is a path to the Zip File that will get downloaded
# The result is a path to the Zip File that will get downloaded
if
(
file_exists
(
$file
)){
if
(
file_exists
(
$file
)
&&
filesize
(
$file
)
>
0
){
return
response
()
->
download
(
$file
,
"offline-data.tar"
,
return
response
()
->
download
(
$file
,
"offline-data.tar"
,
[
[
"Content-Type"
=>
"application/tar"
,
"Content-Type"
=>
"application/tar"
,
...
...
This diff is collapsed.
Click to expand it.
resources/assets/js/map.js
+
33
−
10
View file @
e7558053
...
@@ -41,6 +41,7 @@ InteractiveMap.prototype.initMap = function() {
...
@@ -41,6 +41,7 @@ InteractiveMap.prototype.initMap = function() {
return
ol
.
proj
.
transform
(
point
,
'
EPSG:3857
'
,
'
EPSG:4326
'
);
return
ol
.
proj
.
transform
(
point
,
'
EPSG:3857
'
,
'
EPSG:4326
'
);
}
}
var
source
=
null
;
var
source
=
null
;
var
labels
=
null
;
if
(
typeof
android
===
"
undefined
"
){
if
(
typeof
android
===
"
undefined
"
){
// We are not serving this for the app so we'll use our regular Tile-Serve
// We are not serving this for the app so we'll use our regular Tile-Serve
source
=
new
ol
.
source
.
OSM
({
source
=
new
ol
.
source
.
OSM
({
...
@@ -57,7 +58,23 @@ InteractiveMap.prototype.initMap = function() {
...
@@ -57,7 +58,23 @@ InteractiveMap.prototype.initMap = function() {
ol
.
source
.
OSM
.
ATTRIBUTION
,
ol
.
source
.
OSM
.
ATTRIBUTION
,
],
],
//url: 'https://tiles.metager.de/{z}/{x}/{y}.png'
//url: 'https://tiles.metager.de/{z}/{x}/{y}.png'
url
:
'
/tile_cache/{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
'
});
});
}
else
{
}
else
{
// This is for our Android App we'll use another Tile-Server that has it's cache Disabled
// This is for our Android App we'll use another Tile-Server that has it's cache Disabled
...
@@ -88,19 +105,25 @@ InteractiveMap.prototype.initMap = function() {
...
@@ -88,19 +105,25 @@ InteractiveMap.prototype.initMap = function() {
zoom
=
null
;
zoom
=
null
;
this
.
updateMapPositionOnGps
=
false
;
this
.
updateMapPositionOnGps
=
false
;
}
}
var
map
=
new
ol
.
Map
({
var
layers
=
[];
layers
:
[
if
(
source
!=
null
){
layers
.
push
(
new
ol
.
layer
.
Tile
({
new
ol
.
layer
.
Tile
({
preload
:
0
,
preload
:
0
,
source
:
source
source
:
source
}),
/*
})
)
}
if
(
labels
!=
null
){
layers
.
push
(
new
ol
.
layer
.
Tile
({
new
ol
.
layer
.
Tile
({
source: new ol.source.TileDebug({
preload
:
0
,
projection: 'EPSG:3857',
source
:
labels
tileGrid: source.getTileGrid()
})
})
)
})*/
}
],
var
map
=
new
ol
.
Map
({
layers
:
layers
,
target
:
'
map
'
,
target
:
'
map
'
,
controls
:
ol
.
control
.
defaults
({
controls
:
ol
.
control
.
defaults
({
attributionOptions
:
/** @type {olx.control.AttributionOptions} */
({
attributionOptions
:
/** @type {olx.control.AttributionOptions} */
({
...
...
This diff is collapsed.
Click to expand it.
routes/web.php
+
61
−
18
View file @
e7558053
...
@@ -27,6 +27,67 @@ Route::group(['prefix' => 'download'], function(){
...
@@ -27,6 +27,67 @@ Route::group(['prefix' => 'download'], function(){
Route
::
get
(
'{minx}/{miny}/{maxx}/{maxy}/{zoomstart}/{zoomend}'
,
'DownloadController@downloadArea'
);
Route
::
get
(
'{minx}/{miny}/{maxx}/{maxy}/{zoomstart}/{zoomend}'
,
'DownloadController@downloadArea'
);
});
});
Route
::
get
(
'tile_cache/{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
,
"generate-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
::
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
::
group
([
'prefix'
=>
'map'
],
function
()
{
Route
::
get
(
'/'
,
function
()
{
Route
::
get
(
'/'
,
function
()
{
return
view
(
'map'
)
->
with
(
'css'
,
[
elixir
(
'css/general.css'
),
elixir
(
'css/mapSearch.css'
),
elixir
(
'css/routing.css'
)]);
return
view
(
'map'
)
->
with
(
'css'
,
[
elixir
(
'css/general.css'
),
elixir
(
'css/mapSearch.css'
),
elixir
(
'css/routing.css'
)]);
...
@@ -121,24 +182,6 @@ Route::group(['prefix' => 'metager'], function () {
...
@@ -121,24 +182,6 @@ Route::group(['prefix' => 'metager'], function () {
Route
::
get
(
'{search}'
,
'SearchController@iframeSearch'
);
Route
::
get
(
'{search}'
,
'SearchController@iframeSearch'
);
});
});
Route
::
get
(
'tile_cache/{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
,
"generate-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
;
});
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment