You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 5, 2021. It is now read-only.
- <a href='https://api.maps4news.com/register'>Sign Up for Maps4News</a>
10
+
- <a href='https://github.com/lord/slate'>Documentation Powered by Slate</a>
11
+
12
+
includes:
13
+
- directory
14
+
15
+
search: true
16
+
---
17
+
18
+
# Examples
19
+
20
+
## Building a Map
21
+
22
+
```Wrapper
23
+
const api = window.api;
24
+
```
25
+
26
+
To build a map via our system, you first need to create a few resources.
27
+
28
+
<br/>
29
+
30
+
```javascript--wrapper
31
+
const job = await api.jobs.new({
32
+
jobTypeId: 1,
33
+
title: "My Map"
34
+
}).save();
35
+
```
36
+
37
+
First a [`Job`](/api/index.html#JobCreateRequest). A Job is a project on the Maps4News Platform.
38
+
39
+
<br/><br/><br/><br/>
40
+
41
+
```javascript--wrapper
42
+
const revision = await job.revisions.new({
43
+
languageCode: "eng",
44
+
mapstyleSetId: 1
45
+
}).save(mapObject);
46
+
```
47
+
48
+
Second a [`Job Revision`](/api/index.html#JobRevisionCreateRequest). A Revision is a point-in-time that the user decided to save his/her current progress in designing their map.
49
+
50
+
A map object must be given to each revision. Revisions can not be updated, each save will result in a new revision.
51
+
52
+
Details about how to build a map object can be found on the [map object page](/dispatcher.html).
53
+
54
+
<br/>
55
+
56
+
```javascript--wrapper
57
+
await revision.build();
58
+
```
59
+
60
+
Lastly, we can queue a build of your map. This will create a `JobResult` resource for that revision.
61
+
62
+
<br/>
63
+
64
+
```javascript--wrapper
65
+
const result = await revision.result();
66
+
```
67
+
68
+
You can access your result via the `result` method on your revision. Except your result to be queued or processing if you get your result directly after queueing a build. It generally takes a few seconds to a few minutes to generate a map.
0 commit comments