/
BasicQueryApi.html
200 lines (173 loc) · 8.05 KB
/
BasicQueryApi.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
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<html>
<head>
<title>Basic Query Api</title>
<link rel="stylesheet" href="https://getbootstrap.com/docs/3.3/dist/css/bootstrap.min.css" />
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
<script src="https://getbootstrap.com/docs/3.3/dist/js/bootstrap.min.js"></script>
<style>
.key {
color: red;
}
.split {
color: red;
}
.value {
}
.form-group {
margin-bottom: 5px !important;
}
.control-label {
text-align: left !important;
}
.scriptView {
clear: left;
font-size: 10pt;
max-height: 750px;
min-height: 100px;
display: none;
}
.txtScript {
min-height: 400px;
margin-left: 0px;
}
</style>
<script>
function UrlEncode(val) {
return window.encodeURIComponent ? window.encodeURIComponent(val) : val.replace(/&/g, '%26');
}
function json2html(json) {
var i, ret = "";
ret += "<ul>";
for (i in json) {
ret += "<li><span class=key>" + i + "</span>";
if (typeof json[i] === "object") ret += json2html(json[i]);
else ret += "<span class=split>:</span> <span class=value>" + json[i] + "</span>";
ret += "</li>";
}
ret += "</ul>";
return ret;
}
function ShowHideScript(target) {
if ($(target).is(":visible"))
$(target).hide();
else
$(target).show();
}
</script>
</head>
<body>
<div class="container">
<script id="queryScript">
var GeoType = {
Unknown: 0,
NonSpatial: 1,
Point: 2,
LineString: 4,
Polygon: 8,
MultiPoint: 16,
MultiLineString: 32,
MultiPolygon: 64,
GeometryCollection: 128,
AllSpatial: 254
}
function GetQueryResult(url) {
url = $("#serverUrl").val() + url;
url += "&q=" + UrlEncode($("#q").val());
url += "&wsName=" + UrlEncode($("#wsName").val());
url += "&UserSession=" + UrlEncode($("#token").val());
// opsiyonel parametre. debug için eklendi.
var options = { GetRelatedKeywords: false, SummaryFill: true };
/*
{
ContentIDFilter:[1,2], //optional
Envelope : [LonMin,LatMin,LonMax,LatMax] //optional
LayerIdFilter [-4571215,135159], //optional
int[] KeywordIdFilter:[0,1,4], //optional
CalculateCounts:true/false, //optional default false
SummaryFill:true/false //optional default false
GetRelatedKeywords: true/false //optional default false
}
*/
if (options)
url += "&options=" + UrlEncode(JSON.stringify(options));
var timeStart = new Date();
$("#queryResponse").hide();
$.post(url, { options: JSON.stringify(options) }, function (ok, request2, request) {
if (ok.length == undefined || ok.length > 0) {
var timeString = "";
if (request && request.getResponseHeader && parseFloat(request.getResponseHeader("Dece-Time")) >= 0)
timeString += parseFloat(request.getResponseHeader("Dece-Time")) + " ms";
timeString += " <font color=gray>" + (new Date() - timeStart) + "ms network</font>";
var html = "<h5></i>Response</i></h5>" + timeString + "<br>" + json2html(ok)
$("#queryResponse").html(html);
$("#queryResponse").show();
} else {
$("#queryResponse").hide();
alert("Arama sonucu mevcut değil.");
}
},
'json');
}
</script>
<div class="row">
<h3>Basic Query API</h3>
</div>
<div class="row">
<div class="col-xs-12">
<div class="form-horizontal">
<div class="form-group">
<label class="control-label col-md-1" for="serverUrl">Geodi Url </label>
<div class="col-md-5">
<input class="form-control" type="text" name="serverUrl" id="serverUrl" Value="https://servis2.dece.com.tr">
</div>
</div>
<div class="form-group">
<label class="control-label col-md-1" for="token">Token </label>
<div class="col-md-5">
<input class="form-control" type="text" name="token" id="token" value="EAAAAPKmE0yhQdUt7CzoXlJ2hN4Dm9MvHU5qHETKuKPvNNWNQRroIEcX0m6EnWTocxM4auTjxmZKre0dW6ubbXAZY1elBmsaR8AlZsPyJh5BI6d32EFkFdgXSXaVAjA19TWOu5%2FsRaQ81LZvImhRXtp1AxIWAEYLpcVfUrfMNCVxzz%2BsLPKsZ2%2BlJ%2BMolr6LJWRcF99jgOXojPHNzC63%2BQx%2FRkorOK6ZjJts46C1ACxDyeb7PtLahBiqdYoZvE2c3SpB%2Bp9Ouw51C26fRAKhd1olraHkxYmNKjztlFzUX3SjYJWkABH1FI6DXpLgv87wYR8aUvcZ53vONkrwVxsuV3gUk1ZUd%2F%2BWfYlpwS3f7Wa1BRUV8nt0oSLhuqPcLNzm3%2FTQUFs0tgkx6b%2FQWtWlEwClvyGylcMmb6qLYxsprsehNQ0n5fhEOk9V0B%2BRARNeAdisxQ%3D%3D">
</div>
</div>
<div class="form-group">
<label class="control-label col-md-1" for="wsName">wsName</label>
<div class="col-md-5">
<input type="text" class="form-control" name="wsName" id="wsName" placeholder="Please enter workspace name." value="3003-EN-Travel & Food">
</div>
</div>
<div class="form-group">
<label class="control-label col-md-1" for="serverUrl">Query </label>
<div class="col-md-5">
<input id="q" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-md-1"> </label>
<div class="btn-group col-md-11" role="group">
<button type=button onclick='GetQueryResult("/QueryHandler?op=Query")' class="btn btn-default">Query</button>
<button type=button onclick='GetQueryResult("/QueryHandler?op=GetKeywords")' class="btn btn-default">Get Keywords</button>
<button type=button onclick='GetQueryResult("/QueryHandler?op=GetSummaries")' class="btn btn-default">Get Summaries</button>
<button type=button onclick='GetQueryResult("/QueryHandler?op=GetFacet")' class="btn btn-default">Get Facet</button>
</div>
</div>
</div>
</div>
</div>
<div id=queryResponse class="scriptView" style="overflow:auto"></div>
<a href="javascript:void(0)" onclick="ShowHideScript('#queryScriptDiv')">Show/Hide Script</a><br />
<textarea id="queryScriptDiv" class="row scriptView txtScript form-control" readonly></textarea>
</div>
<script>
function jqLoad() {
if(!window.jQuery) {
window.setTimeout(jqLoad,100);
return;
}
$(document).ajaxError(function (event, data, settings) {
var txt = data.status + ": " + data.statusText + " " + data.responseText;
alert(txt);
});
$("#queryScriptDiv").html($("#queryScript").html());
}
jqLoad();
</script>
</body>
</html>