---
layout: example
category: example
title: Add a geocoder
description: 'Use the <a target="_blank" href="https://github.com/mapbox/mapbox-gl-geocoder">mapbox-gl-geocoder</a> control to search for places using Mapbox Geocoding API.'
tags:
  - controls-and-overlays
---
<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v{{site.data.plugins.mapbox-gl-geocoder.latest}}/mapbox-gl-geocoder.js'></script>
<link rel='stylesheet' href='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v{{site.data.plugins.mapbox-gl-geocoder.latest}}/mapbox-gl-geocoder.css' type='text/css' />
<div id='map'></div>

<script>
var map = new mapboxgl.Map({
    container: 'map',
    style: 'mapbox://styles/mapbox/streets-v9',
    center: [-79.4512, 43.6568],
    zoom: 13
});

map.addControl(new MapboxGeocoder({
    accessToken: mapboxgl.accessToken
}));
</script>
