[mapserver-users] MapCache Larger tiles, reduce number of files

Stephen Woodbridge stephenwoodbridge37 at gmail.com
Mon Mar 9 13:46:42 PDT 2020


Are you sure you have the set the tile size correctly in OpenLayers?
Because if OL is requesting tiles that you don't have it sounds like 
that is the reason.
And if you do load tile and there is a miss-match, then I would expect 
the resolution of be off.

Here are a few links that might help:

https://openlayers.org/en/latest/examples/wms-custom-tilegrid-512x256.html
https://openlayers.org/en/latest/apidoc/module-ol_tilegrid_TileGrid-TileGrid.html
https://stackoverflow.com/questions/57072232/how-to-change-tilesize-in-xyz-tilelayer-from-default256-256-to-something-e

On 3/9/2020 3:21 PM, Jean-Philippe Chenel wrote:
> Steve,
>
> It is what I supposed, but when I've generated the tiles 512x512 using 
> the default resolution GoogleMapCompatible, with the cache template 
> {z}/{x}/{y}.{ext} and loaded it in OpenLayers using ol.source.XYZ, 
> I've noticied that the x tile being tried to load was not in the good 
> range.
>
> z/x/-y.png
>
> Tiles generated:
> .../8/37 and 38/64 and 65.png
>
> Tiles loaded by OpenLayers (with error 404):
> .../8/73 to 77/130 and 131.png
>
> Thanks,
> ------------------------------------------------------------------------
> *De :* mapserver-users <mapserver-users-bounces at lists.osgeo.org> de la 
> part de Stephen Woodbridge <stephenwoodbridge37 at gmail.com>
> *Envoyé :* 9 mars 2020 14:56
> *À :* mapserver-users at lists.osgeo.org <mapserver-users at lists.osgeo.org>
> *Objet :* Re: [mapserver-users] MapCache Larger tiles, reduce number 
> of files
> Jean-Philippe,
>
> I don't think it works like that. Resolution is determined by zoom
> factor so you generate  metatile at that resolution then you chop that
> metatile in tiles of whatever size you specify. So resolution is
> controled by zoom not tile size.
>
> -Steve W
>
> On 3/9/2020 2:45 PM, Jean-Philippe Chenel wrote:
> > Hi,
> >
> > With MapCache, I want to generate the tiles that will be copied to a
> > mobile device, on a viewer created with OpenLayers.
> >
> > When generating a large extent, with multiple levels of zoom, the
> > files count is really big, so I want to reduce the number of files by
> > increasing the tile size. I've made a test with tiles 512x512, but
> > I've realized that the resolution must be changed when changing tiles
> > size. So, the tiles are bigger, but changing the resolution make
> > generating the same number of files.
> >
> > I'm open for workaround and other tricks.
> >
> > mapcache.xml
> >
> > <grid name="GoogleMaps512">
> > <metadata>
> > <title>GoogleMaps512</title>
> > </metadata>
> > <extent>-20037508.3427892480 -20037508.3427892480 20037508.3427892480
> > 20037508.3427892480</extent>
> > <srs>EPSG:3857</srs>
> > <srsalias>EPSG:900913</srsalias>
> > <units>m</units>
> > <size>512 512</size>
> > <resolutions>156543.0339280410 78271.51696402048 39135.75848201023
> > 19567.87924100512 9783.939620502561 4891.969810251280
> > 2445.984905125640 1222.992452562820 611.4962262814100
> > 305.7481131407048 152.8740565703525 76.43702828517624
> > 38.21851414258813 19.10925707129406 9.554628535647032
> > 4.777314267823516 2.388657133911758 1.194328566955879
> > 0.5971642834779395</resolutions>
> > </grid>
> >
> > <cache name="tmpl_xyz" type="disk" layout="template">
> > 
> <template>/data/mapcache/tiles/{tileset}/{grid}/{z}/{x}/{y}.{ext}</template>
> > </cache>
> >
> > <tileset name="OpenStreetMap">
> > <source>vmap0</source>
> > <cache>tmpl_xyz</cache>
> > <grid>GoogleMaps512</grid>
> > <format>PNG</format>
> > </tileset>
> >
> > With best regards,
> >
> > _______________________________________________
> > mapserver-users mailing list
> > mapserver-users at lists.osgeo.org
> > https://lists.osgeo.org/mailman/listinfo/mapserver-users
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-users



More information about the mapserver-users mailing list