# Meridian > Maps and locations for Ember. `` is a declarative MapLibre GL JS map: a port of > `@vis.gl/react-maplibre` to Ember `.gts` components. A provider layer puts geocoding, places, > routing, elevation, time zone, static maps and IP location behind small interfaces, and > `defineMeridian` selects one provider for each. UI components give place autocomplete, a > geocoder control and directions. Install `@meridian-ts/ember` and `maplibre-gl`. For the provider layer, add `@meridian-ts/core` and one adapter package for each provider: `@meridian-ts/nominatim`, `@meridian-ts/photon`, `@meridian-ts/pelias`, `@meridian-ts/valhalla`, `@meridian-ts/stadia`, `@meridian-ts/maptiler`, `@meridian-ts/mapbox`, `@meridian-ts/google`, `@meridian-ts/here`, `@meridian-ts/esri` and `@meridian-ts/aws`. Optional packages: `@meridian-ts/draw` (terra-draw) and `@meridian-ts/deck` (deck.gl and H3). Requirements: Ember 5.12 or later, Vite with Embroider, `maplibre-gl` 5 or later. Guide: https://joegaudet.com/meridian/guide/ Source: https://github.com/joegaudet/meridian ## Rules for writing code with Meridian 1. The root component is `MeridianMap`, not `Map`: the name `Map` hides the JavaScript global in a `.gts` file. Import it from `@meridian-ts/ember`. 2. Use the components that the block yields: `` gives `map.Source`, `map.Layer`, `map.Marker`, `map.Popup`, `map.Cluster`, `map.Control`, the built-in controls (`map.NavigationControl`, `map.GeolocateControl`, `map.FullscreenControl`, `map.ScaleControl`, `map.AttributionControl`, `map.TerrainControl`, `map.LogoControl`, `map.GlobeControl`), `map.GeocoderControl` and `map.Directions`. 3. The template is the state of the map. To remove a layer, source, marker, popup or control, remove its component from the template, for example with `{{#if}}`. Do not call `addLayer` or `removeLayer` for a thing that a component owns. 4. Give the map element a height, for example `style="height: 400px"`. The block renders after the style loads; use the `:loading` block before that. 5. `` yields ``, which has the source already. A `` needs `@source`. Ids are optional. 6. Layer events are arguments on the layer: `@onClick`, `@onMouseEnter`, `@onMouseLeave`. Do not set `interactiveLayerIds`. 7. The camera is uncontrolled with `@initialViewState`, or controlled with `@viewState` and `@onMove`. The move event has `viewState`. 8. A view state uses `lng` and `lat` (or `longitude` and `latitude`), `zoom`, `bearing` and `pitch`. Build one in a template with `(hash lng=-123.12 lat=49.28 zoom=11)`. 9. Coordinates in arguments accept `{ lat, lng }`, `{ lat, lon }`, `{ latitude, longitude }` and `[lng, lat]`. Coordinates in results are always `{ lat, lng }`. 10. For imperative calls, use `map.instance` in the block or the map that `@onLoad` sends. There is no map service. 11. For a control from a plugin, use ``. With a block and no `@create`, the block is the content of a custom control. 12. For a custom protocol, use `@protocols`, for example `(hash pmtiles=this.protocol.tile)` with a `Protocol` from the `pmtiles` package. There is no Meridian package for PMTiles. 13. Select providers one time with `defineMeridian({ geocoding, places, routing, elevation, timezone, staticMap, ipLocation })` from `@meridian-ts/core`, and export the result. Call `meridian.geocoding.forward(...)`, not the adapter directly. 14. An adapter has only the functions that its provider has. Use `meridian.supports('geocoding.autocomplete')` before you show a feature. A call to an absent function rejects with `UnsupportedCapabilityError`. 15. Never put a secret key in the client code. Each adapter accepts a public key, or `baseUrl` for a proxy on your server; with `baseUrl` the adapter sends no key. 16. Each provider function accepts `signal` (an `AbortSignal`) in its options. In a template, use `query` from `@meridian-ts/ember` for `value`, `isLoading` and `error`. 17. `` needs `@provider` (an object with `autocomplete`, for example `meridian.geocoding`) or `@search`, and `@onSelect`. Nominatim, Google and Esri have no `geocoding.autocomplete`. 18. `` needs `@provider` (for example `meridian.routing`) and `@waypoints`. It draws the route and yields `routes`, `route`, `select`, `isLoading` and `error`. `` shows the steps. 19. The UI components have no styles by default. For the optional theme, import `@meridian-ts/ember/theme.css`. 20. `` (from `@meridian-ts/draw`) and `` (from `@meridian-ts/deck`) are not yielded by the map. Pass them the yielded value: ``. 21. Read the warning in the README of `@meridian-ts/google` before you use Google content with a MapLibre map. ## Example ```gts import { MeridianMap } from '@meridian-ts/ember' import { hash } from '@ember/helper' import { meridian } from '../meridian' const stops = [ { lat: 49.3043, lng: -123.1443 }, { lat: 49.2734, lng: -123.1039 }, ] ``` ```ts // app/meridian.ts import { defineMeridian } from '@meridian-ts/core' import { photon } from '@meridian-ts/photon' import { valhalla } from '@meridian-ts/valhalla' export const meridian = defineMeridian({ geocoding: photon(), routing: valhalla({ url: 'https://valhalla.example.com' }), }) ```