Optimising SVG Sprites for Map Icons

Map-heavy interfaces are judged in the first three seconds, and this domain is still serving FastComet's default placeholder page. Anyone who replaces it with a live map view will meet the same bottleneck: a few hundred tiny symbols that look harmless in a design file yet add up to megabytes on a handset. Getting the sprite library right is unglamorous work, and it separates a map that loads while a train pulls into Melbourne's Southern Cross from one that stalls on a Nullarbor signal. Learn more about Creating A Static Copy Of A Dynamic Website For Longevity.

The craft of optimizing SVG sprites for map icons is really about restraint: fewer bytes, fewer requests, clearer shapes. It also has a local edge. Australian audiences browse maps on patchy regional connections, expect government-accurate place names, and read flood and bushfire warnings closely. What follows covers how to build, compress, ship and maintain such a library for people using maps between Sydney's peaks, in regional Queensland, or along the Great Ocean Road.

Why sprite weight matters on Australian connections

Australians check maps on the move: catching the train from Parramatta into Sydney CBD, riding a tram down Collins Street, or planning a drive along the M1 between Brisbane and the Gold Coast. Mobile data allowances are tighter than they were a decade ago, and regional coverage still drops away beyond the edge of towns like Dubbo, Alice Springs or Katherine, never mind the blackspots inside national parks and on the run to Coober Pedy.

Each symbol delivered as its own file means another request, another cache entry and another chance to fail on a congested mobile network. Bundling them into a single sheet removes that overhead, and HTTP/2 reduces but does not erase it: multiplexing helps latency, yet every file still carries headers and can still miss the cache.

Set a budget early. A working library of 120 markers, street furniture and agency glyphs should sit under roughly 30 KB gzipped, with a second tier of rare icons loaded only when a user zooms into a dense Australian city centre. Recording that ceiling in the build pipeline makes the trade-off visible to designers before a library balloons.

Drawing symbols that survive every zoom level

Begin on a 24-pixel grid and test every glyph at 12 pixels, because that is the size at which a label like "Albury" still has to compete with the road beneath it. Hairline strokes vanish at that scale, so anything meant to be read small should be a filled shape, while anything meant to be an outline should carry at least a two-pixel stroke.

Australian iconography needs its own set: driving on the left flips the direction arrow, petrol stations sit beside highways like the Pacific Motorway, and the everyday vocabulary includes a drive-through coffee cup, an Australia Post box, a ute, a cattle grid and the quiet markers for free camp sites used by travellers heading inland.

Keep them themeable with currentColor and CSS custom properties. Emergency and utility layers need distinct treatments, from the warning colours used by state fire services to the greens and blues of water authorities and the amber of road closures, and a single tinted sprite saves shipping four separate sheets. A symbol with two or three interchangeable parts is usually better than four near-duplicates.

Compression, caching and delivery options compared

Minification is the cheapest win available. Strip editor namespaces, remove metadata, round path coordinates, merge overlapping subpaths and drop hidden layers before the file ever leaves the build. Tools in the SVGO ecosystem handle most of that, and Brotli on the server shaves the rest.

The choices below summarise the usual trade-offs for a pilot library of about 120 markers.

Technique Indicative size Extra requests Notes
Individual SVG files per icon 41 KB gzip 120 cache entries Poor on regional mobile networks
External sprite sheet with use 18 KB gzip 1 Reliable default for map controls
Inline sprite in the document 17 KB gzip None Fine for a single-page map app
Subsetted icon font 12 KB gzip 1 Recolours easily, less flexible geometry
PNG sheet at 2× density 26 KB 1 Fallback for very old browsers

Cache the chosen file under a hashed name with a long-lived immutable header, so a revision of the sprite is a new URL rather than a cache-purge email. If your map reads markers from a live GeoJSON endpoint, freeze a copy for the future; the piece on static site snapshots explains the pattern of capturing a dynamic site so the symbols keep resolving long after the feed changes.

Naming, accessibility and cultural accuracy in Australian maps

Accessible icons are labelled for people who never see them, which is awkward when dozens of symbols share one file. A hidden legend listing each marker name and grouping gives screen reader users a navigable structure, while decorative glyphs such as the dot beneath a pin are marked as hidden from assistive technology.

Place names carry weight here. Dual names adopted for Melbourne and Adelaide reflect the custodianship of Wurundjeri Woi Wurrung and Kaurna Country, and using them means acknowledging country on the same page that shows the map. Australian official mapping conventions also prefer "Mount" to "Mt" and "Junction" to "Jct", so labels generated from imported data often need rewriting before publication.

Legal exposure follows the data. Precise location collected from a "near me" button is personal information under the Privacy Act 1988 and the Australian Privacy Principles, and a flood map showing stale boundaries can mislead households under the Australian Consumer Law. Agency logos, including those of the major banks, are trademarks and need permission before they appear as commercial markers.

A working checklist for shipping sprite libraries

A short routine catches most of the problems before they reach a shared host such as this domain's FastComet plan.

Running this list before every deployment keeps regressions out of the live map and out of the hosting account, where a broken asset can take an entire campaign offline at once.

Keeping the sprite library alive as the map changes

Icon sets drift. New estates open in Perth's eastern suburbs, council boundaries shift, agency branding is refreshed, and a static sheet built two years ago slowly becomes a museum piece. Version the sprite, keep a changelog beside it, and review the list against current council and state datasets once a quarter.

The next concrete step is small: add a 30 KB gzip budget check to the build script, run it against the current sprite file, and record the result in the repository so the number has to be defended from the first commit onwards.