📜 ⬆️ ⬇️

2GIS API updates: static maps, revised marker and balun, documentation improvements and speed

Perhaps you have already heard about API 2GIS, but even if not, then it does not matter. Indeed, in this post we will look at all the API updates over the past couple of months.



Static Maps API

Let's start with the recently appeared Static Maps API. It allows you to place on web pages a static image from 2GIS maps, without the need to use JavaScript. This is done via the http request, in response to which an image comes with a map fragment and other elements specified by the request.

The main field of application of the Static Maps API is mobile websites. For example, the mobile version of our Flamp review service is already using the Static Maps API. And now you can add an image with a map to your site! Like this:
')
image

New features and improved card convenience

We have significantly reworked the most popular parts of the API - markers and baluns . If you do not understand what this is about, we will explain: the markers are those very things (usually orange) that point to a particular object on the map. A balun is what appears when you click on a marker, a bubble with text (as in comics).

And that's what changed. Balun appeared: resizing method, drag and drop, forced redraw method. In markers: methods for moving, the ability to dynamically change the icon, the ability to set the scope for the click handler. The new class DG.Markers.MarkerWithBalloon implements a bunch of marker with a balun.

Performance and fault tolerance improved too

One of the most important focuses in the development of the reference API for us is fast and stable work. In February and March we significantly improved these important technical indicators. So, the uptime exceeded 99.9. And the search methods began to work even faster - now even the “heaviest” requests are executed on average within 200 ms. Company card requests - 50 ms.

New organizations every day

We already had a couple of publications on this topic, but it can be repeated here - API 2GIS switches to daily updates. At the moment, this applies to Novosibirsk , Moscow and Yekaterinburg , but will gradually spread to other cities.

2GIS Online switched to the public API version

If before 2GIS Online went ahead of the public API and could contain any features that were inaccessible to partners, now they are equal in status. From now on, 2GIS Online works on the public 2GIS API, in fact, being a standard partner of the API of maps and the Transport API (it passed to the API API before). Therefore, almost everything that you see in 2GIS Online can be recreated on your resource as part of an affiliate program. And if you do not know how to do this, and the documentation does not help, then do not hesitate to contact us at api@2gis.ru , and you will definitely be helped. By the way, we continue to collect preliminary applications for the Transport API, which will be available soon.

Even our site has not escaped the update.

In particular, the “Solutions” page was supplemented with new examples, the “Features and Benefits” page became more beautiful, and the first examples appeared in the API documentation for maps (soon there will be more). And for the API of the reference book - recommendations on the design of reference sections . Oh yeah - if you haven’t found something, we’ll be happy to add it. Write to us if, in your opinion, there are not enough examples of the implementation of something concrete. And if you have your own example, which you are ready to share, we will be happy to add it to the site.

More details about the 2GIS API can be found here: api.2gis.ru

Source: https://habr.com/ru/post/140779/


All Articles