-
Notifications
You must be signed in to change notification settings - Fork 1
/
geodb.js
65 lines (58 loc) · 2.35 KB
/
geodb.js
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
// arcgis db
require([
"esri/Map",
"esri/views/MapView",
"esri/layers/FeatureLayer",
"esri/Graphic",
"esri/widgets/Search",
"esri/geometry/Point",
"dojo/dom",
"esri/geometry/SpatialReference",
"dojo/on",
"dojo/domReady!"
], function (
Map,
MapView,
FeatureLayer,
Graphic,
Search,
Point,
dom,
SpatialReference,
on
) {
var featureLayer = new FeatureLayer({
url: "https://services9.arcgis.com/2882Ggz2LB0PQSyP/arcgis/rest/services/school/FeatureServer/0?token=iLQQmXt9_h8cCP2k67wzt5AmzaSNxUW90zoJHgLEAidBVcVY9Hgc8gB_TbOSRE4xPTQWRlIdZ73sYXJi-_VmHCr1N0MZLLR2ZPCxRa5Xly6kRFRZkwvw7m4cwuoWplIclj7ibyvpQp-OjfMgaeqptJyOQxfBqF4p8NI_XlH5e_cR38tySvUL0MtmGTOJFj5RWBsfjNL5PxXOwlc5l7ZWx8hHz5Coy7KUNdrzsM5dfzWx2BWyVhLCxLENaMkxEcbU",
outFields: ["*"],
});
on(document.getElementById('update'), 'click', function () {
//create the feature
var feature = new Graphic();
var geometry = new Point({
type: "point",
x: document.getElementById('long').value,
y: document.getElementById('lat').value,
// spatialReference: new SpatialReference({wkid: 32644})
});
feature.geometry = geometry;
feature.attributes = {
"NAME_OF_THE_SCHOOL": document.getElementById('sName').value,
"EMAIL_ADDRESS_OF_THE_SCHOOL": document.getElementById('sEmail').value,
"LATITUDE": document.getElementById('lat').value,
"LONGITUDE": document.getElementById('long').value,
"NAME_OF_THE_STATE": document.getElementById('state').value,
"TOTAL_NUMBER_OF_STUDENTS": document.getElementById('ns').value,
"NUMBER_OF_10_GRADE_STUDENTS": document.getElementById('tenclassstu').value,
"NUMBER_OF_STUDENTS_JOINED_THROUGH_EDUCATING_BLIND": document.getElementById('ebs').value
};
//add to the featureLayer
var promise = featureLayer.applyEdits({
addFeatures: [feature]
});
promise.then(function (res) {
console.log('new OBJECTID:', res.addFeatureResults[0].objectId);
}, function (err) {
console.error(err);
});
});
});