Communitygithub.com

map-animation

Create map animations with real satellite imagery: geographical science, telling a story with a river, road, or line, travel routes, historical military routes. Helps users write scripts (each sentence with a place name or number), synchronize to voiceover, animate camera flight, line growth, place names and numbers appearing with the narration, and output MP4. Triggered when the user mentions 'map animation', 'satellite map animation', 'map animation skill', 'use a map to tell a story about...', or 'make an animation for a route'.

What is map-animation?

This skill, named 'Map Animation', enables the creation of high-quality, narrated map animations using real satellite imagery and true terrain data. It is designed for developers and content creators who want to produce educational, travel, or historical route animations with precise synchronization to a voiceover. The skill handles three main tasks: script writing, video generation, and video editing. It uses a combination of Node.js scripts to align text with audio, geocode locations, fetch real geographical data from OpenStreetMap (OSM), compute routes, and render final videos using Mapbox or Esri satellite tiles. Key constraints include never drawing political boundaries (to avoid map errors) and using only real satellite images, not AI-generated ones. The output is a high-resolution MP4 video with optional subtitles (SRT). The skill supports platforms like Claude Code, Cursor, Codex, and similar AI agents that can execute local scripts and interact with file systems. Its unique value lies in its rigorous adherence to geographical accuracy and dynamic visual storytelling, where each sentence in the script corresponds to a specific camera movement or on-screen annotation.

Works with~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/changkun831019/map-animation-skill/tree/HEAD

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

Map Animation Skill

Use real satellite imagery and real terrain to create map animations that follow a voiceover. Three tasks: script writing, video creation, and video editing.

Before starting, read two hard constraints (details in references/compliance.md):

  1. Do not draw national borders, province borders, or any administrative boundaries. Do not color countries or provinces. A wrong Chinese map is a "problem map"; posting maps online requires review anyway. When the user wants a national map, tell them to use the standard map from the Ministry of Natural Resources (bzdt.ch.mnr.gov.cn), display it as-is, and include the review number. This skill does not draw such boundaries.
  2. Use only real satellite imagery, not AI-generated "satellite images." AI-drawn rivers, coastlines, and city locations are often fabricated.

First time using, run node <skill directory>/scripts/setup.mjs: it checks Node, Chrome, ffmpeg, installs dependencies, and tests network and GPU. If anything is missing, follow its prompts to install, then run it again.

Project Folder

Create a folder under the user's current directory: MapAnimation/<Topic>/, one folder per video:

script.txt      Narration, one sentence per line
sources.md      Source for every number and statement
plan.md         What visuals accompany each sentence
voice.mp3       User's voiceover (wav, m4a also accepted)
timings.json    Start and end of each sentence in the audio (generated by align.mjs)
film.json       Visual script (you write this)
data/           GeoJSON for routes, rivers, lakes
out/            Final video, subtitle file, still frames

1. Script Writing

User says "Write an X-second script about...". Rules are in references/writing.md; the most important ones:

  • Each sentence should preferably contain a place name or a number: a place name means a camera shot, a number means a big on-screen label.
  • Keep sentences under 20 characters, like natural speech; each sentence should answer the question left by the previous one.
  • Roughly 4.5 characters per second: 40 seconds ≈ 180 characters, 12 to 15 sentences.
  • Verify numbers first (search, at least one reliable source), write into sources.md. If unverifiable, don't include.
  • If the topic touches borders, territorial matters, current politics, or military installations, rephrase or advise the user to change the topic.

After writing, show the script to the user, and also provide a plan.md: one line per sentence describing the visuals. Then tell the user next step:

Record the voiceover according to the script, pause half a second between sentences, put the recorded file into this folder (mp3, wav, m4a are all fine), then say "Use this voiceover to make the video."

2. Video Creation

User says "Use this voiceover to make the video" (may specify aspect ratio, e.g., "4:3 landscape" or "portrait"). Follow in order:

  1. Align timings: node scripts/align.mjs project/voice.mp3 project/script.txt
    • Check the printed table. Sentences marked as "estimated" or "wrong pacing" are likely where there was no pause.
    • If deviations are large, ask the user to pause more between those sentences and re-record; if small, you can hand-edit timings.json.
  2. Find coordinates and data:
    • Place coordinates: node scripts/geocode.mjs "Place1" "Place2" --country cn (for locations in China add --country cn, otherwise it might look up Japanese places).
      • Searching for a city name returns the administrative center, not necessarily the city center; for the city center, search for "City People's Government" or a landmark in the city.
      • For hard-to-find project names (e.g., "Taocha Canal Head"), try an alternative name, or retrieve the point from OSM data.
    • Real lines like rivers, lakes, canals, railways:
      • First node scripts/osm.mjs find --bbox south,west,north,east to find the exact name in a small area.
      • Then use osm.mjs line … (line) or osm.mjs area … (lake, reservoir) to fetch.
    • Travel routes: node scripts/route.mjs --via "A;B;C" --mode road|flight|straight.
    • All commands are documented at the top of each script.
  3. Write film.json:
    • Format in references/film-spec.md, can adapt from examples/beijing-water/film.json.
    • Use time expressions like "sentence number" ("s3", "s3.end", "s3+0.4"), so you don't have to recalculate after changing the audio.
  4. Verify the route: node scripts/render.mjs project/film.json --probe. It prints the camera position every half second and how many kilometers along the route, matching the narration: when a place is mentioned, the waterdrop should be right there.
  5. Render still frames for review: node scripts/render.mjs project/film.json --stills s1,s2.mid,s5,…
    • At least one per sentence, plus opening and closing.
    • Look at out/stills/contact_sheet.jpg, check against the "Visual Rules" below:
      • Is the place name in the right place?
      • Are the characters overlapping each other or covering the route?
      • Any blank areas, seams, or blurry spots?
      • Are numbers and units correct?
    • If problems, edit film.json and re-render until every frame is correct.
  6. Render the video:
    • node scripts/render.mjs project/film.json renders at 1080p; for 4K add --4k.
    • To quickly preview the motion, use --preview.
    • After rendering, run node scripts/check.mjs project/out/video_name.mp4 to check for blurry or dropped frames.
  7. Delivery:
    • Tell the user where the final video is, its duration, and how long this render took.
    • The subtitle file out/video_name.srt can be imported into editing software for adjustments.
    • The bottom-right corner already has automatic attribution of satellite image and data sources; do not remove them.

3. Video Editing

User says things like "Slow down the Yellow River part" or "Make the place name bigger":

  • Only edit the corresponding parts in film.json.
  • First render a few seconds of still frames for confirmation, then re-render the full video.
  • Do not change anything else.

Visual Rules (Use these when composing shots)

Opening (Sentence 1)

  • The first frame should be the beautiful subject: the lake, the city, the start of the route. Do not start with an empty view.
  • Zoom around 9, pitch 50–60, camera slowly rotates 2–4 degrees.
  • Highlight the subject with areas, and the place name appears 0.3 seconds after sentence 1 starts.

Move Only One Thing at a Time

  • When the camera is making a large movement, do not introduce new text simultaneously.
  • Place names appear exactly when the narration says them, maximum two at a time.
  • Numbers appear after the camera stabilizes, counting up from 0, finishing in 0.6–0.8 seconds.

Routes and Camera

  • The route starts growing on the sentence that says "depart." The tip of the line has a glowing waterdrop.
  • Use draw's anchor points so the waterdrop reaches a certain place exactly when the narration mentions it, e.g., ["s13", "113.25,34.88"].
  • When following the route, use follow:
    • For long distances, zoom out (6.5–7.5) to show the whole journey;
    • When arriving, zoom in (8.5–9.5);
    • Set bearing to the direction of travel so the route grows upward on screen.
  • For underground or tunnel sections, use dashed lines; the waterdrop will automatically dim.

Clarity and No Seams

  • When using Esri satellite imagery, default maxzoom is 11; camera zoom should not exceed 9.5, so 4K output remains clear.
  • For close-ups of city blocks (zoom above 12):
    • Set "maxzoom": 16 on the camera keyframes for that section; only that part uses high-resolution tiles, other shots unaffected;
    • Keep pitch below 40 to avoid visible seams between near and far photos;
    • On the last keyframe of the close-up, set "maxzoom" back to 11.

Non-Stop Ending

  • After arrival, continue pushing the camera in slowly by about 0.5 zoom; the last keyframe should be at the end of the video.
  • Leave 1.5 seconds at the end.

Aspect Ratio

  • Default to 16:9 if user doesn't specify.
  • For portrait mode (9:16), place text in the middle third of the screen (leaving at least 250 pixels above and below), and no text in the bottom-right corner.

Subtitles

  • By default, do not burn subtitles into the video; only output an .srt file for the user to add in editing software.
  • If the user wants them burned in, set "subtitles": true.

More pitfalls in references/pitfalls.md.

One-Sentence Test of Quality

  • Every time a place is mentioned, that place lights up on screen, or the camera arrives there.
  • Even on mute, the viewer can understand the story.
  • No national borders, province borders, or AI-generated fake maps.

Related Skills