projectgis.html
4.39 KB
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport"
content="initial-scale=1,maximum-scale=1,user-scalable=no">
<title>审批联动</title>
<style>
html, body, #viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<link rel="stylesheet" href="http://192.1.1.234:8184/arcgis_js_api/library/4.6/esri/css/main.css">
<script src="../../libs/jquery/jquery.min.js"></script>
<script src="http://192.1.1.234:8184/arcgis_js_api/library/4.6/init.js"></script>
<script src="../../common/js/config.js"></script>
<script>
/*projectgis.html?no=00-320&layerid=0
*no : 证号
*layerid : 发布的审批图层id
*/
function GetQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null)
return unescape(r[2]);
return null;
}
</script>
<script>
require(
[ "esri/Map", "esri/views/MapView", "esri/layers/TileLayer",
"esri/layers/FeatureLayer", "esri/tasks/support/Query",
"esri/tasks/QueryTask", "esri/layers/GraphicsLayer",
"esri/Graphic","esri/geometry/Point", "esri/PopupTemplate", "dojo/io-query",
"dojo/dom", "dojo/on", "dojo/domReady!" ],
function(Map, MapView, TileLayer, FeatureLayer, Query, QueryTask,
GraphicsLayer, Graphic,Point, PopupTemplate, ioQuery, dom, on) {
GET = ioQuery.queryToObject(decodeURIComponent(dojo.doc.location.search.slice(1)));
var layerid = GET.layerid == null ? 0 : GET.layerid;
var no = GET.no == null ? "" : GET.no;
var level = GET.level==null?5:GET.level;
var mapbase_nanning = new TileLayer(
{
//url : "http://116.10.196.222:6080/arcgis/rest/services/map2012/MapServer",
url:CONF_GIS_URL,
id : "nanning",
opacity : 0.9,
visible : true
});
var popupTemplate = {
title : "{项目名}",
content : "<b>申报单位:</b> {申报单位}" + "<br><b>建设地址:</b> {建设地址}"
+ "<br><b>用地性质:</b> {用地性质}" + "<br><b>证号:</b> {证号}"
+ "<br><b>建筑结构:</b> {建筑结}"
+ "<br><b>案件编号:</b> {案件编}"
+ "<br><b>项目名称:</b> {项目名称}"
+ "<br><b>发证日期:</b> {发证日}" + "<br><b>备注:</b> {备注}"
};
/*var featureLayer = new FeatureLayer(
{
url:SDE_SP_DATA,
outFields : [ "*" ]
});
var fields = featureLayer.fields;*/
var graphicsLayers = new GraphicsLayer();
var map = new Map();
function showgeometry(point, atts) {
var type = "";
if (point.type == "point") {
type = "simple-marker";
} else if (point.type == "polyline") {
type = "simple-line";
} else if (point.type == "polygon") {
type = "simple-fill";
}
var markerSymbol = {
type : type, // autocasts as new SimpleMarkerSymbol()
color : "#8A2BE2",
width : "4",
style : "solid"
/*type: type,
color: [226, 119, 40],
outline: {
color: [255, 255, 255],
width: 3
}*/
};
var pointGraphic = new Graphic({
geometry : point,
symbol : markerSymbol,
attributes : atts
});
pointGraphic.popupTemplate = popupTemplate;
graphicsLayers.add(pointGraphic);
view.goTo({
target : point,
zoom : level
});
}
map.add(mapbase_nanning);
map.add(graphicsLayers);
//map.add(featureLayer);
var view = new MapView({
container : "viewDiv",
map : map
});
//view.center=[537545.50,2524416.44];
//view.zoom=4;
var queryTask = new QueryTask(layerid);
var query = new Query();
query.returnGeometry = true;
query.outFields = [ "*" ];
function execute(certificateno) {
query.where = "证号 = '" + certificateno + "'";
queryTask.execute(query).then(
function(results) {
//console.log(results.features[0].getAttribute("备注"));
//console.log(results.features[0]);
showgeometry(results.features[0].geometry,
results.features[0].attributes);
});
}
view.when(function() {
/*var pt = new Point({
latitude: 537545.50,
longitude: 2524416.44
});
view.goTo({
target : pt,
zoom : 4
});*/
execute(no);
},
function(error) {
console.log(
"The view's resources failed to load: ",
error);
});
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html>