[mapserver-dev] can mapserver serve xyz

Seth G sethg at geographika.co.uk
Wed Nov 10 12:29:08 PST 2021

Hi Bruce,

If you already have the tiles in an XYZ file structure you can simply put them in a folder on the web server (Apache, IIS etc.) and OpenLayer can access them as in the example at https://openlayers.org/en/latest/examples/xyz.html
OpenLayers just fills in the correcy xyz parameters based on map location e.g. https://c.tile.thunderforest.com/cycle/13/3997/2556.png

The approach using http://localhost/cgi-bin/mapserv.exe?map=/data/config/map/nasaww.map&MODE=tile&TILEMODE=gmap&LAYERS=bluemarble/{z}/{x}/{y}.png <http://localhost/cgi-bin/mapserv.exe?map=/data/config/map/nasaww.map&MODE=tile&TILEMODE=gmap&LAYERS=bluemarble/%7Bz%7D/%7Bx%7D/%7By%7D.png> can be used to generate new tiles from datasets using MapServer as long as projections etc. are set correctly.


twitter: @geographika

On Wed, Nov 10, 2021, at 9:21 PM, Bruce Clay wrote:
> Richard:
>   Thanks for your reply.  We have several datasets that I think follow the slippy map directory structure.  We want them on a server  accessible to remote thin clients.  We have WMTS datasets running on mapserver but that uses a different directory structure and those are accessible through a TMS or WMTS mapcaches query.  
> How does the remote thin client access the files from a folder C:\data_static\MapTiles\BlueMarbleTiles where the tms.xml file lives.  Some of the tilesets we generated with gdal2tiles.py and they have a tilemapresource.xml file instead.  Those files have an openlayers.html file in the base of the tileset that will display the teils when clicked on but again that is from the local system.
> Bruce
> On Wed, Nov 10, 2021 at 12:44 PM Richard Greenwood <richard.greenwood at gmail.com> wrote:
>> I'm not sure what you're trying to do so apologizes if I'm stating the obvious, but MapServer is a rendering engine that takes raw data (vector and/or raster) and returns a rasterized representation of that data based on the request. That may be a single image or multiple tiles depending on the request. If you already have tiles then you don't need MapServer. Your client (QGIS, OpenLayers, etc.) can fetch those tiles directly. Neither of the query strings that you've pasted into the email look valid to me so I'm not surprised that you're not getting any results.
>> On Wed, Nov 10, 2021 at 7:05 AM Bruce Clay <bclay1297 at gmail.com> wrote:
>>> Can mapserver serve xyz (mapbox or others) type tiles?
>>> If I try to add a xyz layer in qgis using http://localhost/cgi-bin/mapserv.exe?map=/data/config/map/nasaww.map&MODE=tile&TILEMODE=gmap&LAYERS=bluemarble/{z}/{x}/{y}.png <http://localhost/cgi-bin/mapserv.exe?map=/data/config/map/nasaww.map&MODE=tile&TILEMODE=gmap&LAYERS=bluemarble/%7Bz%7D/%7Bx%7D/%7By%7D.png> I always get a black set of tiles
>>> if i query http://localhost/cgi-bin/mapserv.exe?map=/data/config/map/nasaww.map&MODE=tile&TILEMODE=gmap&TILE=0+0+0&LAYERS=bluemarble I get a black tile
>>> if I change the layer name to a non-existent layer I still get a black tile and no errors are reported in the mapserver log file.
>>> if I click on the openlayers.html file in the root directory of the tileset it displays valid images.
>>> Online documentation refers to a tile mode but does not explain how to configure the map file to support xyz.  
>>> Bruce
>>> _______________________________________________
>>> MapServer-dev mailing list
>>> MapServer-dev at lists.osgeo.org
>>> https://lists.osgeo.org/mailman/listinfo/mapserver-dev
>> -- 
>> Richard W. Greenwood
>> www.greenwoodmap.com
> _______________________________________________
> MapServer-dev mailing list
> MapServer-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20211110/b8e2bc2a/attachment.html>

More information about the MapServer-dev mailing list