Skip to content

Instantly share code, notes, and snippets.

@VityaSchel
Last active April 5, 2025 18:37
Show Gist options
  • Save VityaSchel/7740f69fa89247eb23b019c125a63fd6 to your computer and use it in GitHub Desktop.
Save VityaSchel/7740f69fa89247eb23b019c125a63fd6 to your computer and use it in GitHub Desktop.
Extract Apple Maps/MapKit POI icons

Extract Apple Maps/MapKit POI icons

You can download icons as of 5th April, 2025 in attached zip file. Download Apple Maps POI icons as zip archive

изображение
  1. Go to https://duckduckgo.com/local.js?get_mk_token=1
  2. Make a GET request to https://cdn.apple-mapkit.com/ma/bootstrap?apiVersion=2&mkjsVersion=5.78.158&poi=1 with Authorization: [previous response] header
  3. From that response, parse json and find "accessKey" in it. It should look like this: 1743879209_3285637747132202088_/_gViGKMuzZNzmDskrn2ovwl0pl9XMsGcon7VsPG9kfmg=
  4. Finally grab icons from their cdn using GET requests to https://cdn.apple-mapkit.com and access key in query

Example:

https://cdn.apple-mapkit.com/md/v1/icon?scale=2&subtype=poi&tint=dark&emphasis=standard&style=1&zoom=13&attributes=4:226,5:3,6:115,10:14,16:1,47:50,82:5,85:11,89:6,164:1,193:1&accessKey=1743875780_4578807989659320900_%2F_sfsG0vv9WUfbnNCBtCA210EMB0WHnPggaB1dEJOS1XM%3D

This will get you the biggest resolution icon of beer.

Reverse engineering needed cus I couldn't find how attributes are formed aside from the fact that they're called "style attributes" in mapkit javascript source code: https://duckduckgo.com/js/mapkit/mapkit.5.78.158.js

But this should get you started (see apple-maps-poi-icons-extract.ts)

import fs from "fs/promises"
const accessKey = '' // <-- paste your access key here
const max = 500
for (let i = 0; i < max; i++) {
const scale = 3
const id = i
const imgReq = await fetch('https://cdn.apple-mapkit.com/md/v1/icon?scale=' + scale + '&subtype=poi&tint=dark&emphasis=standard&style=1&zoom=128&attributes=4:226,5:3,6:' + id + ',10:0,82:3,85:13,89:1,164:1,193:1&accessKey=' + encodeURIComponent(accessKey));
if(imgReq.status !== 200) {
console.log(await imgReq.text());
console.log(`Error: ${imgReq.status}`);
console.log(i)
break
}
const content = Buffer.from(await imgReq.arrayBuffer())
const hash = Bun.hash(content)
const emptyIconHash = '14793898150699695213'
if (hash.toString() !== emptyIconHash) {
await fs.writeFile(`./icons/52x52/${id}.png`, content);
}
console.log(id, Math.round(i / max * 100) + '%')
}
// Run `mkdir ./icons && mkdir ./icons/52x52`
// Run with `bun apple-maps-poi-icons-extract.ts`
// This will skip empty icons
This file has been truncated, but you can view the full file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment