1
0
mirror of https://github.com/klokantech/tileserver-php.git synced 2025-08-21 21:56:18 +02:00

108 Commits
v1.0 ... master

Author SHA1 Message Date
mheranco
4fe14e6164 Fix security issues - thanks @mheranco (#166)
* Fix XSS

* Check if requested tile resides inside the current directory

* Add input validation for "renderTile"

* Use floatval instead of "int" for casting
2025-07-14 17:08:39 +02:00
Jiří Komárek
d0fdeaec69 grammar check 2022-07-30 02:03:50 +02:00
Dalibor Janák
cce369b3f6 Merge pull request #162 from david-eagles/master
Modified WMTS Resource URL generation to support hostnames that contain the layer name.
2021-09-24 10:55:02 +02:00
David Eagles
7800af830a Modified WMTS Resource URL generation to support hostnames that contain the layer name.
If the hostname contained the layer name (eg. https://layername.domain.com/layername/wmts) then the WMTS capabilities document contained an incorrect Resource URL because the hostname was stripped back to simply https://.  This modification simply looks for the last occurrence of the layer name instead of the first when forming the Resource URL.
2021-09-24 11:09:17 +10:00
Dalibor Janák
eb571b5d70 Merge pull request #144 from scubajorgen/master
Resolved bug in transparent png tile
2020-08-10 07:53:51 +02:00
Dalibor Janak
43e3cadb87 Remove old aray syntax 2020-07-28 22:34:22 +02:00
Jorgen
54254f8ef1 Resolved bug in transparent png tile 2019-07-11 13:27:21 +02:00
Dalibor Janák
b266dc2a6e Merge pull request #143 from CodeLingoBot/rewrite-klokantech-tileserver-php-psr2-lower-case-constant-values
Change PHP keywords to comply with PSR2
2019-04-04 07:52:45 +02:00
CodeLingoBot
4c339b8d19 Change PHP keywords to comply with PSR2
Signed-off-by: CodeLingoBot <bot@codelingo.io>
2019-04-03 11:24:50 +13:00
Dalibor Janák
287da5062e Merge pull request #141 from ibesora/master
Removes body data from http 204 response
2019-01-07 14:31:58 +01:00
Isaac Besora Vilardaga
d11963d43c Removes body data from http 204 response 2019-01-07 14:01:19 +01:00
Dalibor Janák
5ddbfa300a Updated readme with tile size, closes #129 and custom CRS 2018-07-02 11:45:46 +02:00
Dalibor Janák
2a84c6271f Fix Undefined index SERVER_PORT router error in some server configs 2018-02-19 16:31:18 +01:00
Dalibor Janák
9f6b5d5100 Merge branch 'master' of https://github.com/klokantech/tileserver-php 2018-02-19 16:20:31 +01:00
Dalibor Janák
dca0e64219 Removed unused var in router 2018-02-19 16:15:51 +01:00
Dalibor Janák
e6af62e191 Remove PHP 5.3 check from travis 2018-02-19 15:59:44 +01:00
Dalibor Janák
d3ebdec555 Strip incorrectly encoded property in OMT datasets 2018-02-19 15:52:48 +01:00
Dalibor Janák
f75b1bbfa6 Don't need trailing slash in dataroot 2017-12-05 15:31:40 +01:00
Dalibor Janák
bb823a57ff 0. 2017-04-24 15:26:57 +02:00
Dalibor Janák
380cfdeaaf Merge pull request #100 from Burke9077/master
Fixed issue if HTTP_X_FORWARDED_PROTO is unset.
2017-04-24 09:31:57 +02:00
Matt Burke
dc2452e781 Fixed issue where tiles are not loaded if HTTP_X_FORWARDED_PROTO is
unset.
2017-04-06 10:27:04 -04:00
Dalibor Janák
5f314fef28 Fixed bug in condition with X-Forwarded-Proto 2016-12-06 23:18:30 +01:00
Dalibor Janák
758b6a1e4d Fix of X-Forwarded-Proto server variable (issue #92) 2016-12-06 18:10:06 +01:00
Dalibor Janák
d7a4ad03c1 Use https with X-Forwarded-Proto (issue #92) 2016-12-06 17:58:22 +01:00
Dalibor Janák
2ead30dc4a Rename mbtilesPrefix to dataRoot 2016-08-29 19:06:51 +02:00
Dalibor Janák
682a9ee5c9 Merge pull request #88 from mtfurlan/master
Add prefix to mbtiles, return 204 on no tile
2016-08-29 19:02:15 +02:00
Mark Furland
7405ec3dc3 Add prefix to mbtiles, return 204 on no tile
This adds a configuration option for a prefix to the mbtiles, so you can
store the tiles in other locations.

It also changes the no tile found 404 to a 204, as the mapbox team will
be doing:
https://github.com/mapbox/mapbox-gl-js/issues/1800#issuecomment-236190808
2016-08-26 11:12:43 -04:00
Petr Pridal
058df85c2e Readme mentions MVT vector tiles (pbf requests) 2016-05-05 12:18:20 +02:00
Petr Pridal
f7613e04a1 Updated default title of the page 2016-05-04 19:19:33 +02:00
Dalibor Janák
e4148733ed Empty tile response for jpg and webp 2016-05-03 23:36:31 +02:00
Dalibor Janák
c28d188e0d Empty tile response for jpg and webp 2016-05-03 23:21:40 +02:00
Dalibor Janák
ef5de0607d Unpack empty png tile PHP 5.2 compatible 2016-05-03 22:48:23 +02:00
Dalibor Janák
494669f5d7 Merge pull request #79 from ramunasd/patch-1
Faster and ~70% smaller empty png tile
2016-05-03 22:13:08 +02:00
Petr Pridal
4b53b4c351 Sample MBTiles file for OpenShift deploy 2016-05-03 17:15:54 +02:00
Petr Pridal
86a1c68888 Update .travis.yml 2016-04-23 00:34:40 +02:00
Petr Pridal
f834ec7fd9 Deploy to OpenShift via travis 2016-04-23 00:08:21 +02:00
Ramūnas Dronga
ac68e90870 Faster and ~70% smaller empty png tile 2016-04-18 21:25:38 +03:00
Dalibor Janák
bb48534fe3 Removing of useless code. 2016-03-21 13:42:53 +01:00
Dalibor Janák
c158bcbe57 Minor warning with some php configurations fixed. 2016-03-21 13:40:33 +01:00
Dalibor Janák
2dfd2fcb5f Max zoom of Mercator TileMatrixSet is affected with max of layers maxzoom (closes #76) 2016-03-21 10:59:29 +01:00
Dalibor Janák
6b4fb0fec7 WMTS url to tiles simplified for fastest tile serving 2016-03-07 14:57:29 +01:00
Dalibor Janák
8f2b068c4f Custom template implementation #31 2016-03-07 14:39:28 +01:00
Dalibor Janák
709ed4ffce Revert "Fix of utfgid detection"
This reverts commit 8f6a2ced68.
2016-03-07 14:00:29 +01:00
Dalibor Janák
7320f426a1 Autodetection fix or warning in router, closes #49 2016-03-04 13:28:05 +01:00
Dalibor Janák
2e36338720 Removed dependency of GlobalMercator class closes #74 2016-03-04 13:20:46 +01:00
Dalibor Janák
70159a5b29 Layer list improved 2016-03-04 12:07:37 +01:00
Dalibor Janák
fdeb010831 Get global vars via getenv 2016-03-01 19:17:46 +01:00
Dalibor Janák
8bbfa1d367 Config from eniviroment if is provided 2016-03-01 15:05:58 +01:00
Dalibor Janák
50630fe1c7 Get config from docker volumes if is provided 2016-03-01 11:57:18 +01:00
Dalibor Janák
8206bcccc7 GD module dependency closes #53 2016-02-29 20:21:13 +01:00
Dalibor Janák
d304b89eb2 Removed unused code 2016-02-29 14:19:09 +01:00
Dalibor Janák
87906da0c5 Correct detection of format closes #67 2016-02-29 14:16:17 +01:00
Dalibor Janák
92ddcb6e66 WMTS / TileJSON for remote tiles #69 2016-02-29 12:16:24 +01:00
Dalibor Janák
7efd117884 Merge pull request #71 from klokantech/customtiles
Customtiles
2016-02-29 09:52:13 +01:00
Dalibor Janák
e36a7e6a06 Fix of order of origin in geodetic profile 2016-02-26 08:51:47 +01:00
Dalibor Janák
7190e90845 Order of origin coords based on proj4 definition #70 2016-02-25 23:21:40 +01:00
Dalibor Janák
f3f2a995e5 Axis orientaton in wmts #70, bbox fix 2016-02-25 19:23:48 +01:00
Dalibor Janák
8233047097 Fixed bug in WGS84 tilematrixset 2016-02-24 20:18:06 +01:00
Dalibor Janák
46d79107e8 Minor code fixes 2016-02-24 18:55:42 +01:00
Dalibor Janák
a2162eeb99 Computation of matrix size 2016-02-18 16:49:48 +01:00
Dalibor Janák
27fc9a73ca Minor loop fixes 2016-02-18 08:43:49 +01:00
Dalibor Janák
4ff5d95a38 Code formating 2016-02-17 21:29:53 +01:00
Dalibor Janák
6da6b13fed Parse TileMatrixSet 2016-02-17 21:19:16 +01:00
Dalibor Janák
0609b25905 Refactoring of tilematrixsets creation 2016-02-17 20:29:39 +01:00
Dalibor Janák
ce485c6713 Allow to read metadata bounding box also as array 2016-02-17 11:39:16 +01:00
Dalibor Janák
ab7862209a Functions for parsing tilematrixset from json 2016-02-09 14:37:26 +01:00
Dalibor Janák
8b49aa2b8c Custom matrix sets generation refactring 2016-02-09 14:36:24 +01:00
Dalibor Janák
ea100ad8c2 Custom profile testing implemetation 2016-02-03 16:50:07 +01:00
Dalibor Janák
86527eeedb Merge branch 'customtiles' of https://github.com/klokantech/tileserver-php into customtiles 2016-02-03 15:24:43 +01:00
Dalibor Janák
3a9e74e3b0 Generate tilematrix sets from variables 2016-02-03 15:23:33 +01:00
Dalibor Janák
0446445248 Generate tilematrix sets from variables 2016-02-03 15:13:56 +01:00
Petr Pridal
853ca41ce0 Update travis badge + add docker hub badge 2016-02-02 15:26:11 +01:00
Petr Pridal
5b5f5e7905 Add .travis.yml to master 2016-02-02 15:21:02 +01:00
Dalibor Janák
b7960baaaa Travis status icon 2016-02-02 10:57:57 +01:00
Dalibor Janák
250512168c Fix of syntax error on PHP 5.2 (closes #63) 2016-02-01 20:51:03 +01:00
Dalibor Janák
6b5933e21f Utfgrid empty response bug fixed (related #62) 2016-01-26 22:55:34 +01:00
Dalibor Janák
f5408fd108 Utfgrid routing bug fixed 2016-01-26 22:31:12 +01:00
Dalibor Janák
dc26c831f1 Url for viewer switched to cdn. 2016-01-26 13:51:39 +01:00
Dalibor Janák
28aba6f9e2 Fix of utfgrid serving bug related with changes in #59 2016-01-25 18:32:07 +01:00
Dalibor Janák
8f6a2ced68 Fix of utfgid detection 2016-01-25 18:13:15 +01:00
Petr Pridal
79926b92fc Update README.md 2015-12-16 17:07:04 +01:00
Dalibor Janák
3343f80e09 404 with JSON message for not found tile #56 2015-12-15 16:27:28 +01:00
Dalibor Janák
c660ab8f41 Hybrid tile format support #59 2015-12-04 14:00:48 +01:00
Dalibor Janák
21d7a409fe Merge branch 'eyeNsky-master' 2015-12-01 23:06:12 +01:00
Dalibor Janák
abb4087942 Cleaning of image format choser for wmts #58 2015-12-01 23:03:54 +01:00
Dalibor Janák
0acdc04e32 Merge branch 'master' of https://github.com/eyeNsky/tileserver-php into eyeNsky-master 2015-12-01 22:32:46 +01:00
Petr Pridal
f9e801849e Implementation of MapBox vector tiles (MBTiles pbf) serving #42 2015-09-05 04:44:45 +02:00
Petr Pridal
e66e577d5d Merge pull request #52 from klokantech/large-mbtiles
Faster check for grids in large mbtiles file. Closes #51.
2015-08-13 13:58:16 +02:00
Petr Pridal
ffedfde75e Faster check for grids in large mbtiles file. Issue #51. 2015-08-12 18:01:28 +02:00
eyeNsky
b783c59585 add jpgpng support for ArcGIS Desktop 2015-04-02 08:19:48 -04:00
Petr Pridal
dd8d884bc6 Update README.md 2015-01-08 22:58:22 +01:00
Petr Pridal
8b4a5142e8 Update README.md 2014-12-05 12:27:55 +01:00
Dalibor Janák
53b379cd67 Empty tiles should have for @2x layers 512x512px Fixes #39 2014-08-15 01:01:35 +02:00
Petr Pridal
2bf8bf6d4b A bug introduced in #38 fixed (missing protocol in the WMTS Resource URL) 2014-08-12 17:23:41 +02:00
Petr Pridal
e4454b12be Merge pull request #38 from kurt-hectic/master
Protocol (such as HTTPS vs HTTP) of the request is used in the metadata
2014-08-12 17:13:15 +02:00
Timo Proescholdt
8002dbbb7d service metadata takes into account request protocol 2014-08-04 17:47:47 +02:00
dala
d4121d86d5 Router: Add support for @ in names of layers 2014-07-23 15:32:10 +02:00
dala
ea6e176ab3 Path to app problem fixed 2014-07-23 15:25:25 +02:00
Dalibor Janák
b13b8d98c8 Merge pull request #34 from Fil/patch-2
Autodetect minzoom, maxzoom and format for mbtiles
2014-07-23 13:42:04 +02:00
Dalibor Janák
f08d72262d CORS for tiles. 2014-06-27 09:19:26 +02:00
Dalibor Janák
4250eff554 Merge pull request #32 from Fil/patch-1
Check which .mbtiles files are readable
2014-06-23 14:44:02 +02:00
Fil
34ffddb765 Autodetect minzoom, maxzoom and format for mbtiles
* `format` is detected via JPEG's magic number `FFD8`
* `minzoom` and `maxzoom` are `min(zoom_level)` and `max(zoom_level)`
2014-06-20 23:15:01 +02:00
Fil
5d2662a6a3 Check which .mbtiles files are readable
In my setup some .mbtiles are links to an external hard drive - don't fail when the external drive is not connected. (Also this would allow to manage "publishing a map" via unix permission.)
2014-06-20 12:24:09 +02:00
dala
8dec7469f1 Bad links in the test were fixed. 2014-06-05 22:04:18 +02:00
dala
8170e02397 Strict standards error in PHP 5.4+ on function declarations Fixes #30 - Classes in server renamed. 2014-06-05 21:54:40 +02:00
dala
779e320dec Fixed problem with line break in MBtiles metadata. 2014-06-05 21:46:00 +02:00
dala
e226ae2cc3 URL encoding in tilejson. Problem with backslashes in url fixed. #29 2014-06-04 09:55:25 +02:00
Petr Pridal
61c866a521 Update README.md 2014-05-29 09:10:23 +02:00
3 changed files with 706 additions and 803 deletions

24
.travis.yml Normal file
View File

@@ -0,0 +1,24 @@
language: php
php:
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- hhvm
script:
- php tileserver.php
after_success:
- wget https://github.com/klokantech/tileserver-php/releases/download/v0.1/grandcanyon.mbtiles
- git config --global user.email "travis@localhost.localdomain"
- git config --global user.name "Travis CI"
- git add --all
- git commit -am "Travis change"
deploy:
provider: openshift
user: osm2vectortiles@klokantech.com
password:
secure: hiWKBaqh/CMdnQ2qxsRSKYAnk4tP/q2J50TaO+2sH09x+0Q85ygfICCDrEx457xqmGW0e4zZPsL83mMPvGt5KJO6g9DIncj6BFhpZA0ysnRJ3X1fczTiVN5hQfqNpa+/YIrQ0whu1Ur/IfdYTtvArYhuAPeigCloumGk9gNgSIQ=
domain: tileserver
app: php
skip_cleanup: true

172
README.md
View File

@@ -1,36 +1,26 @@
TileServer PHP - OGC Web Map Tiling Server (WMTS) TileServer PHP: MapTiler and MBTiles maps via WMTS
================================================= ==================================================
This server distributes maps to desktop, web, and mobile applications from [![Build Status](https://travis-ci.org/klokantech/tileserver-php.svg)](https://travis-ci.org/klokantech/tileserver-php)
a standard Apache+PHP web hosting. [![Docker Hub](https://img.shields.io/badge/docker-hub-blue.svg)](https://hub.docker.com/r/klokantech/tileserver-php/)
Try a live demo at: http://tileserver.maptiler.com/ This server distributes maps to desktop, web, and mobile applications from a standard Apache+PHP web hosting.
It is a free and open-source project implementing OGC WMTS standard for It is a free and open-source project implementing the OGC WMTS standard for pre-rendered map tiles made with any [map tiling software](https://www.maptiler.com/desktop/) like MapTiler Desktop, GDAL2Tiles, or any other MBTiles file.
pre-rendered map tiles made with [MapTiler](http://www.maptiler.com/), GDAL2Tiles,
or available as MBTiles files.
It is the easiest and cheapest way how to serve zoomable maps in a It is the easiest and cheapest way how to serve zoomable maps in a standardized way - practically from any ordinary web hosting.
standardized way - practically from any ordinary web hosting.
It is easy to install - just copy the project files to a PHP-enabled It is easy to install - copy the project files to a PHP-enabled directory along with your map data.
directory along with your map data.
It comes with an online interface showing the list of the maps and step-by-step guides for online mapping libraries (Google Maps API, Leaflet, OpenLayers, OL3, MapBox JS, ArcGIS JS) and various desktop GIS software: It comes with an online interface showing the list of the maps and step-by-step guides for online mapping libraries (Google Maps API, Leaflet, OpenLayers, OL3, MapLibre GL JS, ArcGIS JS) and various desktop GIS software:
![tileserver-screenshot](https://f.cloud.github.com/assets/59284/1041807/a040160c-0fdb-11e3-8941-ab367b2a648d.png) ![tileserver-screenshot](https://f.cloud.github.com/assets/59284/1041807/a040160c-0fdb-11e3-8941-ab367b2a648d.png)
This project is developed in PHP, not because it is the best language for This project is developed in PHP, not because it is the best language for the development of web applications, but because it maximally simplifies the deployment on a large number of web hostings, including various free web hostings providers.
development of web applications, but because it maximally simplify the
deployment on large number of web hosting providers including various free
web hostings.
Tiles are served directly by Apache with mod_rewrite rules as static files Tiles are served directly by Apache with mod_rewrite rules as static files and therefore are very fast and with correct HTTP caching headers. Only XML metadata is delivered via PHP. MBTiles are served via PHP and are therefore slower unless they are unpacked with mbutil.
and therefore are very fast and with correct HTTP caching headers.
Only XML metadata are delivered via PHP.
MBTiles are served via PHP, and are therfore slower, unless they are unpacked with mbutil.
[MapTiler](http://www.maptiler.com/) can render GeoTIFF, ECW, MrSID, GeoPDF into compatible map tiles. JPEG, PNG, GIF and TIFF with scanned maps or images without geolocation can be turned into standard map layers with the visual georeferencing functionality (http://youtu.be/eJxdCe9CNYg). [MapTiler](http://www.maptiler.com/) can render GeoTIFF, ECW, MrSID, GeoPDF into compatible map tiles. JPEG, PNG, GIF, and TIFF with scanned maps or images without geolocation can be turned into standard map layers with the visual georeferencing functionality (http://youtu.be/eJxdCe9CNYg).
[![MapTiler - mapping tiles](https://cloud.githubusercontent.com/assets/59284/3037911/583d7810-e0c6-11e3-877c-6a7747b80dd3.jpg)](http://www.maptiler.com/) [![MapTiler - mapping tiles](https://cloud.githubusercontent.com/assets/59284/3037911/583d7810-e0c6-11e3-877c-6a7747b80dd3.jpg)](http://www.maptiler.com/)
@@ -38,44 +28,36 @@ Requirements:
------------- -------------
- Apache webserver (with mod_rewrite / .htaccess supported) - Apache webserver (with mod_rewrite / .htaccess supported)
- PHP 5.2+ - PHP 5.6+ with SQLite module (php5-sqlite)
(or anther webserver implementing mod_rewrite rules and PHP) (or another webserver implementing mod_rewrite rules and PHP)
Installation: Installation:
------------- -------------
Download the project files as a [zip archive](https://github.com/klokantech/tileserver-php/archive/master.zip) or source code from GitHub and unpack it into a web-hosting of your choice. Download the project files as a [zip archive](https://github.com/klokantech/tileserver-php/archive/master.zip) or source code from GitHub and unpack it into a web-hosting of your choice.
If you access the web address relevant to the installation directory, If you access the web address relevant to the installation directory, the TileServer.php Server should display you a welcome message and further instructions.
the TileServer.php Server should display you a welcome message and further
instructions.
Then you can upload to the web hosting your mapping data - a directory with Then you can upload to the web hosting your mapping data - a directory with tiles rendered with [MapTiler](http://www.maptiler.com/).
tiles rendered with [MapTiler](http://www.maptiler.com/).
Tiles produced by open-source GDAL2Tiles or MapTiler and tiles in .mbtiles Tiles produced by open-source GDAL2Tiles or MapTiler Desktop and tiles in .mbtiles format can be easily converted to the required structure (XYZ with top-left origin and metadata.json file). The open-source utility [mbutil](https://github.com/mapbox/mbutil) produces exactly the required format.
files can be easily converted to required structure (XYZ with top-left origin
and metadata.json file). The open-source utility [mbutil](https://github.com/mapbox/mbutil) produces
exactly the required format.
Direct reading of .mbtiles files is supported, but with decreased performance Direct reading of .mbtiles files is supported but with decreased performance compared to the static files in a directory. The advantage is easier data management, especially upload over FTP or similar protocols.
compared to the static files in a directory. The advantage is easier data management,
especially upload over FTP or similar protocols.
Supported protocols: Supported protocols:
-------------------- --------------------
- OpenGIS WMTS 1.0.0 - OpenGIS WMTS 1.0.0
The Open Geospatial Consortium (OGC) Web Map Tile Service (WMTS) The Open Geospatial Consortium (OGC) Web Map Tile Service (WMTS)
Both KVP and RESTful version 1.0.0: Both KVP and RESTful version 1.0.0:
http://www.opengeospatial.org/standards/wmts/ http://www.opengeospatial.org/standards/wmts/
Target is maximal compliance to the standard. Target is maximal compliance to the standard.
Exposed at http://[...]/wmts Exposed at http://[...]/wmts
- OSGeo TMS 1.0.0 - OSGeo TMS 1.0.0
The OSGeo Tile Maps Service, but with inverted y-coordinates: The OSGeo Tile Maps Service, but with inverted y-coordinates:
@@ -87,91 +69,87 @@ Supported protocols:
flipped y-axis. flipped y-axis.
Exposed at http://[...]/tms Exposed at http://[...]/tms
- TileJSON.js - TileJSON
Metadata about the individual maps in a ready to use form for web Metadata about the individual maps in a ready to use form for web
clients following the standard http://mapbox.com/developers/tilejson/ clients following the standard http://mapbox.com/developers/tilejson/
and with support for JSONP access. and with support for JSONP access.
Exposed at http://[...]/layer.jsonp Exposed at http://[...]/layer.json or .jsonp
- Direct access with XYZ tile requests (to existing tiles in a directory - Direct access with XYZ tile requests (to existing tiles in a directory
or to .mbtiles) or to .mbtiles)
Compatible with Google Maps API / Bing SDK / OpenStreetMap clients. Compatible with Google Maps API / Bing SDK / OpenStreetMap clients.
Exposed at http://[...]/layer/z/x/y.ext Exposed at http://[...]/layer/z/x/y.ext
- MapBox UTFgrid request (for existing tiles in .mbtiles with UTFgrid support). Callback is supported - MapBox UTFgrid request (for existing tiles in .mbtiles with UTFgrid support). Callback is supported
Example https://www.mapbox.com/demo/visiblemap/ Example https://www.mapbox.com/demo/visiblemap/
Specification https://github.com/mapbox/utfgrid-spec Specification https://github.com/mapbox/utfgrid-spec
Exposed at http://[...]/layer/z/x/y.grid.json Exposed at http://[...]/layer/z/x/y.grid.json
To use the OGC WMTS services point your client (desktop or web) to the URL - MapBox Vector Tiles (for MBTiles generated by [MapBox Studio Classic](https://www.mapbox.com/mapbox-studio-classic/) or by [OSM2VectorTiles](http://osm2vectortiles.org/) project).
of 'directory' where you installed tileserver.php project with suffix "wmts".
Example http://osm2vectortiles.tileserver.com/
TileJSON can be used in MapBox Studio Classic, MapBox SDKs/APIs, OpenLayers, etc.
Exposed at http://[...]/layer/z/x/y.pbf
- Retina / HighDPI routing with 512 tiles
Use @2x suffix in url for JSONs and tiles. For example http://tileserver.maptiler.com/grandcanyon@2x.json
To use the OGC WMTS standard, point your client (desktop or web) to the URL of 'directory' where you installed tileserver.php project with suffix "wmts".
For example: http://www.example.com/directory/wmts For example: http://www.example.com/directory/wmts
You can also install the project into a root directory of a virtual server:
Then the address is: http://www.example.com/wmts
Similarly for another end points. If you have installed the project into a root directory of a domain, then the address is: http://www.example.com/wmts
The supported WMTS requests includes: The supported WMTS requests includes:
GetCapabilities RESTful/KVP: GetCapabilities RESTful/KVP:
http://[...]/1.0.0/WMTSCapabilities.xml http://[...]/1.0.0/WMTSCapabilities.xml
http://[...]?service=wmts&request=getcapabilities&version=1.0.0 http://[...]?service=wmts&request=getcapabilities&version=1.0.0
GetTile RESTful/KVP: GetTile RESTful/KVP:
http://[...]/layer/[ANYTHING-OPTIONAL][z]/[x]/[y].[ext] http://[...]/layer/[ANYTHING-OPTIONAL][z]/[x]/[y].[ext]
http://[...]?service=wmts&request=getTile&layer=[layer]&tilematrix=[z]&tilerow=[y]&tilecol=[y]&format=[ext] http://[...]?service=wmts&request=getTile&layer=[layer]&tilematrix=[z]&tilerow=[y]&tilecol=[y]&format=[ext]
Another example requests are mentioned in the .htaccess. Other example requests are mentioned in the .htaccess.
TileServer-PHP supports all coordinates systems. You have to define it with tilejson with specification on https://github.com/klokantech/tilejson-spec/tree/custom-projection/2.2.0
Or use MapTiler to produce datasets with this specification.
Performance from the web clients Performance from the web clients
-------------------------------- --------------------------------
It is highly recommended to map several domain names to the service, such as: It is highly recommended to map several domain names to the service, such as:
http://a.example.com/, http://b.example.com/, http://c.example.com/. http://a.example.com/, http://b.example.com/, http://c.example.com/.
This can be done with DNS CNAME records pointing to your hosting.
The reason for this is that traditionally browsers will not send more then two This can be done with DNS CNAME records pointing to your hosting. The reason for this is that traditionally browsers will not send more than two simultaneous HTTP requests to the same domain - with multiple domains for the same server, you can better saturate the network and receive the maps faster.
simultaneous http request to the same domain - with multiple domains for the
same server you can better saturate the network and receive the maps faster.
Performance Performance
----------- -----------
In case the data are available in a form of directory with XYZ tiles, then In case the data are available in the form of a directory with XYZ tiles, then the Apache webserver is serving these files directly as WMTS RESTful or KVP.
Apache webserver is serving these files directly as WMTS RESTful or KVP.
This means performance is excellent, maps are delivered very fast and large This means performance is excellent, maps are delivered very fast, and a large number of concurrent visitors can be handled even with quite low-end hardware or cheap/free web hosting providers.
number of concurrent visitors can be handled even with quite a low-end
hardware or cheap/free web hosting providers.
Mod_rewrite rules are utilized to ensure the HTTP requests defined in the OCG Mod_rewrite rules are utilized to ensure the HTTP requests defined in the OCG WMTS standard are served, and Apache preserves standard caching headers & eTag.
WMTS standard are served, and Apache preserve standard caching headers & eTag.
The performance should be significantly better then performance of any other The performance should be significantly better than any other tile caching project (such as TileCache.org or GeoWebCache).
tile caching project (such as TileCache.org or GeoWebCache).
Performance graph for "apache static" comparing other tile caching projects Performance graph for "apache static" comparing other tile caching projects is available online at http://code.google.com/p/mod-geocache/wiki/PreliminaryBenchmark
is available online at:
http://code.google.com/p/mod-geocache/wiki/PreliminaryBenchmark
Limits of actual implementation Limits of actual implementation
------------------------------- -------------------------------
With intention, in this moment the project supports only: With intention, at this moment, the project supports only:
- Mercator tiles (a la OpenStreetMap) and Geodetic tiles (WGS84 unprojected)
with known and described tiling scheme.
- All tiles must be 256x256 pixels.
- We enforce and require XYZ (top-left origin) tiling schema (even for TMS). - We enforce and require XYZ (top-left origin) tiling schema (even for TMS).
Password protection Password protection
@@ -180,10 +158,10 @@ Password protection
HTTP Simple Authentication can be easily added to the server. HTTP Simple Authentication can be easily added to the server.
Edit the .htaccess and add these lines: Edit the .htaccess and add these lines:
AuthUserFile /full/path/to/.htpasswd AuthUserFile /full/path/to/.htpasswd
AuthType Basic AuthType Basic
AuthName "Secure WMTS" AuthName "Secure WMTS"
Require valid-user Require valid-user
Create a file called .htpasswd with user:password format. Create a file called .htpasswd with user:password format.
You can use a command-line utility: You can use a command-line utility:
@@ -202,22 +180,19 @@ TileServer.php can run without any problems over HTTPS, if required.
Microsoft Windows web-hosting Microsoft Windows web-hosting
----------------------------- -----------------------------
The TileServer.php should run on Windows-powered webservers with Apache The TileServer.php should run on Windows-powered webservers with Apache installation if PHP 5.2+ and mod_rewrite are available.
installation if PHP 5.2+ and mod_rewrite are available.
With the IIS webserver hosting, you may need PHP and IIRF module With the IIS webserver hosting, you may need PHP and IIRF module (http://iirf.codeplex.com/) and alter appropriately the rewrite rules.
(http://iirf.codeplex.com/) and alter appropriately the rewrite rules.
Credits / Contributors Credits / Contributors
---------------------- ----------------------
Project developed initially by Klokan Technologies GmbH, Switzerland in Project developed initially by Klokan Technologies GmbH, Switzerland, in cooperation with National Oceanic and Atmospheric Administration - NOAA, USA.
cooperation with National Oceanic and Atmospheric Administration - NOAA, USA.
- Petr Pridal - Klokan Technologies GmbH <petr.pridal@klokantech.com> - Petr Pridal - Klokan Technologies GmbH <petr.pridal@maptiler.com>
- Jason Woolard - NOAA <jason.woolard@noaa.gov> - Jason Woolard - NOAA <jason.woolard@noaa.gov>
- Jon Sellars - NOAA <jon.sellars@noaa.gov> - Jon Sellars - NOAA <jon.sellars@noaa.gov>
- Dalibor Janak - Klokan Technologies GmbH <dalibor.janak@klokantech.com> - Dalibor Janak - Klokan Technologies GmbH <dalibor.janak@maptiler.com>
Tested WMTS/TMS clients Tested WMTS/TMS clients
----------------------- -----------------------
@@ -236,21 +211,26 @@ Tested WMTS/TMS clients
http://www.thecarbonproject.com/gaia.php http://www.thecarbonproject.com/gaia.php
- MapBox.js - the loading of maps via TileJSON, interaction layer supported - MapBox.js - the loading of maps via TileJSON, interaction layer supported
https://www.mapbox.com/mapbox.js https://www.mapbox.com/mapbox.js
Alternative
-----------
If you need [map server with commercial support](https://www.maptiler.com/server/), explore the possibilities provided by the MapTiler Server.
BSD License BSD License
----------- -----------
Copyright (C) 2012 Klokan Technologies GmbH Copyright (C) 2020 MapTiler AG (https://www.maptiler.com/)
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met: modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this 1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer. list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, 2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution. and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED

1313
tileserver.php Normal file → Executable file

File diff suppressed because it is too large Load Diff