# mapbox

## mapcreation

* Container is the id of the div in the code to put the map in
* All coords are \[long, lat]

```typescript
this.map = new mapboxgl.Map({
  container: 'map',
  style: 'mapbox://styles/trinakat/cjasrg0ui87hc2rmsomilefe3', // UCLA Campus Buildings (restricted by the border)
  // 'mapbox://styles/trinakat/cjashcgwq7rfo2srstatrxhyi', // UCLA Buildings
  // 'mapbox://styles/helarabawy/cj9tlpsgj339a2sojau0uv1f4',
  center: [this.lng, this.lat],
  maxBounds: [[-118.46, 34.056],[-118.428, 34.079]],
  zoom: 15,
  pitch: 60
});
```

## Events

`map.loaded()` return boolean is loaded

```typescript
  on(type, listener)
  off(type, listener)
  once(type, listener)
  fire(type, data?)
  listens(type)
```

## Obscure Bug

Are you getting NO MAP GL JS found, but copied the link exactly like they had it. Well then, here is the real link from the example.

```typescript
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.44.1/mapbox-gl.css' rel='stylesheet' />
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://openai.gitbook.io/code-cheatsheets/js/webjs/packages/mapbox.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
