improved readability
This commit is contained in:
parent
db5cdd779a
commit
27cce7009b
@ -11,7 +11,7 @@ This software should make it simple to use pre-rendered map tiles in your own pr
|
|||||||
|
|
||||||
Download project files and upload it into your web hosting of your choice.
|
Download project files and upload it into your web hosting of your choice.
|
||||||
|
|
||||||
Open the **"proxy-test.html"** within your browser, your proxy server should display you a simple slippy maps rendering default Open Street Map tiles.
|
Open the **"test.html"** file within your browser, your proxy server should display you a simple slippy maps rendering default Open Street Map tiles.
|
||||||
Or test directly in your browser with a tile URL such as: http://www.example.com/tiles/15/17024/10792.png
|
Or test directly in your browser with a tile URL such as: http://www.example.com/tiles/15/17024/10792.png
|
||||||
|
|
||||||
**NB.** Remeber to check your web server folder permissions: **777** or **755**
|
**NB.** Remeber to check your web server folder permissions: **777** or **755**
|
||||||
@ -36,7 +36,7 @@ Or test directly in your browser with a tile URL such as: http://www.example.co
|
|||||||
$tiles_config['servers'] = array(
|
$tiles_config['servers'] = array(
|
||||||
'osm' => 'https://{switch:a,b,c}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
'osm' => 'https://{switch:a,b,c}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||||
'otm' => 'https://{switch:a,b,c}.tile.opentopomap.org/{z}/{x}/{y}.png',
|
'otm' => 'https://{switch:a,b,c}.tile.opentopomap.org/{z}/{x}/{y}.png',
|
||||||
// ADD: more services here
|
// ADD: more services here.
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -52,7 +52,7 @@ Or test directly in your browser with a tile URL such as: http://www.example.co
|
|||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
// CHANGE: bounding box cache-area to fit your own needs
|
// CHANGE: bounding box cache-area to fit your own needs
|
||||||
$tiles_config['bbox'] = '6.602696,35.07638,19.12499,47.10169'; // Italy tiles are cached, others are proxied!
|
$tiles_config['bbox'] = '6.602696,35.07638,19.12499,47.10169'; // CHANGE: bbox tiles (Italy) are cached, others are proxied!
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cache timeout in seconds
|
* Cache timeout in seconds
|
||||||
|
|||||||
15
config.php
15
config.php
@ -11,11 +11,14 @@
|
|||||||
/**
|
/**
|
||||||
* Whitelist of supported tile servers
|
* Whitelist of supported tile servers
|
||||||
*
|
*
|
||||||
|
* @link https://wiki.openstreetmap.org/wiki/Tile_servers
|
||||||
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
$tiles_config['servers'] = array(
|
$config['servers'] = array(
|
||||||
'osm' => 'https://{switch:a,b,c}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
'osm' => 'https://{switch:a,b,c}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||||
'otm' => 'https://{switch:a,b,c}.tile.opentopomap.org/{z}/{x}/{y}.png',
|
'otm' => 'https://{switch:a,b,c}.tile.opentopomap.org/{z}/{x}/{y}.png',
|
||||||
|
// ADD: more services here.
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -30,7 +33,7 @@ $tiles_config['servers'] = array(
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
$tiles_config['bbox'] = '6.602696,35.07638,19.12499,47.10169'; // Italy.
|
$config['bbox'] = '6.602696,35.07638,19.12499,47.10169'; // CHANGE: bbox tiles (Italy) are cached, others are proxied!
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cache timeout in seconds
|
* Cache timeout in seconds
|
||||||
@ -41,13 +44,13 @@ $tiles_config['bbox'] = '6.602696,35.07638,19.12499,47.10169'; // Italy.
|
|||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
$tiles_config['ttl'] = 86400;
|
$config['ttl'] = 86400;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom Proxy Server headers
|
* Custom Proxy Server headers
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
$tiles_config['headers'] = array(
|
$config['headers'] = array(
|
||||||
'Access-Control-Allow-Origin:' => '*',
|
'Access-Control-Allow-Origin:' => '*',
|
||||||
);
|
);
|
||||||
|
|||||||
10
index.php
10
index.php
@ -15,18 +15,20 @@
|
|||||||
* @license https://www.gnu.org/licenses/gpl-3.0.txt GNU/GPLv3
|
* @license https://www.gnu.org/licenses/gpl-3.0.txt GNU/GPLv3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// TODO: code refactoring ( wrap it within a dedicated class.. )
|
||||||
|
|
||||||
// User configs.
|
// User configs.
|
||||||
require_once 'config.php';
|
require_once 'config.php';
|
||||||
|
|
||||||
// Default configs.
|
// Default configs.
|
||||||
$servers = @$tiles_config['servers'] ?: array(
|
$servers = @$config['servers'] ?: array(
|
||||||
'osm' => 'https://{switch:a,b,c}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
'osm' => 'https://{switch:a,b,c}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||||
'otm' => 'https://{switch:a,b,c}.tile.opentopomap.org/{z}/{x}/{y}.png',
|
'otm' => 'https://{switch:a,b,c}.tile.opentopomap.org/{z}/{x}/{y}.png',
|
||||||
);
|
);
|
||||||
$bbox = @$tiles_config['bbox'] ?: '-180,-90,180,90';
|
$bbox = @$config['bbox'] ?: '-180,-90,180,90';
|
||||||
$ttl = @$tiles_config['ttl'] ?: 86400;
|
$ttl = @$config['ttl'] ?: 86400;
|
||||||
$headers = array_change_key_case(
|
$headers = array_change_key_case(
|
||||||
@$tiles_config['headers'] ?: array(
|
@$config['headers'] ?: array(
|
||||||
'Access-Control-Allow-Origin:' => '*',
|
'Access-Control-Allow-Origin:' => '*',
|
||||||
), CASE_LOWER
|
), CASE_LOWER
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user