{"id":5996,"date":"2022-12-28T15:41:24","date_gmt":"2022-12-28T12:11:24","guid":{"rendered":"https:\/\/en.geobox.ir\/developers\/?post_type=docs&#038;p=5996"},"modified":"2023-01-19T16:31:44","modified_gmt":"2023-01-19T13:01:44","slug":"quick-installation-2","status":"publish","type":"docs","link":"https:\/\/en.geobox.ir\/developers\/docs\/geobox-api-for-leaflet\/quick-installation-2\/","title":{"rendered":"Quick installation"},"content":{"rendered":"<p>First, receive a token or API key for your project through the <a href=\"https:\/\/api.geobox.ir\">Geobox portal<\/a>. Read <a href=\"https:\/\/www.geobox.ir\/doc\/v1\/%d9%85%d8%af%db%8c%d8%b1%db%8c%d8%aa-%d8%ad%d8%b3%d8%a7%d8%a8%d9%87%d8%a7-%d9%88-%d8%aa%d9%88%da%a9%d9%86%d9%87%d8%a7%db%8c-%d8%af%d8%b3%d8%aa%d8%b1%d8%b3%db%8c\/%d8%aa%d9%86%d8%b8%db%8c%d9%85%d8%a7%d8%aa-%d8%ad%d8%b3%d8%a7%d8%a8-%da%a9%d8%a7%d8%b1%d8%a8%d8%b1%db%8c\/\">managing accounts and access tokens<\/a> for instructions on how to register and obtain token or api key.<\/p>\n<h3>Get from CDN<\/h3>\n<p>Add the CSS file to the &lt;head&gt; tag:<\/p>\n<pre class=\"EnlighterJSRAW\" dir=\"ltr\" style=\"min-height: 40px;\" data-enlighter-language=\"generic\">&lt;link rel=\"stylesheet\" href=\"https:\/\/api.geobox.ir\/libs\/geobox-leaflet\/geobox-leaflet.min.css\"&gt;\r\n\r\n<\/pre>\n<p style=\"text-align: left;\">Add the JavaScript file to the beginning of the &lt;body&gt; tag:<\/p>\n<pre class=\"EnlighterJSRAW\" dir=\"ltr\" data-enlighter-language=\"generic\">&lt;script type=\"text\/javascript\" src=\"https:\/\/api.geobox.ir\/libs\/geobox-js\/geobox.min.js\"&gt;&lt;\/script&gt;\r\n&lt;script type=\"text\/javascript\"\u00a0src=\"https:\/\/api.geobox.ir\/libs\/geobox-leaflet\/geobox-leaflet.min.js\"&gt;&lt;\/script&gt;<\/pre>\n<h3 style=\"text-align: left;\">Get the JavaScript library<\/h3>\n<p style=\"text-align: left;\">First, download the JavaScript library from the <a href=\"https:\/\/api.geobox.ir\/v1\/auth\/login\/\">download page<\/a>, and then follow the steps:<\/p>\n<p style=\"text-align: left;\">Add the CSS file to the &lt;head&gt; tag:<\/p>\n<pre class=\"EnlighterJSRAW\" dir=\"ltr\" style=\"min-height: 40px;\" data-enlighter-language=\"generic\">&lt;link rel=\"stylesheet\" href=\".\/css\/geobox-leaflet.min.css\"&gt;\r\n\r\n<\/pre>\n<p style=\"text-align: left;\">Add the JavaScript file to the beginning of the &lt;body&gt; tag:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;script type=\"text\/javascript\" src=\".\/js\/geobox.min.js\"&gt;&lt;\/script&gt;\r\n&lt;script type=\"text\/javascript\" src=\".\/js\/geobox-leaflet.min.js\"&gt;&lt;\/script&gt;<\/pre>\n<p style=\"text-align: left;\">The structure of the example is as follows:<\/p>\n<pre class=\"EnlighterJSRAW\" dir=\"ltr\" data-enlighter-language=\"generic\">root\r\n\u251c\u2500\u2500 css\r\n\u2502 \u251c\u2500\u2500 geobox-leaflet.min.css\r\n\u251c\u2500\u2500 js\r\n\u2502 \u251c\u2500\u2500 geobox.min.js\r\n\u2502 \u251c\u2500\u2500 geobox-leaflet.min.js\r\n\u2514\u2500\u2500 index.html<\/pre>\n<p>After creating the mentioned structure, you have access to the \u00abGL\u00bb object, which includes methods and properties.(It should be noted that you can directly access the leaflet library by using the L variable.)<\/p>\n<pre class=\"EnlighterJSRAW\" dir=\"ltr\" data-enlighter-language=\"html\" data-enlighter-group=\"HTML\" data-enlighter-title=\"HTML\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n    &lt;meta charset=\"utf-8\"&gt;\r\n    &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"&gt;\r\n    &lt;link rel=\"stylesheet\" href=\"https:\/\/api.geobox.ir\/libs\/geobox-leaflet\/geobox-leaflet.min.css\"&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n    &lt;div id=\"map\"&gt;&lt;\/div&gt;\r\n    &lt;script type=\"text\/javascript\" src=\"https:\/\/api.geobox.ir\/libs\/geobox-js\/geobox.min.js\"&gt;&lt;\/script&gt;\r\n    &lt;script type=\"text\/javascript\" src=\"https:\/\/api.geobox.ir\/libs\/geobox-leaflet\/geobox-leaflet.min.js\"&gt;&lt;\/script&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<pre class=\"EnlighterJSRAW\" dir=\"ltr\" data-enlighter-language=\"css\" data-enlighter-group=\"HTML\" data-enlighter-title=\"CSS\" data-enlighter-theme=\"enlighter\">#map{\r\n   width:100vw;\r\n   height:100vh;\r\n}\r\nbody{\r\n   margin:0;\r\n   padding:0;\r\n}<\/pre>\n<pre class=\"EnlighterJSRAW\" dir=\"ltr\" data-enlighter-language=\"js\" data-enlighter-title=\"Java Script\" data-enlighter-theme=\"enlighter\">const server = new Geobox.Server({origin:'https:\/\/api.geobox.ir'}); \r\nserver.accessToken = \"&lt;your access token here&gt;\"; \r\nconst map = new GL.Map('map');<\/pre>\n<p class='codepen'  data-height='500' data-theme-id='1' data-slug-hash='rNrxZpK' data-default-tab='result' data-animations='run' data-editable='' data-embed-version='2'>\nSee the Pen <a href=\"https:\/\/codepen.io\/geobox-gl-demo\/pen\/rNrxZpK\">Contact Form \u2013 Pen a Day 20<\/a> by geobox (<a href=\"https:\/\/codepen.io\/geobox-gl-demo\">@geobox-gl-demo<\/a>) on <a href=\"http:\/\/codepen.io\">CodePen<\/a>.1<\/p>\n<script async src=\"https:\/\/cpwebassets.codepen.io\/assets\/embed\/ei.js\"><\/script>\n<p>The above map is a blank map that tools, maps, and published layers can be displayed on it.<\/p>\n<p dir=\"rtl\">\n","protected":false},"excerpt":{"rendered":"<p>First, receive a token or API key for your project through the Geobox portal. Read managing accounts and access tokens for instructions on how to register and obtain token or api key. Get from CDN Add the CSS file to the &lt;head&gt; tag: &lt;link rel=&#8221;stylesheet&#8221; href=&#8221;https:\/\/api.geobox.ir\/libs\/geobox-leaflet\/geobox-leaflet.min.css&#8221;&gt; Add the JavaScript file to the beginning of the [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"doc_category":[35],"doc_tag":[],"class_list":["post-5996","docs","type-docs","status-publish","hentry","doc_category-geobox-api-for-leaflet"],"_links":{"self":[{"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/docs\/5996","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/comments?post=5996"}],"version-history":[{"count":15,"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/docs\/5996\/revisions"}],"predecessor-version":[{"id":6603,"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/docs\/5996\/revisions\/6603"}],"wp:attachment":[{"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/media?parent=5996"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/doc_category?post=5996"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/en.geobox.ir\/developers\/wp-json\/wp\/v2\/doc_tag?post=5996"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}