-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
120 lines (115 loc) · 2.47 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Data Extractor Example</title>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
</head>
<body>
<script>
let agUsername = '';
let agPass = '';
let featureCollection = {
layerDefinition: {
geometryType: 'esriGeometryPoint',
drawingInfo: {
renderer: {
type: 'simple',
symbol: {
color: [34, 114, 162, 128],
size: 6,
angle: 0,
xoffset: 0,
yoffset: 0,
type: 'esriSMS',
style: 'esriSMSCircle',
outline: {
color: [34, 114, 162, 255],
width: 1,
type: 'esriSLS',
style: 'esriSLSSolid',
},
},
},
},
spatialReference: { wkid: 4326 },
fields: [
{
name: 'Name',
alias: 'Name',
type: 'esriFieldTypeString',
wfsNamespace: 'http://www.w3.org/2001/XMLSchema',
},
{ name: 'id', type: 'esriFieldTypeGlobalID' },
],
},
featureSet: {
geometryType: 'esriGeometryPoint',
spatialReference: { wkid: 4326 },
features: [
{
attributes: {
Name: 'Test1',
id: 'A034EB7A-5233-446E-829A-BB78998D4A50',
},
geometry: {
x: -94.48588519,
y: 37.15514776,
spatialReference: { wkid: 4326 },
},
},
{
attributes: {
Name: 'Test2',
id: 'ED343E5A-771D-44B3-A28A-12E7635F8FEC',
},
geometry: {
x: -94.48588519,
y: 37.15514776,
spatialReference: { wkid: 4326 },
},
},
],
},
};
axios({
method: 'get',
url: 'https://www.arcgis.com/sharing/generateToken',
params: {
username: agUsername,
password: agPass,
referer: 'http://www.arcgis.com',
f: 'json',
},
}).then((res) => {
let token = res.data.token;
return axios({
method: 'post',
url:
'https://analysis5.arcgis.com/arcgis/rest/services/tasks/GPServer/ExtractData/submitJob',
//headers: { Referer: 'http://www.arcgis.com' },
data: {
f: 'json',
inputLayers: [featureCollection],
clip: false,
dataFormat: 'FILEGEODATABASE',
outputName: {
itemProperties: {
title: 'data-extraction-example',
description:
'File generated from running the Extract Data solution.',
tags: 'Analysis Result, Extract Data',
snippet: 'Analysis File item generated from Extract Data',
folderId: '',
},
},
token: token,
},
});
}).then((res) => {
console.log('JOB RESPONSE');
console.log(res);
});
</script>
</body>
</html>