At WWDC 2019, Apple announced Maps Web Snapshots for creating a static map from a URL.
- Documentation at developer.apple.com/documentation/snapshots
- Maps Snapshot Studio from Apple — maps.developer.apple.com/snapshot
- Web service endpoint and notes on the query parameters — developer.apple.com/documentation/snapshots/create_a_maps_web_snapshot
- Developer Forum with the tag: Maps Web Snapshots
- Forum thread on Image annotations larger than 50px
- Announcement from the Apple Developer Forums (around WWDC 2020):
Update your credentials in config.json
then install and run.
# config.json
# Do not commit your secrets
{
"teamId": "XXXXXXXXXX",
"keyId": "YYYYYYYYYY"
"privateKey": "AuthKey_YYYYYYYYYY.p8",
}
# install
npm install
# run and inspect output
mapkit-snapshots.js null-island.geojson -c config.json
Online help is available by supplying no parameters.
mapkit-snapshots.js
Usage:
mapkit-snapshots.js <file.geojson> -c config.json # -c pass in privateKey, teamId, keyId
mapkit-snapshots.js <file.geojson> -c config.json -o # -o opens in default browser
Generate a URL to display a map from a Apple Maps Web Snapshot.
Find the source code at roblabs/apple-maps-web-snapshot-cli
See the sample GeoJSON, null-island.geojson
for example valid properties
"properties": {
"center": [20, 20],
"display_point": {
"type": "Point","coordinates": [10,10]
},
"z": 2,
"spn": [1.0, 1.0],
"size": [600, 400],
"scale": 1,
"t": "mutedStandard",
"colorScheme": "dark",
"poi": 1,
"lang": "en-US",
"annotations": [],
"overlays": [],
"referer": "",
"expires": 3155673601
}
This repo shows working samples of Maps Web Snapshots and Node JS sample code for generating the proper URLs to use in your applications.
- Dec 30, 2021 - Add output key
url
to log the signed Apple Maps Web Snapshot URL - Nov 04, 2021 - Add command line options:
-c
for credentials.-o
to open in browser. - Mar 09, 2020 - Pass in values from GeoJSON. Pass in credentials via
config.json
. - Nov 04, 2019 - Update Javascript example for Annotations & Overlays.
- Nov 03, 2019 - Initial Sample Code for Maps Web Snapshots with MapKit JS