{"id":5581,"date":"2024-03-21T13:58:09","date_gmt":"2024-03-21T13:58:09","guid":{"rendered":"https:\/\/www.codexworld.com\/?p=5581"},"modified":"2024-03-21T14:00:20","modified_gmt":"2024-03-21T14:00:20","slug":"openstreetmap-with-multiple-markers-info-window-popups-using-javascript","status":"publish","type":"post","link":"https:\/\/www.codexworld.com\/openstreetmap-with-multiple-markers-info-window-popups-using-javascript\/","title":{"rendered":"OpenStreetMap with Multiple Markers and Info Windows using JavaScript"},"content":{"rendered":"<p>OpenStreetMap is a free and open-source platform that is used to embed maps on the website. You can use <b>OpenStreetMap API<\/b> to embed maps with marker in HTML. Similar to Google Maps, OpenStreetMap is used to <a href=\"https:\/\/www.codexworld.com\/embed-open-street-map-with-marker-in-html-using-javascript\/\">display maps with marker and info window<\/a>. Mostly, the single marker is pointed on the map to display the location with marker and info window popup. We can embed maps with multiple markers and info-windows using OpenStreetMap API.<\/p>\n<p>Map with multiple markers are very useful when you want to show multiple locations on a single map. The user can see multiple locations with markers and open an info-window popup on the map. In this tutorial, we will show you how to <b>embed OpenStreetMap with multiple markers<\/b> and info windows using JavaScript.<\/p>\n<h2>Embed OpenStreetMap with Multiple Markers and Info Windows<\/h2>\n<p>We will use the Leaflet JavaScript library to simplify the OpenStreetMap integration process.<\/p>\n<ul>\n<li>Include the CSS and JS library files of the Leaflet JavaScript plugin.<\/li>\n<\/ul>\n<pre style=\"color: rgb(95, 94, 78);\"><span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">link<\/span> <span class=\"hljs-attr\">rel<\/span>=<span class=\"hljs-string\" style=\"color: rgb(125, 151, 38);\">\"stylesheet\"<\/span> <span class=\"hljs-attr\">href<\/span>=<span class=\"hljs-string\" style=\"color: rgb(125, 151, 38);\">\"https:\/\/unpkg.com\/leaflet@1.9.4\/dist\/leaflet.css\"<\/span>\/&gt;<\/span>\r\n    <span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">script<\/span> <span class=\"hljs-attr\">src<\/span>=<span class=\"hljs-string\" style=\"color: rgb(125, 151, 38);\">\"https:\/\/unpkg.com\/leaflet@1.9.4\/dist\/leaflet.js\"<\/span>&gt;<\/span><span class=\"undefined\"><\/span><span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;\/<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">script<\/span>&gt;<\/span><\/pre>\n<p>Define an HTML element with ID (<code>mapWrap<\/code>) where the map to be attached.<\/p>\n<pre style=\"color: rgb(95, 94, 78);\"><span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">div<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\" style=\"color: rgb(125, 151, 38);\">\"mapWrap\"<\/span>&gt;<\/span><span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;\/<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">div<\/span>&gt;<\/span><\/pre>\n<p>Set a fixed height of the map container and width as per UI using CSS.<\/p>\n<pre style=\"color: rgb(95, 94, 78);\"><span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">style<\/span>&gt;<\/span>\r\n<span style=\"color: rgb(68, 68, 68);\"><span class=\"hljs-selector-id\" style=\"color: rgb(136, 0, 0);\">#mapWrap<\/span> {\r\n    <span class=\"hljs-attribute\" style=\"font-weight: 700;\">width<\/span>: <span class=\"hljs-number\" style=\"color: rgb(136, 0, 0);\">100%<\/span>;\r\n    <span class=\"hljs-attribute\" style=\"font-weight: 700;\">height<\/span>: <span class=\"hljs-number\" style=\"color: rgb(136, 0, 0);\">400px<\/span>; \r\n}<\/span>    \r\n<span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;\/<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">style<\/span>&gt;<\/span><\/pre>\n<p>Initialize the OpenStreetMap with Leaflet object using JavaScript:<\/p>\n<ul>\n<li>Define infowindow content, latitude, and longitude of multiple locations in the locations array.<\/li>\n<li>Initialize <code>L.map()<\/code> with the selector element (<code>mapWrap<\/code>) and set the first location as the initial marker position on the map.<\/li>\n<li>Loop through the locations,\n<ul>\n<li>Set the marker position with latitude &#038; longitude using the <code>L.marker()<\/code> method.<\/li>\n<li>Set popup content to be displayed in the info window using the <code>bindPopup()<\/code> method.<\/li>\n<li>Set the zoom level on marker click event.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<pre style=\"color: rgb(95, 94, 78);\"><span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">script<\/span>&gt;<\/span>\r\n<span style=\"color: rgb(110, 107, 94);\"><span class=\"hljs-comment\" style=\"color: rgb(125, 122, 104);\">\/\/ Define multiple markers location, latitude, and longitude<\/span>\r\n<span class=\"hljs-keyword\" style=\"color: rgb(184, 84, 212);\">const<\/span> locations = [\r\n    [<span class=\"hljs-string\" style=\"color: rgb(96, 172, 57);\">'&lt;b&gt;Brooklyn Museum&lt;\/b&gt; &lt;br&gt;200 Eastern Pkwy, Brooklyn, NY 11238'<\/span>, <span class=\"hljs-number\" style=\"color: rgb(182, 86, 17);\">40.6713495<\/span>, <span class=\"hljs-number\" style=\"color: rgb(182, 86, 17);\">-73.9637573<\/span>],\r\n    [<span class=\"hljs-string\" style=\"color: rgb(96, 172, 57);\">'&lt;b&gt;Central Library&lt;\/b&gt; &lt;br&gt;10 Grand Army Plaza, Brooklyn, NY 11238'<\/span>, <span class=\"hljs-number\" style=\"color: rgb(182, 86, 17);\">40.6725494<\/span>, <span class=\"hljs-number\" style=\"color: rgb(182, 86, 17);\">-73.9682162<\/span>],\r\n    [<span class=\"hljs-string\" style=\"color: rgb(96, 172, 57);\">'&lt;b&gt;Prospect Park Zoo&lt;\/b&gt; &lt;br&gt;450 Flatbush Ave, Brooklyn, NY 11225'<\/span>, <span class=\"hljs-number\" style=\"color: rgb(182, 86, 17);\">40.6642751<\/span>, <span class=\"hljs-number\" style=\"color: rgb(182, 86, 17);\">-73.9651260<\/span>],\r\n    [<span class=\"hljs-string\" style=\"color: rgb(96, 172, 57);\">'&lt;b&gt;Barclays Center&lt;\/b&gt; &lt;br&gt;620 Atlantic Ave, Brooklyn, NY 11217'<\/span>, <span class=\"hljs-number\" style=\"color: rgb(182, 86, 17);\">40.6826826<\/span>, <span class=\"hljs-number\" style=\"color: rgb(182, 86, 17);\">-73.9754629<\/span>]\r\n];\r\n\r\n<span class=\"hljs-comment\" style=\"color: rgb(125, 122, 104);\">\/\/ Set container element to embed map<\/span>\r\n<span class=\"hljs-keyword\" style=\"color: rgb(184, 84, 212);\">const<\/span> map = L.map(<span class=\"hljs-string\" style=\"color: rgb(96, 172, 57);\">'mapWrap'<\/span>).setView([locations[<span class=\"hljs-number\" style=\"color: rgb(182, 86, 17);\">0<\/span>][<span class=\"hljs-number\" style=\"color: rgb(182, 86, 17);\">1<\/span>], locations[<span class=\"hljs-number\" style=\"color: rgb(182, 86, 17);\">0<\/span>][<span class=\"hljs-number\" style=\"color: rgb(182, 86, 17);\">2<\/span>]], <span class=\"hljs-number\" style=\"color: rgb(182, 86, 17);\">13<\/span>);\r\n\r\n<span class=\"hljs-comment\" style=\"color: rgb(125, 122, 104);\">\/\/ Add copyright attribution<\/span>\r\nL.tileLayer(<span class=\"hljs-string\" style=\"color: rgb(96, 172, 57);\">'https:\/\/{s}.tile.openstreetmap.org\/{z}\/{x}\/{y}.png?{foo}'<\/span>, {\r\n    foo: <span class=\"hljs-string\" style=\"color: rgb(96, 172, 57);\">'bar'<\/span>,\r\n    attribution:<span class=\"hljs-string\" style=\"color: rgb(96, 172, 57);\">'&amp;copy; &lt;a href=\"https:\/\/www.openstreetmap.org\/copyright\"&gt;OpenStreetMap&lt;\/a&gt;'<\/span>}\r\n).addTo(map);\r\n\r\n<span class=\"hljs-comment\" style=\"color: rgb(125, 122, 104);\">\/\/ Add multiple markers to map<\/span>\r\n<span class=\"hljs-keyword\" style=\"color: rgb(184, 84, 212);\">for<\/span> (<span class=\"hljs-keyword\" style=\"color: rgb(184, 84, 212);\">var<\/span> i = <span class=\"hljs-number\" style=\"color: rgb(182, 86, 17);\">0<\/span>; i &lt; locations.length; i++) {\r\n    marker = <span class=\"hljs-keyword\" style=\"color: rgb(184, 84, 212);\">new<\/span> L.marker(\r\n        [locations[i][<span class=\"hljs-number\" style=\"color: rgb(182, 86, 17);\">1<\/span>], locations[i][<span class=\"hljs-number\" style=\"color: rgb(182, 86, 17);\">2<\/span>]]\r\n    )\r\n    .bindPopup(locations[i][<span class=\"hljs-number\" style=\"color: rgb(182, 86, 17);\">0<\/span>])\r\n    .addTo(map);\r\n    \r\n    <span class=\"hljs-comment\" style=\"color: rgb(125, 122, 104);\">\/\/ Set zoom level on marker click<\/span>\r\n    marker.on(<span class=\"hljs-string\" style=\"color: rgb(96, 172, 57);\">'click'<\/span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\" style=\"color: rgb(184, 84, 212);\">function<\/span>(<span class=\"hljs-params\" style=\"color: rgb(182, 86, 17);\">mrk<\/span>) <\/span>{\r\n        map.setView(\r\n            [\r\n                mrk.latlng.lat,\r\n                mrk.latlng.lng\r\n            ],\r\n            <span class=\"hljs-number\" style=\"color: rgb(182, 86, 17);\">14<\/span>\r\n        );\r\n    });\r\n}<\/span>\r\n<span class=\"hljs-tag\" style=\"color: rgb(186, 98, 54);\">&lt;\/<span class=\"hljs-name\" style=\"color: rgb(186, 98, 54);\">script<\/span>&gt;<\/span><\/pre>\n<p>On page load, you will see the map is displayed with multiple markers as per the given latitude &#038; longitude in the locations array. On clicking the marker, the info-window popup will appear over the map with content specified in the locations array.<\/p>\n<p class=\"seeAlso\"><span><\/span><a href=\"https:\/\/www.codexworld.com\/google-maps-with-multiple-markers-using-javascript-api\/\">Google Maps with Multiple Markers and Info Windows using JavaScript<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>OpenStreetMap is a free and open-source platform that is used to embed maps on the website. You can use OpenStreetMap API to embed maps with marker in HTML. Similar to Google Maps, OpenStreetMap is used <\/p>\n","protected":false},"author":1,"featured_media":5583,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[10],"tags":[66,381],"class_list":["post-5581","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript","tag-javascript","tag-openstreetmap","cat-10-id","has_thumb"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>OpenStreetMap with Multiple Markers and Info Windows using JavaScript - CodexWorld<\/title>\n<meta name=\"description\" content=\"Open Street Map with multiple markers - Embed OpenStreetMap in HTML with multiple markers and info window popups using JavaScript. Display map with multiple markers using OpenStreetMap API and Leaflet library.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.codexworld.com\/openstreetmap-with-multiple-markers-info-window-popups-using-javascript\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"OpenStreetMap with Multiple Markers and Info Windows using JavaScript - CodexWorld\" \/>\n<meta property=\"og:description\" content=\"Open Street Map with multiple markers - Embed OpenStreetMap in HTML with multiple markers and info window popups using JavaScript. Display map with multiple markers using OpenStreetMap API and Leaflet library.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.codexworld.com\/openstreetmap-with-multiple-markers-info-window-popups-using-javascript\/\" \/>\n<meta property=\"og:site_name\" content=\"CodexWorld\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:published_time\" content=\"2024-03-21T13:58:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-21T14:00:20+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2024\/03\/embed-openstreetmap-with-multiple-markers-info-window-popups-using-javascript-codexworld.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1080\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"CodexWorld\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@codexworldblog\" \/>\n<meta name=\"twitter:site\" content=\"@codexworldweb\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"CodexWorld\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/openstreetmap-with-multiple-markers-info-window-popups-using-javascript\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/openstreetmap-with-multiple-markers-info-window-popups-using-javascript\\\/\"},\"author\":{\"name\":\"CodexWorld\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\"},\"headline\":\"OpenStreetMap with Multiple Markers and Info Windows using JavaScript\",\"datePublished\":\"2024-03-21T13:58:09+00:00\",\"dateModified\":\"2024-03-21T14:00:20+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/openstreetmap-with-multiple-markers-info-window-popups-using-javascript\\\/\"},\"wordCount\":322,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/openstreetmap-with-multiple-markers-info-window-popups-using-javascript\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2024\\\/03\\\/embed-openstreetmap-with-multiple-markers-info-window-popups-using-javascript-codexworld.png\",\"keywords\":[\"JavaScript\",\"OpenStreetMap\"],\"articleSection\":[\"JavaScript\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/openstreetmap-with-multiple-markers-info-window-popups-using-javascript\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/openstreetmap-with-multiple-markers-info-window-popups-using-javascript\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/openstreetmap-with-multiple-markers-info-window-popups-using-javascript\\\/\",\"name\":\"OpenStreetMap with Multiple Markers and Info Windows using JavaScript - CodexWorld\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/openstreetmap-with-multiple-markers-info-window-popups-using-javascript\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/openstreetmap-with-multiple-markers-info-window-popups-using-javascript\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2024\\\/03\\\/embed-openstreetmap-with-multiple-markers-info-window-popups-using-javascript-codexworld.png\",\"datePublished\":\"2024-03-21T13:58:09+00:00\",\"dateModified\":\"2024-03-21T14:00:20+00:00\",\"description\":\"Open Street Map with multiple markers - Embed OpenStreetMap in HTML with multiple markers and info window popups using JavaScript. Display map with multiple markers using OpenStreetMap API and Leaflet library.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/openstreetmap-with-multiple-markers-info-window-popups-using-javascript\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/openstreetmap-with-multiple-markers-info-window-popups-using-javascript\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/openstreetmap-with-multiple-markers-info-window-popups-using-javascript\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2024\\\/03\\\/embed-openstreetmap-with-multiple-markers-info-window-popups-using-javascript-codexworld.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2024\\\/03\\\/embed-openstreetmap-with-multiple-markers-info-window-popups-using-javascript-codexworld.png\",\"width\":1920,\"height\":1080,\"caption\":\"embed-openstreetmap-with-multiple-markers-info-window-popups-using-javascript-codexworld\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/openstreetmap-with-multiple-markers-info-window-popups-using-javascript\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.codexworld.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"OpenStreetMap with Multiple Markers and Info Windows using JavaScript\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"name\":\"CodexWorld\",\"description\":\"Web &amp; Mobile App Development Company\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.codexworld.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\",\"name\":\"CodexWorld\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"width\":200,\"height\":19,\"caption\":\"CodexWorld\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldweb\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/codexworld\",\"https:\\\/\\\/www.youtube.com\\\/codexworld\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\",\"name\":\"CodexWorld\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"caption\":\"CodexWorld\"},\"description\":\"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.\",\"sameAs\":[\"http:\\\/\\\/www.codexworld.com\",\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldblog\"],\"url\":\"https:\\\/\\\/www.codexworld.com\\\/author\\\/nitya192265\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"OpenStreetMap with Multiple Markers and Info Windows using JavaScript - CodexWorld","description":"Open Street Map with multiple markers - Embed OpenStreetMap in HTML with multiple markers and info window popups using JavaScript. Display map with multiple markers using OpenStreetMap API and Leaflet library.","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:\/\/www.codexworld.com\/openstreetmap-with-multiple-markers-info-window-popups-using-javascript\/","og_locale":"en_US","og_type":"article","og_title":"OpenStreetMap with Multiple Markers and Info Windows using JavaScript - CodexWorld","og_description":"Open Street Map with multiple markers - Embed OpenStreetMap in HTML with multiple markers and info window popups using JavaScript. Display map with multiple markers using OpenStreetMap API and Leaflet library.","og_url":"https:\/\/www.codexworld.com\/openstreetmap-with-multiple-markers-info-window-popups-using-javascript\/","og_site_name":"CodexWorld","article_publisher":"https:\/\/www.facebook.com\/codexworld","article_author":"https:\/\/www.facebook.com\/codexworld","article_published_time":"2024-03-21T13:58:09+00:00","article_modified_time":"2024-03-21T14:00:20+00:00","og_image":[{"width":1920,"height":1080,"url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2024\/03\/embed-openstreetmap-with-multiple-markers-info-window-popups-using-javascript-codexworld.png","type":"image\/png"}],"author":"CodexWorld","twitter_card":"summary_large_image","twitter_creator":"@codexworldblog","twitter_site":"@codexworldweb","twitter_misc":{"Written by":"CodexWorld","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.codexworld.com\/openstreetmap-with-multiple-markers-info-window-popups-using-javascript\/#article","isPartOf":{"@id":"https:\/\/www.codexworld.com\/openstreetmap-with-multiple-markers-info-window-popups-using-javascript\/"},"author":{"name":"CodexWorld","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0"},"headline":"OpenStreetMap with Multiple Markers and Info Windows using JavaScript","datePublished":"2024-03-21T13:58:09+00:00","dateModified":"2024-03-21T14:00:20+00:00","mainEntityOfPage":{"@id":"https:\/\/www.codexworld.com\/openstreetmap-with-multiple-markers-info-window-popups-using-javascript\/"},"wordCount":322,"commentCount":0,"publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"image":{"@id":"https:\/\/www.codexworld.com\/openstreetmap-with-multiple-markers-info-window-popups-using-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2024\/03\/embed-openstreetmap-with-multiple-markers-info-window-popups-using-javascript-codexworld.png","keywords":["JavaScript","OpenStreetMap"],"articleSection":["JavaScript"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.codexworld.com\/openstreetmap-with-multiple-markers-info-window-popups-using-javascript\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.codexworld.com\/openstreetmap-with-multiple-markers-info-window-popups-using-javascript\/","url":"https:\/\/www.codexworld.com\/openstreetmap-with-multiple-markers-info-window-popups-using-javascript\/","name":"OpenStreetMap with Multiple Markers and Info Windows using JavaScript - CodexWorld","isPartOf":{"@id":"https:\/\/www.codexworld.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.codexworld.com\/openstreetmap-with-multiple-markers-info-window-popups-using-javascript\/#primaryimage"},"image":{"@id":"https:\/\/www.codexworld.com\/openstreetmap-with-multiple-markers-info-window-popups-using-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2024\/03\/embed-openstreetmap-with-multiple-markers-info-window-popups-using-javascript-codexworld.png","datePublished":"2024-03-21T13:58:09+00:00","dateModified":"2024-03-21T14:00:20+00:00","description":"Open Street Map with multiple markers - Embed OpenStreetMap in HTML with multiple markers and info window popups using JavaScript. Display map with multiple markers using OpenStreetMap API and Leaflet library.","breadcrumb":{"@id":"https:\/\/www.codexworld.com\/openstreetmap-with-multiple-markers-info-window-popups-using-javascript\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.codexworld.com\/openstreetmap-with-multiple-markers-info-window-popups-using-javascript\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/openstreetmap-with-multiple-markers-info-window-popups-using-javascript\/#primaryimage","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2024\/03\/embed-openstreetmap-with-multiple-markers-info-window-popups-using-javascript-codexworld.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2024\/03\/embed-openstreetmap-with-multiple-markers-info-window-popups-using-javascript-codexworld.png","width":1920,"height":1080,"caption":"embed-openstreetmap-with-multiple-markers-info-window-popups-using-javascript-codexworld"},{"@type":"BreadcrumbList","@id":"https:\/\/www.codexworld.com\/openstreetmap-with-multiple-markers-info-window-popups-using-javascript\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.codexworld.com\/"},{"@type":"ListItem","position":2,"name":"OpenStreetMap with Multiple Markers and Info Windows using JavaScript"}]},{"@type":"WebSite","@id":"https:\/\/www.codexworld.com\/#website","url":"https:\/\/www.codexworld.com\/","name":"CodexWorld","description":"Web &amp; Mobile App Development Company","publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.codexworld.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.codexworld.com\/#organization","name":"CodexWorld","url":"https:\/\/www.codexworld.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","width":200,"height":19,"caption":"CodexWorld"},"image":{"@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldweb","https:\/\/www.linkedin.com\/company\/codexworld","https:\/\/www.youtube.com\/codexworld"]},{"@type":"Person","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0","name":"CodexWorld","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","caption":"CodexWorld"},"description":"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.","sameAs":["http:\/\/www.codexworld.com","https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldblog"],"url":"https:\/\/www.codexworld.com\/author\/nitya192265\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2024\/03\/embed-openstreetmap-with-multiple-markers-info-window-popups-using-javascript-codexworld.png","jetpack_shortlink":"https:\/\/wp.me\/p6bxIh-1s1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/5581","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/comments?post=5581"}],"version-history":[{"count":2,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/5581\/revisions"}],"predecessor-version":[{"id":5584,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/5581\/revisions\/5584"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media\/5583"}],"wp:attachment":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media?parent=5581"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/categories?post=5581"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/tags?post=5581"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}