{"id":11237,"date":"2022-09-26T16:25:23","date_gmt":"2022-09-26T10:55:23","guid":{"rendered":"https:\/\/jassweb.com\/solved\/solved-how-to-show-labels-with-direction-on-google-map-api\/"},"modified":"2022-09-26T16:25:23","modified_gmt":"2022-09-26T10:55:23","slug":"solved-how-to-show-labels-with-direction-on-google-map-api","status":"publish","type":"post","link":"https:\/\/jassweb.com\/solved\/solved-how-to-show-labels-with-direction-on-google-map-api\/","title":{"rendered":"[Solved] How to show labels with direction on google map api"},"content":{"rendered":"<p> [ad_1]<br \/>\n<\/p>\n<div id=\"answer-58830413\" class=\"answer js-answer accepted-answer js-accepted-answer\" data-answerid=\"58830413\" data-parentid=\"58815605\" data-score=\"1\" data-position-on-page=\"1\" data-highest-scored=\"1\" data-question-has-accepted-highest-score=\"1\" itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n<div class=\"post-layout\">\n<div class=\"votecell post-layout--left\"><\/div>\n<div class=\"answercell post-layout--right\">\n<div class=\"s-prose js-post-body\" itemprop=\"text\">\n<p>One option would be to create that <code>&lt;div&gt;<\/code> as a <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/developers-dot-devsite-v2-prod.appspot.com\/maps\/documentation\/javascript\/controls#CustomControls\">custom control<\/a>, create the links for &#8220;View larger map&#8221; and &#8220;Directions&#8221; by sending the user to Google Maps.<\/p>\n<p><a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/jsfiddle.net\/geocodezip\/35qwayo6\/8\/\">proof of concept fiddle<\/a><\/p>\n<p><a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/jassweb.com\/solved\/wp-content\/uploads\/2022\/09\/Solved-How-to-show-labels-with-direction-on-google-map.png\"><img decoding=\"async\" src=\"https:\/\/jassweb.com\/solved\/wp-content\/uploads\/2022\/09\/Solved-How-to-show-labels-with-direction-on-google-map.png\" alt=\"screenshot of resulting map\"><\/a><\/p>\n<p><strong>code snippet:<\/strong><\/p>\n<\/p>\n<div class=\"snippet\" data-lang=\"js\" data-hide=\"false\" data-console=\"false\" data-babel=\"false\">\n<div class=\"snippet-code\">\n<pre class=\"snippet-code-js lang-js prettyprint-override\"><code>google.maps.event.addDomListener(window, 'load', init);\r\nvar lat = 25.2091043;\r\nvar lng = 55.2725799;\r\n\r\nfunction init() {\r\n  var mapOptions1 = {\r\n    zoom: 18,\r\n    center: new google.maps.LatLng(lat, lng),\r\n    mapTypeId: google.maps.MapTypeId.ROADMAP,\r\n    mapTypeControl: false\r\n  };\r\n  var mapElement1 = document.getElementById('map-canvas');\r\n  var map1 = new google.maps.Map(mapElement1, mapOptions1);\r\n  var marker = new google.maps.Marker({\r\n    position: {\r\n      lat: lat,\r\n      lng: lng\r\n    },\r\n    map: map1,\r\n    icon: {\r\n      url: \"http:\/\/maps.google.com\/mapfiles\/ms\/icons\/red-dot.png\",\r\n      labelOrigin: new google.maps.Point(100, 32),\r\n      size: new google.maps.Size(32, 32),\r\n      anchor: new google.maps.Point(16, 32)\r\n    },\r\n    label: {\r\n      text: \"Aspin Commercial Tower\",\r\n      color: \"#C70E20\",\r\n      fontWeight: \"bold\"\r\n    }\r\n  });\r\n  var measle = new google.maps.Marker({\r\n    position: marker.getPosition(),\r\n    map: marker.getMap(),\r\n    zIndex: 0,\r\n    icon: {\r\n      url: \"https:\/\/maps.gstatic.com\/intl\/en_us\/mapfiles\/markers2\/measle.png\",\r\n      size: new google.maps.Size(7, 7),\r\n      anchor: new google.maps.Point(4, 4)\r\n    }\r\n  });\r\n  \/\/ Create the DIV to hold the control and call the CenterControl()\r\n  \/\/ constructor passing in this DIV.\r\n  var directionsControlDiv = document.createElement('div');\r\n  var directionsControl = new DirectionsControl(directionsControlDiv, map1);\r\n\r\n  directionsControlDiv.index = 1;\r\n  map1.controls[google.maps.ControlPosition.TOP_LEFT].push(directionsControlDiv);\r\n}\r\n\r\n\/**\r\n * The DirectionsControl adds a control to the map that gets directions\r\n * This constructor takes the control DIV as an argument.\r\n * @constructor\r\n *\/\r\nfunction DirectionsControl(controlDiv, map) {\r\n\r\n  \/\/ Set CSS for the control border.\r\n  var controlUI = document.createElement('div');\r\n  controlUI.style.backgroundColor=\"#fff\";\r\n  controlUI.style.border=\"2px solid #fff\";\r\n  controlUI.style.borderRadius=\"3px\";\r\n  controlUI.style.boxShadow = '0 2px 6px rgba(0,0,0,.3)';\r\n  controlUI.style.cursor=\"pointer\";\r\n  controlUI.style.marginBottom = '22px';\r\n  controlUI.style.textAlign = 'left';\r\n  controlUI.style.marginTop = '10px';\r\n  controlUI.style.marginLeft=\"10px\";\r\n  controlUI.id = 'controlUI';\r\n  controlDiv.appendChild(controlUI);\r\n\r\n  \/\/ Set CSS for the control interior.\r\n  var controlText = document.createElement('div');\r\n  controlText.style.color=\"rgb(25,25,25)\";\r\n  controlText.style.fontFamily = 'Roboto,Arial,sans-serif';\r\n  controlText.style.fontSize=\"16px\";\r\n  controlText.style.lineHeight=\"24px\";\r\n  controlText.style.paddingLeft=\"5px\";\r\n  controlText.style.paddingRight=\"5px\";\r\n  controlText.id = 'controlText';\r\n  controlText.style.backgroundColor=\"#fff\";\r\n  controlText.innerHTML = '&lt;div id=\"controlTextInner\" class=\"cf\" style=\"width:350px; height:auto; background-color: white; padding: 5px;\"&gt;&lt;div style=\"width:250px; height:auto; float: left;\"&gt;Aspin Commercial Tower&lt;br&gt;106 Sheikh Zayed Rd - Dubai - United Arab Emirates&lt;br&gt;&lt;a href=\"https:\/\/www.google.com\/maps\/place\/Aspin+Commercial+Tower+-+106+Sheikh+Zayed+Rd+-+Dubai+-+United+Arab+Emirates\/@25.2089625,55.2703097,17z\/data=!3m1!4b1!4m5!3m4!1s0x3e5f428853023db3:0x6e63a9fe6b2d7cfe!8m2!3d25.2089625!4d55.2724984\" target=\"_top\"&gt;view larger map&lt;\/a&gt;&lt;\/div&gt;&lt;a href=\"https:\/\/www.google.com\/maps\/dir\/\/Aspin+Commercial+Tower+-+106+Sheikh+Zayed+Rd+-+Dubai+-+United+Arab+Emirates\/@25.2089625,55.2703097,17z\/data=!4m9!4m8!1m0!1m5!1m1!1s0x3e5f428853023db3:0x6e63a9fe6b2d7cfe!2m2!1d55.2724984!2d25.2089625!3e0\" target=\"_top\"&gt;&lt;img id=\"directions\" align=\"right;\" style=\"padding: 10px; vertical-align: top;\" title=\"get directions\" alt=\"get directions\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD0AAAAxCAYAAABpoKGSAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAPFSURBVGhD7ZhLSFRRGMclaFMUtKldBBXVoiIoqk30QFIKCiKEoNeiIFxE1KpVbSp7YaBoWKj5SDSVNDQJMZAemmWhmJr5mvc4vsZ56Tjzdf5n7tU7M3dG05kLw70\/OOi95\/k75zvf6CSRCtGk1YImrRY0abWgSccSu8dHdb1OsjpnhTfBdJinKaXYSEfyDbIlrcIstIw9cZGGcE23g8o7p6iyy7Ek8YSS9nj9c8JiWUj8aGGCS4N2oydIOpp4VstEmHBCSoNI4qNun9AisjBKQkoDOXGEPu58zrfJMNHUIuPcHU9YaSAnntE8LiuM+y0mt4SWBlLxgnY7pb4KztinS01cVgS\/X662CE+xRxFp0GYIiN+otwUJJ7MN6BmZEVrNY5j0Cr\/FHsWkfSx\/4T4jjKXSOHmlUUwaNA24goRRRhzyn9\/xRFHphr5g6TNlJqFGWRSVRnhLpdPfjQg1yqJJxxtNWpNWFk1aLWjSakGTVgua9EKMuny8xAMvG1Zn9\/Kf8SZIuqHfRasfDVLSvQFacX+ANmXrqOK3Q6glOlVhoQu1sflsxebtfmGgvJ+B\/6ebhty0OUdHbab5b1DiRZg0Ju4bC+x4\/q8pWp85TJXdTqFF7AiVVpKI0iK3P47RsVITeWb9dP3DKC\/geJmZTpSbac3jIb5wt9dPF1kUrHwwyN9hw4CflYwvE7SKRRCiJ\/m1mVqMHtrwbJhHFArGxJzYBHHu+r8u2pil4312PNdTK+sDMNeBQiMdLTHxui05euqwBqKj2zZDO\/MM\/P26p\/NrCGVBabzbmqun\/nFvmPThYtPcF\/g3G0f5YvBc0+vkV+OrwUO1f5x8zM96D9mnfXSy3EJX6mxhJy2V7mKLR\/\/M1kma8fnpTvM4l7GwsdF+7ZMhPgfGS2HrwHgAY197b+N9cn\/YaTvbrGGZ79oWJS2+C5UWFzzh8dG+fCOVdAbuP04XJ4r69AYbXZL8jT3FFmp2zEaVzv5up\/0FRt4WmFj7XayuqsfJ22NuEaxHfD5bZeXz4oCisayTli5YGq7SsEU7sY+UaNJSESBtG00aUXa+ZoRHwrLCO9qdFhdsY4vay04aJxEK2i\/lpA8VBeYEiz1pEfR6w5KveFihRJSWy96RpAHu1UF2pw1TszTm9tFV9vxJF36n06qtdO6tlV+JPS8NXBBIpRe603LSqEObhyxpYu3VbIMWLS39nN7GEgE6i0SThiiEkL1RkMmR0eWyNxYI7jIZvLvVOBYkDaJlbzlp0Djo5pv1X9lbLWjSakGTVguatDog+gfX7PQXK+ITpgAAAABJRU5ErkJggg==\"\/&gt;&lt;\/a&gt;&lt;br&gt;&lt;\/div&gt;';\r\n  controlUI.appendChild(controlText);\r\n\r\n  \/\/ Setup the click event listeners: simply set the map to Chicago.\r\n  controlUI.addEventListener('click', function() {\r\n    map.setCenter(chicago);\r\n  });\r\n\r\n}<\/code><\/pre>\n<pre class=\"snippet-code-css lang-css prettyprint-override\"><code>\/* Always set the map height explicitly to define the size of the div\r\n * element that contains the map. *\/\r\n\r\n#map-canvas {\r\n  height: 100%;\r\n}\r\n\r\n\r\n\/* Optional: Makes the sample page fill the window. *\/\r\n\r\nhtml,\r\nbody {\r\n  height: 100%;\r\n  margin: 0;\r\n  padding: 0;\r\n}\r\n\r\n\r\n\/* from http:\/\/nicolasgallagher.com\/micro-clearfix-hack\/ *\/\r\n\r\n\r\n\/**\r\n * For modern browsers\r\n * 1. The space content is one way to avoid an Opera bug when the\r\n *    contenteditable attribute is included anywhere else in the document.\r\n *    Otherwise it causes space to appear at the top and bottom of elements\r\n *    that are clearfixed.\r\n * 2. The use of `table` rather than `block` is only necessary if using\r\n *    `:before` to contain the top-margins of child elements.\r\n *\/\r\n\r\n.cf::before,\r\n.cf::after {\r\n  content: \" \";\r\n  \/* 1 *\/\r\n  display: table;\r\n  \/* 2 *\/\r\n}\r\n\r\n.cf::after {\r\n  clear: both;\r\n}\r\n\r\n\r\n\/**\r\n * For IE 6\/7 only\r\n * Include this rule to trigger hasLayout and contain floats.\r\n *\/\r\n\r\n.cf {\r\n  *zoom: 1;\r\n}<\/code><\/pre>\n<pre class=\"snippet-code-html lang-html prettyprint-override\"><code>&lt;div id=\"map-canvas\"&gt;&lt;\/div&gt;\r\n&lt;!-- Replace the value of the key parameter with your own API key. --&gt;\r\n&lt;script src=\"https:\/\/maps.googleapis.com\/maps\/api\/js?key=AIzaSyCkUOdZ5y7hMm0yrcCQoCvLwzdM6M8s5qk\"&gt;&lt;\/script&gt;<\/code><\/pre>\n<\/div>\n<\/div><\/div>\n<div class=\"mt24\"><\/div>\n<\/div>\n<p>            <span class=\"d-none\" itemprop=\"commentCount\">0<\/span> <\/p><\/div>\n<\/div>\n<p>[ad_2]<\/p>\n<p>solved How to show labels with direction on google map api <\/p>\n","protected":false},"excerpt":{"rendered":"<p>[ad_1] One option would be to create that &lt;div&gt; as a custom control, create the links for &#8220;View larger map&#8221; and &#8220;Directions&#8221; by sending the user to Google Maps. proof of concept fiddle code snippet: google.maps.event.addDomListener(window, &#8216;load&#8217;, init); var lat = 25.2091043; var lng = 55.2725799; function init() { var mapOptions1 = { zoom: 18, &#8230; <a title=\"[Solved] How to show labels with direction on google map api\" class=\"read-more\" href=\"https:\/\/jassweb.com\/solved\/solved-how-to-show-labels-with-direction-on-google-map-api\/\" aria-label=\"More on [Solved] How to show labels with direction on google map api\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[320],"tags":[1322,2194,333,1108],"class_list":["post-11237","post","type-post","status-publish","format-standard","hentry","category-solved","tag-google-maps-api-3","tag-google-maps-markers","tag-javascript","tag-label"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>[Solved] How to show labels with direction on google map api - JassWeb<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jassweb.com\/solved\/solved-how-to-show-labels-with-direction-on-google-map-api\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[Solved] How to show labels with direction on google map api - JassWeb\" \/>\n<meta property=\"og:description\" content=\"[ad_1] One option would be to create that &lt;div&gt; as a custom control, create the links for &#8220;View larger map&#8221; and &#8220;Directions&#8221; by sending the user to Google Maps. proof of concept fiddle code snippet: google.maps.event.addDomListener(window, &#039;load&#039;, init); var lat = 25.2091043; var lng = 55.2725799; function init() { var mapOptions1 = { zoom: 18, ... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jassweb.com\/solved\/solved-how-to-show-labels-with-direction-on-google-map-api\/\" \/>\n<meta property=\"og:site_name\" content=\"JassWeb\" \/>\n<meta property=\"article:published_time\" content=\"2022-09-26T10:55:23+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/jassweb.com\/solved\/wp-content\/uploads\/2022\/09\/Solved-How-to-show-labels-with-direction-on-google-map.png\" \/>\n<meta name=\"author\" content=\"Kirat\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kirat\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-show-labels-with-direction-on-google-map-api\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-show-labels-with-direction-on-google-map-api\/\"},\"author\":{\"name\":\"Kirat\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31\"},\"headline\":\"[Solved] How to show labels with direction on google map api\",\"datePublished\":\"2022-09-26T10:55:23+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-show-labels-with-direction-on-google-map-api\/\"},\"wordCount\":57,\"publisher\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\"},\"image\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-show-labels-with-direction-on-google-map-api\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/jassweb.com\/solved\/wp-content\/uploads\/2022\/09\/Solved-How-to-show-labels-with-direction-on-google-map.png\",\"keywords\":[\"google-maps-api-3\",\"google-maps-markers\",\"javascript\",\"label\"],\"articleSection\":[\"Solved\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-show-labels-with-direction-on-google-map-api\/\",\"url\":\"https:\/\/jassweb.com\/solved\/solved-how-to-show-labels-with-direction-on-google-map-api\/\",\"name\":\"[Solved] How to show labels with direction on google map api - JassWeb\",\"isPartOf\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-show-labels-with-direction-on-google-map-api\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-show-labels-with-direction-on-google-map-api\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/jassweb.com\/solved\/wp-content\/uploads\/2022\/09\/Solved-How-to-show-labels-with-direction-on-google-map.png\",\"datePublished\":\"2022-09-26T10:55:23+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-show-labels-with-direction-on-google-map-api\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/jassweb.com\/solved\/solved-how-to-show-labels-with-direction-on-google-map-api\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-show-labels-with-direction-on-google-map-api\/#primaryimage\",\"url\":\"https:\/\/jassweb.com\/solved\/wp-content\/uploads\/2022\/09\/Solved-How-to-show-labels-with-direction-on-google-map.png\",\"contentUrl\":\"https:\/\/jassweb.com\/solved\/wp-content\/uploads\/2022\/09\/Solved-How-to-show-labels-with-direction-on-google-map.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-show-labels-with-direction-on-google-map-api\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/jassweb.com\/solved\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[Solved] How to show labels with direction on google map api\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/jassweb.com\/solved\/#website\",\"url\":\"https:\/\/jassweb.com\/solved\/\",\"name\":\"JassWeb\",\"description\":\"Build High-quality Websites\",\"publisher\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/jassweb.com\/solved\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\",\"name\":\"Jass Web\",\"url\":\"https:\/\/jassweb.com\/solved\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png\",\"contentUrl\":\"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png\",\"width\":693,\"height\":132,\"caption\":\"Jass Web\"},\"image\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31\",\"name\":\"Kirat\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1776403586\",\"contentUrl\":\"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1776403586\",\"caption\":\"Kirat\"},\"sameAs\":[\"http:\/\/jassweb.com\"],\"url\":\"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[Solved] How to show labels with direction on google map api - JassWeb","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jassweb.com\/solved\/solved-how-to-show-labels-with-direction-on-google-map-api\/","og_locale":"en_US","og_type":"article","og_title":"[Solved] How to show labels with direction on google map api - JassWeb","og_description":"[ad_1] One option would be to create that &lt;div&gt; as a custom control, create the links for &#8220;View larger map&#8221; and &#8220;Directions&#8221; by sending the user to Google Maps. proof of concept fiddle code snippet: google.maps.event.addDomListener(window, 'load', init); var lat = 25.2091043; var lng = 55.2725799; function init() { var mapOptions1 = { zoom: 18, ... Read more","og_url":"https:\/\/jassweb.com\/solved\/solved-how-to-show-labels-with-direction-on-google-map-api\/","og_site_name":"JassWeb","article_published_time":"2022-09-26T10:55:23+00:00","og_image":[{"url":"https:\/\/jassweb.com\/solved\/wp-content\/uploads\/2022\/09\/Solved-How-to-show-labels-with-direction-on-google-map.png","type":"","width":"","height":""}],"author":"Kirat","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Kirat","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jassweb.com\/solved\/solved-how-to-show-labels-with-direction-on-google-map-api\/#article","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/solved-how-to-show-labels-with-direction-on-google-map-api\/"},"author":{"name":"Kirat","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31"},"headline":"[Solved] How to show labels with direction on google map api","datePublished":"2022-09-26T10:55:23+00:00","mainEntityOfPage":{"@id":"https:\/\/jassweb.com\/solved\/solved-how-to-show-labels-with-direction-on-google-map-api\/"},"wordCount":57,"publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"image":{"@id":"https:\/\/jassweb.com\/solved\/solved-how-to-show-labels-with-direction-on-google-map-api\/#primaryimage"},"thumbnailUrl":"https:\/\/jassweb.com\/solved\/wp-content\/uploads\/2022\/09\/Solved-How-to-show-labels-with-direction-on-google-map.png","keywords":["google-maps-api-3","google-maps-markers","javascript","label"],"articleSection":["Solved"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/jassweb.com\/solved\/solved-how-to-show-labels-with-direction-on-google-map-api\/","url":"https:\/\/jassweb.com\/solved\/solved-how-to-show-labels-with-direction-on-google-map-api\/","name":"[Solved] How to show labels with direction on google map api - JassWeb","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jassweb.com\/solved\/solved-how-to-show-labels-with-direction-on-google-map-api\/#primaryimage"},"image":{"@id":"https:\/\/jassweb.com\/solved\/solved-how-to-show-labels-with-direction-on-google-map-api\/#primaryimage"},"thumbnailUrl":"https:\/\/jassweb.com\/solved\/wp-content\/uploads\/2022\/09\/Solved-How-to-show-labels-with-direction-on-google-map.png","datePublished":"2022-09-26T10:55:23+00:00","breadcrumb":{"@id":"https:\/\/jassweb.com\/solved\/solved-how-to-show-labels-with-direction-on-google-map-api\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jassweb.com\/solved\/solved-how-to-show-labels-with-direction-on-google-map-api\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/solved-how-to-show-labels-with-direction-on-google-map-api\/#primaryimage","url":"https:\/\/jassweb.com\/solved\/wp-content\/uploads\/2022\/09\/Solved-How-to-show-labels-with-direction-on-google-map.png","contentUrl":"https:\/\/jassweb.com\/solved\/wp-content\/uploads\/2022\/09\/Solved-How-to-show-labels-with-direction-on-google-map.png"},{"@type":"BreadcrumbList","@id":"https:\/\/jassweb.com\/solved\/solved-how-to-show-labels-with-direction-on-google-map-api\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/jassweb.com\/solved\/"},{"@type":"ListItem","position":2,"name":"[Solved] How to show labels with direction on google map api"}]},{"@type":"WebSite","@id":"https:\/\/jassweb.com\/solved\/#website","url":"https:\/\/jassweb.com\/solved\/","name":"JassWeb","description":"Build High-quality Websites","publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jassweb.com\/solved\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/jassweb.com\/solved\/#organization","name":"Jass Web","url":"https:\/\/jassweb.com\/solved\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/","url":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","contentUrl":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","width":693,"height":132,"caption":"Jass Web"},"image":{"@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31","name":"Kirat","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/image\/","url":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1776403586","contentUrl":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1776403586","caption":"Kirat"},"sameAs":["http:\/\/jassweb.com"],"url":"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/"}]}},"_links":{"self":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/11237","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/comments?post=11237"}],"version-history":[{"count":0,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/11237\/revisions"}],"wp:attachment":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/media?parent=11237"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/categories?post=11237"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/tags?post=11237"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}