How to Set Up Tile Caching This tutorial will show you the steps you need to follow to set up map tile caching in MapInfo Spatial Server. Contents: United States: Phone: 518.285.6000 Fax: 518.285.6070 Sales: 800.327.8627 Government Sales: 800.619.2333 Technical Support: 518.285.7283 Technical Support Fax: 518.285.7575 www.pb.com/software Canada: Phone: 416.594.5200 Fax: 416.594.5201 Sales: 800.268.3282 Technical Support:.518.285.7283 Technical Support Fax: 518.285.7575 www.pb.com/software Europe/United Kingdom: Phone: +44.1753.848.200 Fax: +44.1753.621.140 Technical Support: +44.1753.848.229 www.pitneybowes.co.uk/software Asia Pacific/Australia: Phone: +61.2.9437.6255 Fax: +61.2.9439.1773 Technical Support: 1.800.648.899 www.pitneybowes.com.au/software © 2012 Pitney Bowes Software Inc. All rights reserved. Pitney Bowes Software Inc. is a wholly-owned subsidiary of Pitney Bowes Inc. Pitney Bowes, the Corporate logo, MapInfo, Group 1 Software, and MapInfo Professional are [registered] trademarks of Pitney Bowes Inc. or a subsidiary. All other trademarks are the property of their respective owners. 30 / 04 / 2012 • • • • • • Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1 Step 1: Install Apache HTTP Server . . . . . . . . . . . . . . . . . . . . . . . . . .2 Step 2: Modify the Apache httpd.conf File . . . . . . . . . . . . . . . . . . . . .2 Step 3: Create the tilecaching.conf File . . . . . . . . . . . . . . . . . . . . . . .2 Step 4: Create the Tile Cache Directory . . . . . . . . . . . . . . . . . . . . . . .4 Step 5: Restart Apache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4 Overview To speed up map rendering in your MapInfo Spatial Server application, you can have requested map tiles cached to disk so that MapInfo Spatial Server does not have to repeatedly regenerate the same tiles on subsequent requests. Here's how it works. Caching of map tiles is done using the Apache HTTP Server's built-in caching mechanism. You install an instance of Apache that will receive all MapInfo Spatial Server requests. You then configure Apache to have two virtual hosts: one listening on port 80, and one listening on port 90. As requests are received by Apache on port 80, Apache determines the type of request. All requests other than for named map tiles are forwarded immediately on to MapInfo Spatial Server (on port 8080 by default). Requests for named map tiles, however, are stripped of their Authorization header and forwarded on to the Apache virtual host on port 90. Since the request no longer has an Authorization header, the virtual host on port 90 can cache the map tile to disk before forwarding the request on to MapInfo Spatial Server for normal processing. Use the steps provided in the following sections to set up map tile caching in your MapInfo Spatial Server application. Step 1: Install Apache HTTP Server Step 1: Install Apache HTTP Server The first step is to download and install an instance of the Apache HTTP Server that will act as the front end to your MapInfo Spatial Server installation. Note: The Apache web server must be installed on a machine that has network access to the one that hosts MapInfo Spatial Server. The front-end Apache server will act as a sort of filter, intercepting NamedTile requests so that the requested map tiles can be cached to disk. After you have finished installing the Apache web server, you are ready to proceed to Step 2: Modify the Apache httpd.conf File on page 2. Step 2: Modify the Apache httpd.conf File Next, you need to modify the Apache server's configuration file: apache_install_dir/conf/httpd.conf. 1. Open httpd.conf in a text editor. 2. In httpd.conf, find this line... Listen 80 ...and immediately below it, add this line... Listen 90 3. At the end of the file, add this line... Include conf/tilecaching.conf 4. Save the changes you have made to httpd.conf, and close the file. You are now ready to proceed to Step 3: Create the tilecaching.conf File on page 2. Step 3: Create the tilecaching.conf File In this step, you create a configuration file that Apache will use for caching the map tiles. 1. In the apache_install_dir/conf directory, create a new file named tilecaching.conf. 2. Open tilecaching.conf in a text editor, and add the following lines: 2 MapInfo Spatial Server 1.0 How to Set Up Tile Caching Note: Placeholder values are shown in bold italics. Replace them with the actual values for your system. LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_http_module modules/mod_proxy_http.so LoadModule headers_module modules/mod_headers.so <Directory "c:/maptilecache_dirname"> AllowOverride None Order allow,deny Allow from all </Directory> NameVirtualHost *:90 NameVirtualHost *:80 ProxyRequests off ProxyPreserveHost On <Proxy *> Order allow,deny Allow from all </Proxy> <VirtualHost *:80> ServerName spatialserver <Location /rest/EnterpriseMapping/MapTilingService/NamedTiles/> RequestHeader unset Authorization </Location> ProxyPass /rest/EnterpriseMapping/MapTilingService/NamedTiles/ http://spatialserver:90/rest/EnterpriseMapping/MapTilingService/NamedTiles/ ProxyPassReverse /rest/EnterpriseMapping/MapTilingService/NamedTiles/ http://spatialserver:90/rest/EnterpriseMapping/MapTilingService/NamedTiles/ ProxyPass / http://spatialserver:8080/ ProxyPassReverse / http://spatialserver:8080/ </VirtualHost> <VirtualHost *:90> ServerName spatialserver ProxyPass / http://spatialserver:8080/ ProxyPassReverse / http://spatialserver:8080/ <Location /rest/EnterpriseMapping/MapTilingService/NamedTiles/> Header merge cache-control "public" RequestHeader set Authorization "Basic YWRtaW46YWRtaW4=" </Location> LoadModule cache_module modules/mod_cache.so LoadModule disk_cache_module modules/mod_disk_cache.so CacheRoot c:/maptilecache_dirname CacheEnable disk /rest/EnterpriseMapping/MapTilingService/NamedTiles/ Tutorial: How to Set Up Tile Caching 3 Step 4: Create the Tile Cache Directory CacheIgnoreHeaders None </VirtualHost> 3. Save the changes you have made to tilecaching.conf, and close the file. You are now ready to proceed to Step 4: Create the Tile Cache Directory on page 4. Step 4: Create the Tile Cache Directory In this step you create the directory that will hold the cached map tiles. Give the directory a name that will make its purpose clear, such as maptilecache. Whatever name you decide to give the directory, be sure to specify the name correctly in the tilecaching.conf configuration file. After you have created the directory, you are ready to proceed to the final step, Step 5: Restart Apache on page 4. Step 5: Restart Apache Finally, once you have completed all the previous steps, restart the Apache web server. Your map tiles will now be cached to disk. 4 MapInfo Spatial Server 1.0
© Copyright 2024