SuperAPI AI Directory

bmap-jsapi-gl

Frontend & websites

View repository

Updated 10-15 18:46

About this skill

JSAPI GL Development Guide

Development guide for the Baidu Map JSAPI WebGL version. It includes API descriptions and code examples for core modules such as map initialization, overlays, events, and layers, aiming to help developers quickly integrate Baidu Map and follow the correct usage methods.

When to Apply

Refer to these guides in the following scenarios:

  • Create a new map page or component
  • Add overlays such as markers, polylines, and polygons to the map
  • Handle map interaction events (click, drag, zoom, etc.)
  • Configure map styles or switch layers
  • Debug map rendering or performance issues

Quick Reference

0. Basic Concepts

  • references/base-classes.md - Basic classes: Point, Bounds, Size, Pixel, Icon
  • references/constants.md - Common constants: search status codes, POI types

1. Map

  • references/map-init.md - Map initialization: resource import, instance creation, configuration options, interaction and view control

2. Map Overlays

  • references/overlay-common.md - Common overlay operations: add/remove, show/hide, batch clear
  • references/marker.md - Marker: constructor parameters, position/icon/rotation/top/drag methods
  • references/polyline.md - Polyline: constructor parameters, line style, coordinate operations, edit mode
  • references/polygon.md - Polygon: constructor parameters, border/fill style, polygon with holes, edit mode
  • references/circle.md - Circle: constructor parameters, center point/radius, style settings, edit mode
  • references/custom-overlay.md - Custom overlay: DOM creation, property passing, event binding, rotation control
  • references/info-window.md - Info window: constructor parameters, content/size settings, maximize, use with Marker

3. Events

  • references/map-events.md - Map events: binding methods, interaction events, view change events, lifecycle events
  • references/overlay-events.md - Overlay events: common events, drag events, vector graphic events

4. Map Styles

  • references/map-style.md - Personalized map: customize map appearance (color, visibility) to achieve effects such as dark theme and minimalist map

5. Layer Services

  • references/xyz-layer.md - Third-party layers: load XYZ/TMS/WMS/WMTS standard tiles
  • references/mvt-layer.md - Vector tiles: load MVT/PBF format tiles, support style expressions, feature interaction, state management

6. Route Planning

  • references/route-common.md - Common configuration: constructor parameters, rendering options, callback functions, data structures, status constants
    • references/driving-route.md - Driving: strategy enums, waypoints, traffic conditions, tolls, dragging
    • references/walking-route.md - Walking: turn types, dragging
    • references/riding-route.md - Riding: riding search
    • references/transit-route.md - Transit: intra-city/inter-city strategies, transportation modes, transfers

7. Other LBS Services

  • references/local-search.md - Local search: normal/range/nearby search, result processing, pagination, POI data structure
  • references/geocoder.md - Geocoding: forward geocoding (address→coordinates), reverse geocoding (coordinates→address)
  • references/convertor.md - Coordinate conversion: convert GPS/Amap/Google coordinates to Baidu coordinates

How to Use

Please read the reference files for detailed explanations and code examples:

references/map-init.md

Each reference file contains:

  • Brief function description
  • Complete code example and explanation
  • API parameter description and notes

Notes

  • references/get-ak.md - Obtain the key (AK): When the user has no AK or the AK is invalid, guide the user to the console to apply for a browser-side type AK