Quick installation

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

This library does not have a CSS file and you only need to add the JavaScript file. Add the JavaScript file to the beginning of the Body tag:

<script type="text/javascript" src="https://api.geobox.ir/libs/geobox-js/geobox.min.js"></script>

Get the JavaScript library

First, download the JavaScript library from the download page, and then follow the steps:

Add the JavaScript file to the beginning of the Body tag:

<script type="text/javascript" src="./js/geobox.min.js"></script>

The structure of the example is as follows:

root
├── js
│ ├── geobox.min.js
└── index.html

After creating the mentioned structure, you have access to the «server» object, which includes methods and properties.

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
    <script type="text/javascript" src="https://api.geobox.ir/libs/geobox-js/geobox.min.js"></script>
</body>
</html>
const server = new Geobox.Server({origin:'https://api.geobox.ir'}); 
server.accessToken = "<your access token here>"; // or server.apikey= "<your apikey here>";

To know the difference between API key and access token, read managing accounts and access tokens.

Leave a comment

Your email address will not be published. Required fields are marked *