Building a National
Tile Server
Matt Walker
mattwalker@astuntechnology.com
@_walkermatt
Slide 2
Slide 2 text
What is it?
Great Britain base map tile service (TMS) and WMS
OS Open (Strategy, Meridian 2, VectorMap District)
OS Premium (OS Open + VectorMap Local & OS
MasterMap)
Smaller areas of Aerial Photography and other base
mapping
Who's using it?
Exactrak
Vehicle Tracking and Fleet Management
Mendip District Council
Public Website
Windsor and Maidenhead
Public Website
Surrey County Council
Public Website
South Norfolk Council
Public Website
Slide 5
Slide 5 text
Who's using it?
Stockport MBC
Public Website
Surrey Heath Borough Council
Public Website / Intranet GIS
Chichester District Council
Public Website
Slide 6
Slide 6 text
Software
Slide 7
Slide 7 text
Infrastructure
Slide 8
Slide 8 text
Loader
• Python script for loading GML and KML
data using OGR
• Originally for loading OS GML data (but
has been used with other GML and KML
data)
• Allows the source GML to be prepared and
enhanced during loading via Python
Slide 9
Slide 9 text
Loader
• Fairly fast (national cover OS MasterMap in
2 days)
• Concurrent loading via 4 processes into
PostgreSQL via PGDump with COPY
statements, create indexes once when all
data loaded
Slide 10
Slide 10 text
PostgreSQL/PostGIS
• PostgreSQL v9 with PostGIS v1.5
• 210GB of OS MasterMap and VectorMap
Local data and indexes
• 10GB for Meridian, Strategi etc.
• Separate tablespace for OSMM data;
OSMM index; VML data; VML index
Slide 11
Slide 11 text
PostgreSQL/PostGIS
• During load
– fsync = off to avoid flushing to disk too
frequently
– work_mem = 1GB when building indexes
• Effectively read-only once in production so
configured for read:
– shared_buffers = 2GB
– effecitive_cache_size = 4GB
Slide 12
Slide 12 text
MapServer
• Fast and reliable
• Simple configuration
• Mature feature set
• All data read direct from PostgreSQL
Slide 13
Slide 13 text
MapServer
• PROCESSING "CLOSE_CONNECTION=DEFER" to
share connections
• OS MasterMap and VectorMap Local
generally styled based on featurecode
• Using some attributes derived by Loader
for CartoText such as orientdeg and
anchorposition for better text placement
Slide 14
Slide 14 text
MapProxy
• Provides caching of map tiles for
performance
• Exposes WMS, TMS services for your
application, serving WMS direct from the
cache
Slide 15
Slide 15 text
MapProxy
Slide 16
Slide 16 text
MapProxy
• Nice features like only storing one tile for
single colour tiles and mixed format caches
• Sophisticated cache seeding and
management tools
• We seed popular areas (urban areas) for our
customers and cache is only about 20GB
compared to hundreds of GB if pre-seeded
Slide 17
Slide 17 text
Infrastructure
Slide 18
Slide 18 text
• ~8 EC2 instances all running Ubuntu
• Seperate EBS Volumes for PostgreSQL Data, Indexes
and Tile Cache
• One Load Balancer in front of the production servers
• AWS monitoring for health as well as seperate web
monitoring
Infrastructure
Slide 19
Slide 19 text
• Shared, High Performance, Redundant
Cache, possibly S3 SimpleDB or similar
• Improved cartography, possibly Mapnik
• Co-located hosting for imporved
redundency
What's next?