Autocomplete (JSONP)

There is a new version of the autocomplete available. Please use version 5 of the autocomplete for your future projects.

SmartMaps provides auto-completion for addresses. While you start typing an address in the example below, suggestions of addresses appear, which can be transferred to the form field by selection.

The auto-completion interface can be accessed via JSONP or via protobuf.

This example is complete; you can save it locally and run it in an http context. You only have to replace the value for the apiKey.

SmartMaps map


Code example: autocomplete

<!DOCTYPE html>

<head lang="en">
  <meta charset="UTF-8">
  <title>Autocomplete (JSONP)</title>

  <div id="map-wrapper">
    <form class="float">
      <input id="Autocomplete" class="ym-search" type="search" placeholder="Search">
    <div id="map" style="z-index: 0"></div>

  <!-- SmartMaps-API -->
  <script src="{API_KEY}"></script>
    ym.ready(function(modules) {

      // Define map.
      var map ="map", {
        center: ym.latLng(49.021273, 8.439316),
        zoom: 14

      var geocoder = new;
      geocoder.on('success', function(req, res) {
        if (res.body && res.body.features && res.body.features.length) {

      var autoComplete = modules.autoComplete("#Autocomplete", {
        dataType: "jsonp",
        locales: ['DE'],
        // Function is called as soon as an entry is selected from the list.
        onSelected: function(geoJson) {