maptiler / tileserver-php

MBTiles and MapTiler folder hosting with TileJSON, OGC WMTS, UTFGrid interaction and web interface. QGIS & ESRI ArcGIS compatible. Runs on any Apache+PHP webhosting. MapBox Studio Vector Tiles hosting.
http://tileserver.maptiler.com/
568 stars 163 forks source link

Serving tiles in XYZ format #118

Open mapnewbie opened 7 years ago

mapnewbie commented 7 years ago

Hi !

Appears I am stuck with an issue ... cant really say if I am doing things the wrong way or if it is an issue with the tileserver-php. I have placed tileserver.php in /var/www/html/ folder and the mbtiles file in a data/ folder under the same. I am also able to successfully serve vector tiles with default styles (by specifying the vector source in style file to the geojson output (localhost/tileserver.php?/mymbtiles(filename).json) as described in the documentation in openmaptiles.org. However, when I change the source to XYZ format .. I meet with no success. The url which the tileserver.php index page displays when one clicks on the XYZ link is http://localhost/tileserver.php?/index.json?//var/www/html/data/mymbtiles/{z}/{x}/{y}.pbf. I have tried adding the same to my style file as a vector source. Tried various other combinations as well .. with no success. (localhost/tileserver.php?/mymbtiles/{z}/{x}/{y}.pbf .. localhost/tileserver.php?/data/mymbtiles/{z}/{x}/{y}.pbf .. localhost/tileserver.php?/mymbtiles/{z}/{x}/{y}.ext.

Is there an issue here ..or am I doing things wrong ? Any pointers in this regard will be greatly appreciated.

Thanks in advance

daliborjanak commented 7 years ago

Which LAMP/WAMP are you using? Mod rewrite enabled? Htaccess allowed?

Try to set dataroot https://github.com/klokantech/tileserver-php/blob/master/tileserver.php#L13 or base url to your folder https://github.com/klokantech/tileserver-php/blob/master/tileserver.php#L15 or rewritebase in htaccess https://github.com/klokantech/tileserver-php/blob/master/.htaccess#L9

Some configurations of stack have a problems...

mapnewbie commented 7 years ago

I am using .. Ubuntu 17.04, Apache2 Ubuntu, Postgresql (installed) ..but I guess not relevant here, and PHP 7.0.22. Data root has been set to /var/www/html/data/ .. where my mbtiles file is located ..as detailed in documentation in openmaptiles.org. I will try to do the changes suggested with respect to base url & rewritebase in .htaccess and revert back.

Thanks for a prompt response. Much appreciated.

mapnewbie commented 7 years ago

Verified the following ..

No success so far.

I didn't try out setting base url to data folder as suggested .. I am testing on a localhost presently with the tileserver.php file in the /var/www/html/ folder. The data root is already set to /var/www/html/data/ .. where my mbtiles file is located. So, should I be pointing the base url to http://localhost in the array .. I mean should it be .. config['baseUrls'] = array('http://localhost/') ?