{"id":314848,"date":"2020-12-14T15:02:07","date_gmt":"2020-12-14T15:02:07","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=314848"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=314848","title":{"rendered":"JavaScript \u0437\u0430 60 \u0441\u0435\u043a\u0443\u043d\u0434: \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 \u043a\u0430\u0440\u0442\u043e\u0439 (Geolocation API, Leaflet.js, Nominatim)"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ig\/mq\/2d\/igmq2dvqrh3pvqpohaicef0c3zi.png\"><\/p>\n<p>  \u0414\u043e\u0431\u0440\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u0443\u0442\u043e\u043a, \u0434\u0440\u0443\u0437\u044c\u044f!<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u043c \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0435 \u043c\u044b \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0432\u0430\u043c\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0442\u0440\u0438 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0437\u0430\u0434\u0430\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Geolocation API \u0438 Leaflet.js \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u043c \u0435\u0433\u043e \u043d\u0430 \u043a\u0430\u0440\u0442\u0435<\/li>\n<li>\u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0430\u043d\u0438\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043c\u0435\u0436\u0434\u0443 \u0433\u043e\u0440\u043e\u0434\u0430\u043c\u0438<\/li>\n<li>\u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0430\u0434\u0440\u0435\u0441\u0430\u043c\u0438 \u0441 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0438 \u0435\u0433\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442<\/li>\n<\/ul>\n<p>  \u041a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f <a href=\"https:\/\/github.com\/harryheman\/JavaScript-Examples\/tree\/main\/Work-With-Map\" rel=\"nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>  \u041f\u043e\u0438\u0433\u0440\u0430\u0442\u044c \u0441 \u043a\u043e\u0434\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0437\u0434\u0435\u0441\u044c:<\/p>\n<div class=\"oembed\"><iframe id=\"5fd72a41d4323713fd415926\" src=\"https:\/\/embedd.srv.habr.com\/iframe\/5fd72a41d4323713fd415926\"><\/iframe><\/div>\n<p>  <a name=\"habracut\"><\/a>  <\/p>\n<h3>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/h3>\n<p>  <a href=\"https:\/\/developer.mozilla.org\/ru\/docs\/Web\/API\/Geolocation\" rel=\"nofollow\">Geolocation API<\/a> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0441\u0432\u043e\u0435\u043c \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0438. \u0412 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u044d\u0442\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 <a href=\"https:\/\/developer.mozilla.org\/ru\/docs\/Web\/API\/Geolocation\/getCurrentPosition\" rel=\"nofollow\">Geolocation.getCurrentPosition()<\/a>. \u0414\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u0434\u0438\u043d \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0438 \u0434\u0432\u0430 \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430: success \u2014 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430, \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0449\u0430\u044f \u043e\u0431\u044a\u0435\u043a\u0442 Position \u043f\u0440\u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f, error \u2014 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430, \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0449\u0430\u044f \u043e\u0431\u044a\u0435\u043a\u0442 PositionError \u043f\u0440\u0438 \u043e\u0442\u043a\u0430\u0437\u0435 \u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0435, \u0438 options \u2014 \u043e\u0431\u044a\u0435\u043a\u0442 \u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438. \u0412\u043e\u0442 \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432 \u043a\u043e\u0434\u0435:<\/p>\n<pre><code class=\"javascript\">navigator.geolocation.getCurrentPosition(success, error, {   \/\/ \u0432\u044b\u0441\u043e\u043a\u0430\u044f \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c   enableHighAccuracy: true })  function success({ coords }) {   \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0448\u0438\u0440\u043e\u0442\u0443 \u0438 \u0434\u043e\u043b\u0433\u043e\u0442\u0443   const { latitude, longitude } = coords   const position = [latitude, longitude]   console.log(position) \/\/ [\u0448\u0438\u0440\u043e\u0442\u0430, \u0434\u043e\u043b\u0433\u043e\u0442\u0430] }  function error({ message }) {   console.log(message) \/\/ \u043f\u0440\u0438 \u043e\u0442\u043a\u0430\u0437\u0435 \u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c PositionError: User denied Geolocation } <\/code><\/pre>\n<p>  <\/p>\n<h3>\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \u043a\u0430\u0440\u0442\u0435<\/h3>\n<p>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u0430\u0440\u0442\u044b \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/leafletjs.com\/\" rel=\"nofollow\">Leaflet.js<\/a>. \u0414\u0430\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043e\u0439 Google Maps \u0438 OpenStreetMap, \u0443\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u0438\u043c \u043f\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0443, \u043d\u043e \u043f\u043e\u0434\u043a\u0443\u043f\u0430\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0443, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0441\u0442\u0438\u043b\u0438 \u0438 \u0441\u043a\u0440\u0438\u043f\u0442 \u043a\u0430\u0440\u0442\u044b:<\/p>\n<pre><code class=\"xml\">&lt;head&gt;   &lt;!-- \u0441\u0442\u0438\u043b\u0438 \u043a\u0430\u0440\u0442\u044b --&gt;   &lt;link       rel=&quot;stylesheet&quot;       href=&quot;https:\/\/unpkg.com\/leaflet@1.7.1\/dist\/leaflet.css&quot;       integrity=&quot;sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6\/keqq\/sMZMZ19scR4PsZChSR7A==&quot;       crossorigin=&quot;&quot;     \/&gt;     &lt;!-- \u0441\u043a\u0440\u0438\u043f\u0442 \u043a\u0430\u0440\u0442\u044b --&gt;     &lt;script       src=&quot;https:\/\/unpkg.com\/leaflet@1.7.1\/dist\/leaflet.js&quot;       integrity=&quot;sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA==&quot;       crossorigin=&quot;&quot;     &gt;&lt;\/script&gt;     &lt;!-- \u043d\u0430\u0448\u0438 \u0441\u0442\u0438\u043b\u0438 --&gt;     &lt;link rel=&quot;stylesheet&quot; href=&quot;style.css&quot; \/&gt; &lt;\/head&gt; &lt;body&gt;   &lt;!-- \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0434\u043b\u044f \u043a\u0430\u0440\u0442\u044b --&gt;   &lt;div id=&quot;map&quot;&gt;&lt;\/div&gt;   &lt;!-- \u043a\u043d\u043e\u043f\u043a\u0430 \u0434\u043b\u044f \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 --&gt;   &lt;button id=&quot;my_position&quot;&gt;My Position&lt;\/button&gt;   &lt;!-- \u043d\u0430\u0448 \u0441\u043a\u0440\u0438\u043f\u0442-\u043c\u043e\u0434\u0443\u043b\u044c --&gt;   &lt;script src=&quot;script.js&quot; type=&quot;module&quot;&gt;&lt;\/script&gt; &lt;\/body&gt; <\/code><\/pre>\n<p>  \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0442\u0438\u043b\u0438 (style.css):<\/p>\n<pre><code class=\"css\">* {   margin: 0;   padding: 0;   box-sizing: border-box; }  body {   min-height: 100vh;   display: grid;   place-content: center;   place-items: center;   background-color: rgb(241, 241, 241); }  #map {   width: 480px;   height: 320px;   border-radius: 4px;   box-shadow: 0 0 1px #222; }  button {   padding: 0.25em 0.75em;   margin: 1em 0.5em;   cursor: pointer;   user-select: none; } <\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c map.js \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f:<\/p>\n<pre><code class=\"javascript\">\/\/ \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043a\u0430\u0440\u0442\u044b \u0438 \u043c\u0430\u0440\u043a\u0435\u0440\u0430 \/\/ \u043a\u0430\u0436\u0434\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0438\u043c\u0435\u0435\u0442 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u0438\u043c\u0435\u043d let map = null let marker = null  \/\/ \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043f\u043e\u0437\u0438\u0446\u0438\u044e - \u043c\u0430\u0441\u0441\u0438\u0432 \u0441 \u0448\u0438\u0440\u043e\u0442\u043e\u0439 \u0438 \u0434\u043e\u043b\u0433\u043e\u0442\u043e\u0439 \/\/ \u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c\u043e\u0435 \u043d\u0430\u0434 \u043c\u0430\u0440\u043a\u0435\u0440\u043e\u043c (tooltip) export function getMap(position, tooltip) {   \/\/ \u0435\u0441\u043b\u0438 \u043a\u0430\u0440\u0442\u0430 \u043d\u0435 \u0431\u044b\u043b\u0430 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0430   if (map === null) {     \/\/ \u0432\u0442\u043e\u0440\u043e\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442, \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c\u044b\u0439 \u043c\u0435\u0442\u043e\u0434\u043e\u043c setView - \u044d\u0442\u043e \u043c\u0430\u0441\u0448\u0442\u0430\u0431 (zoom)     map = L.map('map').setView(position, 15)   } else return    \/\/ \u0447\u0442\u043e-\u0442\u043e \u0442\u0438\u043f\u0430 \u0440\u0435\u043a\u043b\u0430\u043c\u044b   \/\/ \u0431\u0435\u0437 \u044d\u0442\u043e\u0433\u043e \u043a\u0430\u0440\u0442\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442   L.tileLayer('https:\/\/{s}.tile.openstreetmap.org\/{z}\/{x}\/{y}.png', {     attribution:       '&copy; &lt;a href=&quot;https:\/\/www.openstreetmap.org\/copyright&quot;&gt;OpenStreetMap&lt;\/a&gt; contributors'   }).addTo(map)    \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043c\u0430\u0440\u043a\u0435\u0440 \u0441 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c   L.marker(position).addTo(map).bindPopup(tooltip).openPopup() } <\/code><\/pre>\n<p>  \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0441\u043e\u0437\u0434\u0430\u0435\u043c script.js:<\/p>\n<pre><code class=\"javascript\">\/\/ \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e import { getMap } from '.\/map.js'  \/\/ \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u043a\u043d\u043e\u043f\u043a\u0443 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a \u043d\u0435\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a document.getElementById('my_position').onclick = () =&gt; {   navigator.geolocation.getCurrentPosition(success, error, {     enableHighAccuracy: true   }) }  function success({ coords }) {   const { latitude, longitude } = coords   const currentPosition = [latitude, longitude]   \/\/ \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u044f \u0435\u0439 \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435   getMap(currentPosition, 'You are here') }  function error({ message }) {   console.log(message) } <\/code><\/pre>\n<p>  \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c index.html \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435, \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0438, \u0432\u0438\u0434\u0438\u043c \u043d\u0430\u0448\u0443 \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u043d\u0430 \u043a\u0430\u0440\u0442\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/lh\/jv\/4f\/lhjv4fkb-5iirvmfiithpnjih80.png\"><\/p>\n<p>  \u041e\u0442\u043b\u0438\u0447\u043d\u043e. \u0414\u0432\u0438\u0433\u0430\u0435\u043c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<h3>\u0410\u043d\u0438\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043c\u0435\u0436\u0434\u0443 \u0433\u043e\u0440\u043e\u0434\u0430\u043c\u0438<\/h3>\n<p>  \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442 \u0441 \u0442\u0440\u0435\u043c\u044f \u0433\u043e\u0440\u043e\u0434\u0430\u043c\u0438 (\u041c\u043e\u0441\u043a\u0432\u0430, \u0421\u0430\u043d\u043a\u0442-\u041f\u0435\u0442\u0435\u0440\u0431\u0443\u0440\u0433, \u0415\u043a\u0430\u0442\u0435\u0440\u0438\u043d\u0431\u0443\u0440\u0433) \u0438 \u0438\u0445 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c\u0438 (db\/cities.json):<\/p>\n<pre><code class=\"json\">{   &quot;Moscow&quot;: {     &quot;lat&quot;: &quot;55.7522200&quot;,     &quot;lon&quot;: &quot;37.6155600&quot;   },   &quot;Saint-Petersburg&quot;: {     &quot;lat&quot;: &quot;59.9386300&quot;,     &quot;lon&quot;: &quot;30.3141300&quot;   },   &quot;Ekaterinburg&quot;: {     &quot;lat&quot;: &quot;56.8519000&quot;,     &quot;lon&quot;: &quot;60.6122000&quot;   } } <\/code><\/pre>\n<p>  \u041d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043b\u0430\u0432\u043d\u043e\u0435 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u044d\u0442\u0438\u043c\u0438 \u0433\u043e\u0440\u043e\u0434\u0430\u043c\u0438 \u043d\u0430 \u043a\u0430\u0440\u0442\u0435.<\/p>\n<p>  \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0443 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0434\u043b\u044f \u0433\u043e\u0440\u043e\u0434\u043e\u0432:<\/p>\n<pre><code class=\"xml\">&lt;div id=&quot;cities&quot;&gt;&lt;\/div&gt; <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c script.js:<\/p>\n<pre><code class=\"javascript\">import { getMap } from '.\/map.js'  \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0434\u043b\u044f \u0433\u043e\u0440\u043e\u0434\u043e\u0432 const $cities = document.getElementById('cities')  ;(async () =&gt; {   \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0441 \u0433\u043e\u0440\u043e\u0434\u0430\u043c\u0438   const response = await fetch('.\/db\/cities.json')   const cities = await response.json()   \/\/ \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0435\u043c \u0433\u043e\u0440\u043e\u0434\u0430   for (const city in cities) {     \/\/ \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0443     const $button = document.createElement('button')      \/\/ \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043a\u043d\u043e\u043f\u043a\u0438 - \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0433\u043e\u0440\u043e\u0434\u0430     $button.textContent = city      \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0448\u0438\u0440\u043e\u0442\u0443 \u0438 \u0434\u043e\u043b\u0433\u043e\u0442\u0443     const { lat, lon } = cities[city]      \/\/ \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0433\u043e\u0440\u043e\u0434\u0430, \u0448\u0438\u0440\u043e\u0442\u0443 \u0438 \u0434\u043e\u043b\u0433\u043e\u0442\u0443     \/\/ \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 data-\u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b     $button.dataset.city = city     $button.dataset.lat = lat     $button.dataset.lon = lon      \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0443 \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440     $cities.append($button)   } })()  \/\/ \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u043a\u043d\u043e\u043f\u043a\u0438 $cities.addEventListener('click', ({ target }) =&gt; {   \/\/ \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u043a\u043d\u043e\u043f\u043a\u0438   if (target.tagName !== 'BUTTON') return    \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0433\u043e\u0440\u043e\u0434\u0430, \u0448\u0438\u0440\u043e\u0442\u0443 \u0438 \u0434\u043e\u043b\u0433\u043e\u0442\u0443 \u0438\u0437 data-\u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432   const { city, lat, lon } = target.dataset   const position = [lat, lon]   \/\/ \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u044f \u0435\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0433\u043e\u0440\u043e\u0434\u0430   getMap(position, city) }) <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u043c map.js:<\/p>\n<pre><code class=\"javascript\">let map = null let marker = null  export function getMap(position, tooltip) {   if (map === null) {     map = L.map('map').setView(position, 15)   } else {     \/\/ \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438     map.flyTo(position)   }    L.tileLayer('https:\/\/{s}.tile.openstreetmap.org\/{z}\/{x}\/{y}.png', {     attribution:       '&copy; &lt;a href=&quot;https:\/\/www.openstreetmap.org\/copyright&quot;&gt;OpenStreetMap&lt;\/a&gt; contributors'   }).addTo(map)    \/\/ \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043c\u0430\u0440\u043a\u0435\u0440\u0430   if (marker) {     map.removeLayer(marker)   }   marker = new L.Marker(position).addTo(map).bindPopup(tooltip).openPopup() } <\/code><\/pre>\n<p>  \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c index.html. \u041f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043f\u0435\u0440\u0432\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u0438 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0433\u043e\u0440\u043e\u0434\u0430. \u041f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043a\u043d\u043e\u043f\u043e\u043a \u043f\u043b\u0430\u0432\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u043c\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u0433\u043e\u0440\u043e\u0434\u0430\u043c\u0438.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/7u\/6e\/zr\/7u6ezr-csu1bvvxis3mfzith45o.png\"><\/p>\n<h3>\u041f\u043b\u0430\u0432\u043d\u043e\u0435 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u043c\u0435\u0436\u0434\u0443 \u0430\u0434\u0440\u0435\u0441\u0430\u043c\u0438<\/h3>\n<p>  \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0438\u043c\u0435\u044e\u0442\u0441\u044f \u0442\u0440\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f\u043c\u0438 \u0438 \u0430\u0434\u0440\u0435\u0441\u0430\u043c\u0438 (db\/addresses.json):<\/p>\n<pre><code class=\"json\">{   &quot;\u0422\u0435\u0430\u0442\u0440 \u0434\u0440\u0430\u043c\u044b&quot;: &quot;\u041e\u043a\u0442\u044f\u0431\u0440\u044c\u0441\u043a\u0430\u044f \u043f\u043b\u043e\u0449\u0430\u0434\u044c, 2&quot;,   &quot;\u0422\u0435\u0430\u0442\u0440 \u043e\u043f\u0435\u0440\u044b \u0438 \u0431\u0430\u043b\u0435\u0442\u0430&quot;: &quot;\u041f\u0440\u043e\u0441\u043f\u0435\u043a\u0442 \u041b\u0435\u043d\u0438\u043d\u0430, 46\u0410&quot;,   &quot;\u041a\u043e\u043b\u044f\u0434\u0430-\u0422\u0435\u0430\u0442\u0440&quot;: &quot;\u041f\u0440\u043e\u0441\u043f\u0435\u043a\u0442 \u041b\u0435\u043d\u0438\u043d\u0430, 97&quot; } <\/code><\/pre>\n<p>  \u041d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u044d\u0442\u0438\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 \u043d\u0430 \u043a\u0430\u0440\u0442\u0435. \u041d\u043e \u043a\u0430\u043a \u043d\u0430\u043c \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0431\u0435\u0437 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442? \u041d\u0438\u043a\u0430\u043a. \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043d\u0430\u043c \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043d\u0443\u0436\u043d\u043e \u044d\u0442\u0438 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c <a href=\"https:\/\/nominatim.openstreetmap.org\/ui\/search.html\" rel=\"nofollow\">Nominatim<\/a> \u043e\u0442 OpenStreetMap. \u041e \u0442\u043e\u043c, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 <a href=\"https:\/\/nominatim.org\/release-docs\/develop\/api\/Search\/\" rel=\"nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>. \u042f \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u044e \u043b\u0438\u0448\u044c \u043e\u0434\u0438\u043d \u0438\u0437 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0432 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0434\u043b\u044f \u0430\u0434\u0440\u0435\u0441\u043e\u0432:<\/p>\n<pre><code class=\"xml\">&lt;div id=&quot;addresses&quot;&gt;&lt;\/div&gt; <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c script.js:<\/p>\n<pre><code class=\"javascript\">\/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0434\u043b\u044f \u0430\u0434\u0440\u0435\u0441\u043e\u0432 const $addresses = document.getElementById('addresses')  ;(async () =&gt; {   \/\/ \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0438 \u0430\u0434\u0440\u0435\u0441\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432   const response = await fetch('.\/db\/addresses.json')   const addresses = await response.json()    \/\/ \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043c\u0435\u0441\u0442\u0430   for (const place in addresses) {     \/\/ \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0443     const $button = document.createElement('button')      $button.textContent = place      \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0430\u0434\u0440\u0435\u0441     const address = addresses[place]      \/\/ \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0430     const query = address.replace(       \/([\u0410-\u042f\u0401\u0430-\u044f\u0451]+)\\s([\u0410-\u042f\u0401\u0430-\u044f\u0451]+),\\s([0-9\u0410-\u042f\u0401\u0430-\u044f\u0451]+)\/,       '$3+$1+$2,+\u0415\u043a\u0430\u0442\u0435\u0440\u0438\u043d\u0431\u0443\u0440\u0433'     )     \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, 2+\u041e\u043a\u0442\u044f\u0431\u0440\u044c\u0441\u043a\u0430\u044f+\u043f\u043b\u043e\u0449\u0430\u0434\u044c,+\u0415\u043a\u0430\u0442\u0435\u0440\u0438\u043d\u0431\u0443\u0440\u0433      \/\/ \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 data-\u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b     $button.dataset.address = address     $button.dataset.query = query      $addresses.append($button)   } })()  \/\/ \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u043a\u043d\u043e\u043f\u043a\u0438 $addresses.addEventListener('click', async ({ target }) =&gt; {   if (target.tagName !== 'BUTTON') return    \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 data-\u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432   const { address, query } = target.dataset    \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0442\u0432\u0435\u0442 \u043e\u0442 \u0441\u0435\u0440\u0432\u0438\u0441\u0430   const response = await fetch(     `https:\/\/nominatim.openstreetmap.org\/search?q=${query}&amp;format=json&amp;limit=1`   )   \/\/ format - \u0444\u043e\u0440\u043c\u0430\u0442 \u0434\u0430\u043d\u043d\u044b\u0445, limit - \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438    \/\/ \u043f\u0430\u0440\u0441\u0438\u043c \u043e\u0442\u0432\u0435\u0442, \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u044f \u043d\u0443\u0436\u043d\u044b\u0435 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f   const { display_name, lat, lon } = (await response.json())[0]    \/\/ \u0440\u0435\u0434\u0430\u043a\u0442\u0440\u0438\u0443\u0435\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430   const name = display_name.match(\/[\u0410-\u042f\u0401\u0430-\u044f\u0451\\s(\u00ab\\-\u00bb)]+\/)[0]    const position = [lat, lon]    \/\/ \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435   const tooltip = `${name}&lt;br&gt;${address}`    \/\/ \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e   getMap(position, tooltip) }) <\/code><\/pre>\n<p>  \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c index.html. \u041f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043f\u0435\u0440\u0432\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u0438 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0442\u0435\u0430\u0442\u0440\u0430. \u041f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043a\u043d\u043e\u043f\u043e\u043a \u043f\u043b\u0430\u0432\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u043c\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u0442\u0435\u0430\u0442\u0440\u0430\u043c\u0438.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ru\/s8\/hp\/rus8hpev433tusueixuss_tbq7i.png\"><\/p>\n<p>  \u041a\u0440\u0443\u0442\u043e. \u0412\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043a\u0430\u043a \u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u043f\u043e\u0437\u0432\u043e\u043b\u044c\u0442\u0435 \u043e\u0442\u043a\u043b\u0430\u043d\u044f\u0442\u044c\u0441\u044f. \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0432\u044b \u043d\u0430\u0448\u043b\u0438 \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u0447\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0438 \u0445\u043e\u0440\u043e\u0448\u0435\u0433\u043e \u0434\u043d\u044f.<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/532902\/\"> https:\/\/habr.com\/ru\/post\/532902\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ig\/mq\/2d\/igmq2dvqrh3pvqpohaicef0c3zi.png\"><\/p>\n<p>  \u0414\u043e\u0431\u0440\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u0443\u0442\u043e\u043a, \u0434\u0440\u0443\u0437\u044c\u044f!<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u043c \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0435 \u043c\u044b \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0432\u0430\u043c\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0442\u0440\u0438 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0437\u0430\u0434\u0430\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Geolocation API \u0438 Leaflet.js \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u043c \u0435\u0433\u043e \u043d\u0430 \u043a\u0430\u0440\u0442\u0435<\/li>\n<li>\u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0430\u043d\u0438\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043c\u0435\u0436\u0434\u0443 \u0433\u043e\u0440\u043e\u0434\u0430\u043c\u0438<\/li>\n<li>\u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0430\u0434\u0440\u0435\u0441\u0430\u043c\u0438 \u0441 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0438 \u0435\u0433\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442<\/li>\n<\/ul>\n<p>  \u041a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f <a href=\"https:\/\/github.com\/harryheman\/JavaScript-Examples\/tree\/main\/Work-With-Map\" rel=\"nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>  \u041f\u043e\u0438\u0433\u0440\u0430\u0442\u044c \u0441 \u043a\u043e\u0434\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0437\u0434\u0435\u0441\u044c:<\/p>\n<div class=\"oembed\"><iframe id=\"5fd72a41d4323713fd415926\" src=\"https:\/\/embedd.srv.habr.com\/iframe\/5fd72a41d4323713fd415926\"><\/iframe><\/div>\n<p>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-314848","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/314848","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=314848"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/314848\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=314848"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=314848"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=314848"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}