Skip to main content

Introduction

Getting started

To get started with the GeoApps Javascript API, you need to include the javascript library provided by your own GeoApps instance. In addition, jQuery need to be included to get everything working:

<link rel="stylesheet" href="https://<tenanturl>/scripts/geoapps/v1/geoapps.min.css" type="text/css" />

<script type="text/javascript" src="https://<tenanturl>/scripts/geoapps/v1/geoapps.min.js"></script>

After adding the scripts above, you can initialize a GeoApps map in your own website. To load a map, you need to retrieve the unique map Id from the GeoApps Manager, and set the map as public.

<html>
<head>
<link rel="stylesheet" href="https://<tenanturl>/scripts/geoapps/v1/geoapps.min.css" type="text/css" />
</head>

<body>
<div id="map"></div>

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript" src="https://<tenanturl>/scripts/geoapps/v1/geoapps.min.js"></script>
<script type="text/javascript">
$(function() {

// Verify if geoapps is found in the window
if(geoapps) {
geoapps.Initialize("<tenanturl>");

var map = geoapps.AddMap("map", "<id>"); // id need to be replaced with the id of the map
map.Controls.AddZoomControls(); // Add zoom buttons to the map
}
});
</script>
</body>
</html>

Accessing protected resources

To access protected maps, or use proteced functions like drawing, you need to generate an access token and change the initialization procedure of the map. After logging in on GeoApps, you can visit https://login.geoapps.nl/token/generatePAT to generate a token. Be carefull: keep the token private! It is at the moment not possible to revoke a specific token, only all your tokens can be revoked by our supportdesk.

After generating a token, you need to update the initialization to the following:

geoapps.Initialize("<tenanturl>", {
authorize: "token",
token: "<token>" // Replace this value with the token that is retrieved through GeoApps
});