A browser-based HD map editor for the Apollo autonomous driving platform. Draw lanes, junctions, signals, and all other map elements visually, then export Apollo-compatible binary map files directly from your browser β no C++ toolchain required.
Apollo requires three binary map files to operate:
| File | Purpose |
|---|---|
base_map.bin |
Full HD map with all elements and metadata |
sim_map.bin |
Downsampled version for Dreamview visualization |
routing_map.bin |
Topological graph used by the routing module |
Traditionally, generating these files requires the Apollo C++ build environment. Apollo Map Studio replaces that entire workflow with a web app β open it in a browser, draw your map, click Export.
- Interactive drawing β lanes, junctions, crosswalks, signals, stop signs, speed bumps, clear areas, parking spaces
- Real-time boundary rendering β left/right lane boundaries computed and rendered as you draw, with correct dash styles per boundary type
- Lane topology editor β connect predecessor/successor lanes, set left/right neighbors
- Properties panel β edit speed limit, lane type, turn direction, boundary types per element
- Binary export β produces all three Apollo
.binfiles in the browser via protobufjsbase_map.binwith full overlap computation (lane β signal, crosswalk, junction, etc.)sim_map.binusing the same downsampling algorithm assim_map_generator.ccrouting_map.binwith node/edge costs matchingtopo_creatorexactly
- Binary import β load an existing
base_map.binand continue editing it - Undo / Redo β full history via Zustand temporal middleware
- Layer toggles β show/hide any element type
- Offline capable β blank map background, no tile server or external API needed
| Concern | Library |
|---|---|
| Map rendering | MapLibre GL |
| Drawing tools | @mapbox/mapbox-gl-draw |
| Spatial math | @turf/turf |
| Protobuf encode/decode | protobufjs |
| Coordinate projection | proj4 (WGS84 β ENU) |
| State management | Zustand + immer + zundo |
| Build | Vite + TypeScript |
# Clone and install
git clone https://github.com/SakuraPuare/apollo-map-studio
cd apollo-map-studio
npm install
# Start dev server
npm run devOpen http://localhost:5173 in your browser.
- Click New Project, enter a name and the origin coordinates (lat/lon) of your map area
- Select Draw Lane from the toolbar and click to place lane centerline points
- Double-click to finish drawing a lane
- Use the Properties panel on the right to set speed limit, type, boundary styles, etc.
- Select Connect Lanes to link predecessor/successor relationships between lanes
- Add junctions, signals, crosswalks, etc. using the corresponding toolbar buttons
- Click Export to download
base_map.bin,sim_map.bin, androuting_map.bin
Click Import and drop a base_map.bin file. The editor will decode it and restore all elements for further editing.
src/
βββ types/
β βββ apollo-map.ts # Apollo proto type mirrors (Map, Lane, Road, ...)
β βββ apollo-routing.ts # Routing graph types (TopoNode, TopoEdge, ...)
β βββ editor.ts # GeoJSON-based editor types (LaneFeature, ...)
β
βββ store/
β βββ mapStore.ts # Map element state + actions (Zustand + immer + undo)
β βββ uiStore.ts # Draw mode, selection, layer visibility
β
βββ geo/
β βββ projection.ts # proj4: WGS84 β ENU coordinate conversion
β βββ laneGeometry.ts # turf: boundary offset, width sampling, headings
β βββ overlapCalc.ts # turf: lane/element intersection β Overlap proto
β
βββ proto/
β βββ loader.ts # protobufjs: dynamic .proto loading
β βββ codec.ts # encode/decode Map + Graph, download as .bin
β
βββ export/
β βββ buildBaseMap.ts # Assemble full Apollo Map proto object
β βββ buildSimMap.ts # Downsample (port of sim_map_generator.cc)
β βββ buildRoutingMap.ts # Build topo graph (port of topo_creator)
β
βββ import/
β βββ parseBaseMap.ts # Decode base_map.bin β editor GeoJSON state
β
βββ components/
βββ MapEditor/ # MapLibre GL container, draw control, layer rendering
βββ Toolbar/ # Draw mode buttons
βββ PropertiesPanel/ # Per-element attribute forms
βββ NewProjectDialog/ # Project name + origin coordinate setup
βββ ExportDialog/ # Export all three .bin files
βββ ImportDialog/ # Import base_map.bin
βββ StatusBar/ # Status messages and undo/redo controls
public/proto/ # Apollo .proto files served statically
The export engine is a direct port of the Apollo C++ source:
sim_map.binβ replicates theDownsampleByAngle+DownsampleByDistancepasses frompoints_downsampler.hrouting_map.binβ replicates node/edge cost formulas fromnode_creator.ccandedge_creator.cc:- Node cost:
length Γ β(base_speed / speed_limit)+ turn penalty - Lane-change edge cost:
500 Γ (changing_length / 50)^β1.5 - Lane changes only allowed across dotted boundaries
- Node cost:
npm run dev # start dev server with HMR
npm run build # production build
npm run lint # ESLint check
npm run lint:fix # ESLint auto-fix
npm run format # Prettier format all files
npm run format:check # Prettier check (CI)Pre-commit hooks (Husky + lint-staged) run ESLint and Prettier automatically on every commit.
- Road grouping UI (assign lanes to named roads)
- Snap-to-endpoint when connecting lanes
- Map validation report (orphan lanes, missing overlaps, ID conflicts)
- OSM tile background option
- Multi-select and bulk property editing
- Export to Apollo text proto format (
.txt) for inspection
MIT