Serving Mapguide Tiles directly
For scalability, it can be useful to get your web server 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.
Openlayers has native support for this via the useHttpTile layer option
The implementation involves exposing a single map's tile cache directory via apache httpd.conf. This sample configuration also flags the tiles to expire after one day.
<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/"
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.
update openlayers support is now included in trunk, you should ignore the included mapguide.js file.
The attached file contains getTile.php which is an IIS version of the Apache seedSheboyganTile.php file mentioned above.
Set up IIS as follows:
- In IIS select the virtual folder containing the tile cache, right-click and select Properties.
- In the Properties dialog, select the Custom Errors tab.
- Choose 404 from the list and click Edit.
- In the Edit Custom Error Properties dialog choose URL for Message Type and enter a relative path to this PHP file, e.g. "/mapguide/blah/getTile.php".
- Save this file in the relevant location, e.g. "C:\Program Files\MapGuideOpenSource2.0\WebServerExtensions\www\blah\getTile.php".
- This script does not handle extra parameters, i.e. the "querystring" parameter added under http://trac.openlayers.org/ticket/1622.
- You must hard-code the tile map repository definition and access credentials inside this file.
) - added by 14 years ago.
Mapguide Tile Http Serving Sample
) - added by 13 years ago.
Mapguide Tile Http Serving Sample for IIS
) - added by 9 years ago.
A DotNET port of getTile.php
Download all attachments as: .zip