amap-jsapi-skill

Configure AMap JSAPI v2.0 WebGL maps with secure loading and lifecycle management.

2|Updated Apr 6, 2026
One-click install
npx skills add https://github.com/augustscl/awesome-xiawang-skills --skill amap-jsapi-skill
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: amap-jsapi-skill
Source: https://github.com/augustscl/awesome-xiawang-skills/tree/main/amap-jsapi-skill
Command: npx skills add https://github.com/augustscl/awesome-xiawang-skills --skill amap-jsapi-skill

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides concise, developer-focused guidance to securely integrate and use AMap JSAPI v2.0 (WebGL) in web applications, removing common pitfalls like incorrect loader usage, missing security configuration, WebGL memory leaks, and inefficient plugin loading. It helps teams avoid map white-screens, authentication errors, and performance regressions when building interactive 2D/3D mapping features.

Core Features & Use Cases

  • Initialization and loader usage: asynchronous AMapLoader integration and recommended loader parameters for version 2.0.
  • Mandatory security setup: how to configure window._AMapSecurityConfig, recommended proxy/ serviceHost patterns for production, and server-side proxy examples.
  • View & lifecycle management: 3D view controls (zoom, pitch, rotation), map creation and destroy patterns to avoid WebGL memory leaks.
  • Overlays & vector graphics: Markers, LabelMarker, Polylines, Polygons, Circles and editors for drawing and editing geometries.
  • Layer management & custom rendering: using official tile layers, LabelsLayer, CanvasLayer, ImageLayer and GLCustomLayer (Three.js integration) for custom 3D scenes.
  • LBS services & routing: Geocoder, PlaceSearch, Driving/Walking/Riding/Transfer examples and how to render route results.
  • Best practices: security-first deployment, per-plugin on-demand loading, resource release (map.destroy()), and performance tips for large datasets.

Quick Start

Before calling the loader, set window._AMapSecurityConfig with your securityJsCode, then call AMapLoader.load with your Web Key, version '2.0', and required plugins to initialize a 3D map.

Frequently Asked Questions about amap-jsapi-skill

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I configure AMap JSAPI securityJsCode to prevent authentication errors in web maps?

To configure AMap JSAPI securityJsCode, set window._AMapSecurityConfig before loading the library, using a proxy or serviceHost pattern for production to prevent authentication errors and map white-screens.

What's the best way to initialize AMap JSAPI v2.0 asynchronously without blocking page render?

The best way to initialize AMap JSAPI v2.0 asynchronously is using AMapLoader.load, passing your Web Key, version '2.0', and required plugins to ensure non-blocking page render and proper setup.

How do I avoid WebGL memory leaks when destroying 3D maps in AMap JSAPI?

To avoid WebGL memory leaks in AMap JSAPI, call map.destroy() during view lifecycle management to properly release WebGL contexts and resources when 3D maps are no longer needed.

Can I integrate Three.js custom 3D layers with AMap JSAPI v2.0?

Yes, you can integrate Three.js with AMap JSAPI v2.0 using GLCustomLayer for custom 3D scenes, allowing custom rendering alongside official tile layers, CanvasLayer, and ImageLayer.

How do I optimize AMap plugin loading performance for large dataset LBS features?

To optimize AMap plugin loading performance, use per-plugin on-demand loading through AMapLoader instead of bulk loading, reducing overhead when rendering large datasets and LBS features.

Why does my AMap JSAPI map show a white screen after deploying to production?

An AMap JSAPI white screen in production usually indicates missing or incorrect window._AMapSecurityConfig setup, requiring a server-side proxy or serviceHost pattern to securely handle the securityJsCode.