Version 4 (modified by 16 years ago) ( diff ) | ,
---|
This page is one of the MapGuide Community CodeSamples. Visit the CodeSamples page to view more!
Serving Mapguide Tiles directly via Apache
For scalability, it can be useful to get Apache to serve your map tiles directly.
This allows the map tiles to be proxied and cached, freeing up the Mapguide Server process, which during high load may have a request queue. The sample configuration also flags the tiles to expire after one day.
The implementation involves exposing a single map's tile cache directory via apache httpd.conf
<Directory "C:/Program Files/MapGuideOpenSource2.0/Server/Repositories/TileCache/Samples_Sheboygan_MapsTiled_Sheboygan/"> Options Indexes ErrorDocument 404 /mapguide/seedSheboyganTile.php Header set Cache-Control "max-age=86400, public" AllowOverride None Order allow,deny Allow from all </Directory> Alias /sheboyganTiles/ "C:/Program Files/MapGuideOpenSource2.0/Server/Repositories/TileCache/Samples_Sheboygan_MapsTiled_Sheboygan/"
Restart Apache
The attached file contains seedSheboyganTile.php which is used to generate tiles which haven't been seeded yet,
save it in "C:\Program Files\MapGuideOpenSource2.0\WebServerExtensions\www"
There is also a modified version of openlayers Mapguide.js which has a new option called "useHttpTile" which
when set to true will generate requests for the tiles as they are stored internally by the TileService,
the layer url then becomes http://localhost:8008/sheboyganTiles/
The httpCacheDemo.html file assumes you have openlayers installed under "C:\Program Files\MapGuideOpenSource2.0\WebServerExtensions\www\openlayers"
Simply add the updated Mapguide.js to the openlayers\lib\OpenLayers\Layer directory and then open the httpCacheDemo.html file to try it out.
Attachments (3)
-
mapguideServerTileCacheByHttp.zip
(7.1 KB
) - added by 16 years ago.
Mapguide Tile Http Serving Sample
-
mapGuideServerTileCacheByHttp_IIS.zip
(1.7 KB
) - added by 16 years ago.
Mapguide Tile Http Serving Sample for IIS
-
getTile-DotNet.zip
(1.9 KB
) - added by 11 years ago.
A DotNET port of getTile.php
Download all attachments as: .zip