-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupdateFeatureStatus.html
69 lines (60 loc) · 2.54 KB
/
updateFeatureStatus.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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Update ODFW Feature Status</title>
<script src="http://js.arcgis.com/3.13/"></script>
<script>
var map,
fpServiceUrl = "http://services.arcgis.com/uUvqNMGPm7axC2dD/arcgis/rest/services/OregonFishPassageBarriers/FeatureServer/0",
projID;
require([
"esri/graphic",
"esri/config",
"esri/layers/FeatureLayer",
"esri/tasks/query", "esri/tasks/QueryTask",
"dojo/parser",
"dojo/domReady!"
], function (Graphic,
esriConfig,
FeatureLayer, Query, QueryTask,
parser
) {
parser.parse();
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for (var i = 0; i < hashes.length; i++) {
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
projID = vars.length > 0 ? vars.projID : "";
if (projID !== "") {
// refer to "Using the Proxy Page" for more information: https://developers.arcgis.com/javascript/jshelp/ags_proxy.html
esriConfig.defaults.io.proxyUrl = "proxy.ashx";
var fpBarrierService = new FeatureLayer(fpServiceUrl, {
mode: FeatureLayer.MODE_SNAPSHOT,
outFields: ["*"]
});
var query = new Query();
query.returnGeometry = false;
query.outFields = ["*"];
query.where = "OWEB_userid = '12'";
fpBarrierService.queryFeatures(query, function (results) {
var updateFeatures = [];
for (var x = 0; x < results.features.length; x++) {
var feature = new Graphic();
feature.setAttributes({ "OBJECTID": results.features[x].attributes.OBJECTID, "OWEB_status": "2" });
updateFeatures.push(feature);
}
fpBarrierService.applyEdits(null, updateFeatures, null);
});
}
});
</script>
</head>
<body>
Page to update ODFW Oweb status for completed applications. Call this page adding the project id in the url like<br />
updateFeatureStatus.html?projID=12
</body>
</html>