S
S
Stalker_darkway2016-03-22 17:01:51
PHP
Stalker_darkway, 2016-03-22 17:01:51

How is autocompletion implemented in 2Gis Api?

Hello. Not sure if the tags are correct.
We need a map and a calculator for a site with a taxi, and Api 2Gis was chosen for implementation.
Can you tell me who worked with him? Is it possible to autocomplete addresses on a clean front-end without a database connection and without PHP?
Thanks in advance for your replies.
You can throw a slipper at me for the fact that at the moment there is still little insight into the issue and little Google.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mikhail Reenko, 2016-03-31
@hronik87

API 2GIS documentation is available at
api.2gis.ru/doc/maps/quickstart
For many functions, you need to have a personal key (must be written in the TP)
To get the suggestions, an AJAX request is enough, for example
returns the next object

{
  "meta": {
    "code": 200,
    "api_version": "2.0.1.3.9",
    "issue_date": "20160331"
  },
  "result": {
    "total": 10,
    "items": [{
      "hint": {
        "text": "ленина, 12",
        "highlighted_text": [{
          "style": "normal",
          "text": "ленина, 12"
        }]
      }
    }, {
      "hint": {
        "text": "ленина, 1",
        "highlighted_text": [{
          "style": "normal",
          "text": "ленина, 1"
        }]
      }
    }, {
      "hint": {
        "text": "ленина, 18",
        "highlighted_text": [{
          "style": "normal",
          "text": "ленина, 18"
        }]
      }
    }, {
      "hint": {
        "text": "ленина 12 новосибирск",
        "highlighted_text": [{
          "style": "highlighted",
          "text": "ленина 1"
        }, {
          "style": "normal",
          "text": "2 новосибирск"
        }]
      }
    },
...
 {
      "hint": {
        "text": "ленина, 19",
        "highlighted_text": [{
          "style": "normal",
          "text": "ленина, 19"
        }]
      }
    }]
  }
}

D
Dimon Durak, 2016-04-01
@dimon_durak

Here is another service that can help - dadata.ru

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question