GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - roblabs/apple-maps-web-snapshot-cli: Create static maps 🗺 for Apple Maps using the Maps Web Snapshots announced at WWDC 2019.

BranchesTags
Open more actions menu

Latest commit

 

History

16 Commits
16 Commits

Folders and files

NameName
Last commit message
Last commit date
assets
assets
 
 
.gitignore
.gitignore
 
 
LICENSE.txt
LICENSE.txt
 
 
config.json
config.json
 
 
mapkit-snapshots.js
mapkit-snapshots.js
 
 
null-island.geojson
null-island.geojson
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
readme.md
readme.md
 
 

Repository files navigation

Maps Web Snapshot

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):
    • Now Available: Image Annotations on Maps Web Snapshots

Usage

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

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
}

Apple MapKit JS Examples

This repo shows working samples of Maps Web Snapshots and Node JS sample code for generating the proper URLs to use in your applications.

Snapshot Parameters or Documenation from Create a Maps Web Snapshot Parameter examples
center - The center of the map. You can specify center as coordinates or as an address.
signIt("center=0,0")
signIt("center=37.839622,-119.515182")
signIt("center=San%20Diego,%20California")
size & scale - size - The width and height must be within the range of [50, 640]. Default: 600x400. scale - The pixel density of the image. scale=2 returns an image intended for 2× Retina displays.
signIt("center=San%20Diego,%20California&scale=1")
signIt("center=San%20Diego,%20California&scale=2")
t - The map type. Possible values: standard, hybrid, satellite, mutedStandard
signIt("center=37.839622,-119.515182&t=standard")
signIt("center=37.839622,-119.515182&t=hybrid")
signIt("center=37.839622,-119.515182&t=satellite")
signIt("center=37.839622,-119.515182&t=mutedStandard")
signIt("center=San%20Diego,%20California&t=standard")
signIt("center=San%20Diego,%20California&t=hybrid")
signIt("center=San%20Diego,%20California&t=satellite")
signIt("center=San%20Diego,%20California&t=mutedStandard")
colorScheme - The color scheme of the map. Possible values: light, dark. The dark color scheme only applies to the standard and mutedStandard map types.
signIt("center=San%20Diego,%20California&t=standard&colorScheme=light")
signIt("center=San%20Diego,%20California&t=standard&colorScheme=dark")
signIt("center=San%20Diego,%20California&t=mutedStandard&colorScheme=light")
signIt("center=San%20Diego,%20California&t=mutedStandard&colorScheme=dark")
z - The zoom level of the map.
signIt("center=37.839622,-119.515182&z=15")
signIt("center=37.839622,-119.515182&z=14")
signIt("center=37.839622,-119.515182&z=13")
signIt("center=37.839622,-119.515182&z=12")
signIt("center=37.839622,-119.515182&z=11")
signIt("center=37.839622,-119.515182&z=10")
signIt("center=37.839622,-119.515182&z=9")
poi - A Boolean value indicating whether points of interest are shown on the map.
signIt("center=San%20Francisco,%20California&t=mutedStandard&poi=0")
signIt("center=San%20Francisco,%20California&t=mutedStandard&poi=1")
lang - The language to be used for labels on the map, Supported values are in locale IDs, such as en-GB or es-MX.
signIt("center=37.839622,-119.515182&z=3&lang=ar-AR")
signIt("center=37.839622,-119.515182&z=3&lang=de-DE")
signIt("center=37.839622,-119.515182&z=3&lang=en-US")
signIt("center=37.839622,-119.515182&z=3&lang=es-MX")
signIt("center=37.839622,-119.515182&z=3&lang=es-ES")
signIt("center=37.839622,-119.515182&z=3&lang=el-GR")
signIt("center=37.839622,-119.515182&z=3&lang=fi-FI")
signIt("center=37.839622,-119.515182&z=3&lang=fr-FR")
signIt("center=37.839622,-119.515182&z=3&lang=ja-JA")
signIt("center=37.839622,-119.515182&z=3&lang=hu-HU")
signIt("center=37.839622,-119.515182&z=3&lang=it-IT")
signIt("center=37.839622,-119.515182&z=3&lang=ko-KO")
signIt("center=37.839622,-119.515182&z=3&lang=nl-NL")
signIt("center=37.839622,-119.515182&z=3&lang=no-NO")
signIt("center=37.839622,-119.515182&z=3&lang=he-HE")
signIt("center=37.839622,-119.515182&z=3&lang=hi-IN")
signIt("center=37.839622,-119.515182&z=3&lang=pt-BR")
signIt("center=37.839622,-119.515182&z=3&lang=ru-RU")
signIt("center=37.839622,-119.515182&z=3&lang=tr-TR")
signIt("center=37.839622,-119.515182&z=3&lang=vi-VI")
signIt("center=37.839622,-119.515182&z=3&lang=zh-ZH")
annotations - Example of Annotations . The array of JSON Annotation, which draws 3 points: a red dot, a green balloon, & blue large annotations, is shown [{"point":"32.73,-117.19", "color":"blue", "glyphText":"A", "markerStyle":"large"},
{"point":"32.71,-117.17", "color":"00ff00","glyphText":"9", "markerStyle":"balloon"},
{"point":"32.69,-117.16", "color":"red", "glyphText":"a", "markerStyle":"dot"}
]
Live example of Annotations signIt("center=San%20Diego,%20California&<urlEncoded Annotations>")
overlays - Example of Overlays. The array of JSON Overlay objects, which draws a red dashed line over 3 points, is shown:
[{"points":["32.73,-117.19","32.71,-117.17","32.69,-117.16"],
"strokeColor":"ff0000","lineWidth":2,"lineDash":[10,5]}
]
Live example of Overlays signIt("center=San%20Diego,%20California&<urlEncoded Overlay>")
Live example of Annotations & Overlays, together signIt("center=San%20Diego,%20California&<urlEncoded Annotation & Overlay>")

Release Log

  • 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

About

Create static maps 🗺 for Apple Maps using the Maps Web Snapshots announced at WWDC 2019.

RobLabs.com/apple-maps-web-snapshot-cli

Topics

apple-mapsmapkitmapkit-jsnodestatic-maps

Resources

Readme
License
Activity

Stars

11 stars

Watchers

2 watching

Forks

4 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.