{"id":1339,"date":"2013-06-04T14:52:48","date_gmt":"2013-06-04T12:52:48","guid":{"rendered":"http:\/\/www.switchbl8.nl\/blog\/?p=1339"},"modified":"2013-06-04T14:54:45","modified_gmt":"2013-06-04T12:54:45","slug":"using-google-tiles-in-leafletjs","status":"publish","type":"post","link":"https:\/\/www.switchbl8.nl\/blog\/2013\/06\/using-google-tiles-in-leafletjs\/","title":{"rendered":"Using Google tiles in LeafletJS"},"content":{"rendered":"<p>If you need to use Google&#8217;s tiles in <a href=\"http:\/\/leafletjs.com\/\" title=\"Leaflet - An Open-Source JavaScript Library for Mobile-Friendly Interactive Maps\" target=\"_blank\">LeafletJS<\/a>, you can follow the same URL structure as OpenStreetMap. The tile servers are mt0 .. mt3, and the XYZ are specified a little differently. Here you go:<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\nL.tileLayer('http:\/\/{s}.google.com\/vt\/x={x}&amp;y={y}&amp;z={z}', {\r\n            subdomains : &#x5B;'mt0','mt1','mt2','mt3'],\r\n            attribution: 'Tiles Courtesy of &lt;a href=&quot;http:\/\/maps.google.com&quot; target=&quot;_blank&quot;&gt;Google&lt;\/a&gt;',\r\n            maxZoom: 18\r\n            }).addTo(map);\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>If you need to use Google&#8217;s tiles in LeafletJS, you can follow the same URL structure as OpenStreetMap. The tile servers are mt0 .. mt3, and the XYZ are specified a little differently. Here you go: L.tileLayer(&#8216;http:\/\/{s}.google.com\/vt\/x={x}&amp;y={y}&amp;z={z}&#8217;, { subdomains : &#x5B;&#8217;mt0&#8242;,&#8217;mt1&#8242;,&#8217;mt2&#8242;,&#8217;mt3&#8242;], attribution: &#8216;Tiles Courtesy of &lt;a href=&quot;http:\/\/maps.google.com&quot; target=&quot;_blank&quot;&gt;Google&lt;\/a&gt;&#8217;, maxZoom: 18 }).addTo(map);<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[59,60,98],"class_list":["post-1339","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-gis","tag-google","tag-javascript","category-1-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"_links":{"self":[{"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/posts\/1339","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/comments?post=1339"}],"version-history":[{"count":2,"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/posts\/1339\/revisions"}],"predecessor-version":[{"id":1341,"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/posts\/1339\/revisions\/1341"}],"wp:attachment":[{"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/media?parent=1339"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/categories?post=1339"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.switchbl8.nl\/blog\/wp-json\/wp\/v2\/tags?post=1339"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}