<!DOCTYPE html>
|
<html lang="en">
|
|
<head>
|
<meta http-equiv="Content-Type" content="text/html; charset=GBK" />
|
<title>数据接口调用</title>
|
<base target="_blank" />
|
<style type="text/css">
|
body {
|
font-size: 12px;
|
font: 11px/18px "Verdana", "Helvetica";
|
}
|
|
textarea {
|
BORDER-RIGHT: #999999 1px solid;
|
PADDING-RIGHT: 2px;
|
BORDER-TOP: #999999 1px solid;
|
PADDING-LEFT: 2px;
|
BACKGROUND: #ffffff;
|
PADDING-BOTTOM: 2px;
|
MARGIN: 0px;
|
FONT: 12px verdana, arial, helvetica, sans-serif;
|
BORDER-LEFT: #999999 1px solid;
|
COLOR: #333333;
|
PADDING-TOP: 2px;
|
BORDER-BOTTOM: #999999 1px solid;
|
WIDTH: 400px;
|
}
|
|
input {
|
BORDER-RIGHT: #999999 1px solid;
|
PADDING-RIGHT: 2px;
|
BORDER-TOP: #999999 1px solid;
|
PADDING-LEFT: 2px;
|
BACKGROUND: #ffffff;
|
PADDING-BOTTOM: 2px;
|
MARGIN: 0px;
|
FONT: 12px verdana, arial, helvetica, sans-serif;
|
BORDER-LEFT: #999999 1px solid;
|
COLOR: #333333;
|
PADDING-TOP: 2px;
|
BORDER-BOTTOM: #999999 1px solid
|
}
|
|
select {
|
BORDER-RIGHT: #999999 1px solid;
|
PADDING-RIGHT: 0px;
|
BORDER-TOP: #cccccc 1px solid;
|
PADDING-LEFT: 0px;
|
BACKGROUND: #ffffff;
|
PADDING-BOTTOM: 0px;
|
MARGIN: 0px;
|
FONT: 12px verdana, arial, helvetica, sans-serif;
|
BORDER-LEFT: #cccccc 1px solid;
|
WIDTH: 200px;
|
COLOR: #333333;
|
PADDING-TOP: 0px;
|
BORDER-BOTTOM: #999999 1px solid
|
}
|
|
h3 {
|
BACKGROUND-COLOR: #eeeeee;
|
PADDING: 4px;
|
}
|
|
dd,
|
#endpoint {
|
margin-left: 20px;
|
}
|
|
.hidden {
|
display: none;
|
}
|
</style>
|
|
<style type="text/css">
|
iframe {
|
border: solid #6b8e23 1px;
|
width: 300px;
|
height: 50px;
|
font-size: 12px;
|
font: 11px/18px "Verdana", "Helvetica";
|
}
|
|
#progress {
|
display: none;
|
}
|
|
#p_out {
|
width: 300px;
|
height: 12px;
|
margin: 10px 0 2px 0;
|
padding: 1px;
|
font-size: 10px;
|
border: solid #6b8e23 1px;
|
}
|
|
#p_in {
|
width: 0%;
|
height: 100%;
|
background-color: #6b8e23;
|
margin: 0;
|
padding: 0;
|
}
|
|
#p_in.error {
|
background-color: red;
|
}
|
|
#m {
|
margin: 0;
|
padding: 0;
|
text-align: center;
|
font-size: 12px;
|
height: 12px;
|
width: 300px;
|
}
|
</style>
|
|
<!-- <script src="../api/lib/OpenLayers.js" type="text/javascript"></script>
|
<script src="../api/lib/Epoch.js" type="text/javascript"></script> -->
|
<!--script src="js/jquery.min.js" type="text/javascript"></script-->
|
<script src="JS/ol.js"></script>
|
|
|
<script src="JS/jquery-3.1.1.min.js"></script>
|
<!-- <script src="js/jquery-migrate-1.2.1.js" type="text/javascript"></script> -->
|
|
<script type="text/javascript">
|
function validateFile(element, ext, ext2) {
|
var str = "选择文件类型不正确,请重新选择!";
|
var pathid = element;
|
var path = pathid.value;
|
if (path == "") {
|
alert("您还没有选择" + element.name + "文件,请先选择该文件!");
|
return false;
|
}
|
var lastindex = path.lastIndexOf(".");
|
if (lastindex == -1) {
|
alert(str);
|
return false;
|
}
|
var dex = path.substring(lastindex, path.length);
|
if (dex != ext) {
|
if (ext2 != null && dex != ext2) {
|
alert(str);
|
pathid.focus();
|
return false;
|
} else {
|
return true;
|
}
|
} else {
|
return true;
|
}
|
}
|
</script>
|
|
<script type="text/javascript">
|
var inter = null;
|
|
function formSubmit(form) {
|
document.getElementById("progress").style.display = "block";
|
document.getElementById('m').innerHTML = "初始化数据...";
|
document.getElementById('p_in').style.width = "0%";
|
document.getElementById('p_in').className = "";
|
window.setTimeout("updateProgress();", 500);
|
}
|
|
function updateProgress() {
|
OpenLayers.Request
|
.GET({
|
url: "http://127.0.0.1:8088/gisserver/dataserver/status",
|
async: true,
|
success: function(request) {
|
var doc = request.responseText;
|
var data = eval('(' + doc + ')');
|
if (data.action == 'transfer') {
|
if (data.status == 'error') {
|
document.getElementById('m').innerHTML = '上传错误:' +
|
data.message;
|
document.getElementById('p_in').className = "error";
|
} else {
|
document.getElementById('m').innerHTML = '已上传:' +
|
data.progress;
|
window.setTimeout("updateProgress();", 200);
|
}
|
document.getElementById('p_in').style.width = data.progress;
|
} else if (data.action == 'import') {
|
if (data.status == 'error') {
|
document.getElementById('m').innerHTML = '导入错误:' +
|
data.message;
|
document.getElementById('p_in').className = "error";
|
} else if (data.status == 'success') {
|
document.getElementById('m').innerHTML = '导入成功';
|
} else {
|
document.getElementById('m').innerHTML = '已导入:' +
|
data.progress;
|
window.setTimeout("updateProgress();", 200);
|
}
|
document.getElementById('p_in').style.width = data.progress;
|
}
|
|
},
|
failure: function() {
|
OpenLayers.Console.error.apply(OpenLayers.Console,
|
arguments);
|
}
|
});
|
}
|
</script>
|
|
</head>
|
|
<body>
|
<!-- <h3>服务接口地址</h3>
|
<div class="tp">
|
<span id="endpoint">http://127.0.0.1:8088/gisserver/dataserver/import</span>
|
</div> -->
|
|
<h3>服务调用示例</h3>
|
<dl class="tp">
|
<dd>
|
<fieldset>
|
<legend>Import </legend>
|
<form action="http://127.0.0.1:8088/gisserver/dataserver/import" method="post" enctype="multipart/form-data" target="progress_iframe" onsubmit="formSubmit(this)">
|
<table>
|
<tr>
|
<th>url</th>
|
<td><input name="url" value="jdbc:postgresql://localhost:5432/cetc" size="50" /> <code>JDBC
|
URL</code>
|
</td>
|
</tr>
|
<tr>
|
<th>driver</th>
|
<td><select name="driver">
|
<option>org.postgresql.Driver</option>
|
<option>com.mysql.jdbc.Driver</option>
|
<option>oracle.jdbc.driver.OracleDriver</option>
|
<option>com.microsoft.sqlserver.jdbc.SQLServerDriver</option>
|
<option>com.sybase.jdbc4.jdbc.SybDriver</option>
|
</select> <code>Driver Class</code>
|
</td>
|
</tr>
|
<tr>
|
<th>username</th>
|
<td><input name="username" value="" size="30" /> <code></code>
|
</td>
|
</tr>
|
<tr>
|
<th>password</th>
|
<td><input name="password" value="" size="30" />
|
</td>
|
</tr>
|
<tr>
|
<th>buildSpatialDB</th>
|
<td><select name="buildSpatialDB">
|
<option>false</option>
|
<option>true</option>
|
</select> <code>如果不是空间数据库, 是否自动初始化</code></td>
|
</tr>
|
|
<tr>
|
<th>name</th>
|
<td><input name="name" value="" size="30" /> <code>表名</code>
|
</td>
|
</tr>
|
<tr>
|
<th>shapefile</th>
|
<td><input name="shapefile" type="file" onchange="validateFile(this,'.shp');" accept=".shp" />
|
<code>(*.shp)</code>
|
</td>
|
</tr>
|
<tr>
|
<th>dbasefile</th>
|
<td><input name="dbasefile" type="file" onchange="validateFile(this,'.dbf');" accept=".dbf" />
|
<code>(*.dbf)</code>
|
</td>
|
</tr>
|
<tr>
|
<th>charset</th>
|
<td><input name="charset" type="text" size="30" /> <code>字符集, 可选</code>
|
</td>
|
</tr>
|
<tr>
|
<th>srs</th>
|
<td><input name="srs" value="" size="30" /> <code>坐标系,
|
可选</code>
|
</td>
|
</tr>
|
<tr>
|
<th>action</th>
|
<td><select name="action">
|
<option>create</option>
|
<option>recreate</option>
|
<option>append</option>
|
</select> <code>导入方式 create: 新建表; recreate: 如果表已存在, 则删除重建; append:
|
如果表已存在, 则添加新数据</code>
|
</td>
|
</tr>
|
<tr>
|
<td colspan="2"><input type="submit" value="提交" />
|
</td>
|
</tr>
|
</table>
|
</form>
|
|
</fieldset>
|
</dd>
|
|
<dd>
|
|
<fieldset>
|
<legend>Import </legend>
|
<form action="http://127.0.0.1:8088/gisserver/dataserver/import" method="post" enctype="multipart/form-data" target="progress_iframe" onsubmit="formSubmit(this)">
|
<table>
|
<tr>
|
<th>url</th>
|
<td><input name="url" value="jdbc:postgresql://localhost:5432/cetc" size="50" /> <code>JDBC
|
URL</code>
|
</td>
|
</tr>
|
<tr>
|
<th>driver</th>
|
<td><select name="driver">
|
<option>org.postgresql.Driver</option>
|
<option>com.mysql.jdbc.Driver</option>
|
<option>oracle.jdbc.driver.OracleDriver</option>
|
<option>com.microsoft.sqlserver.jdbc.SQLServerDriver</option>
|
<option>com.sybase.jdbc4.jdbc.SybDriver</option>
|
</select> <code>Driver Class</code>
|
</td>
|
</tr>
|
<tr>
|
<th>username</th>
|
<td><input name="username" value="" size="30" /> <code></code>
|
</td>
|
</tr>
|
<tr>
|
<th>password</th>
|
<td><input name="password" value="" size="30" />
|
</td>
|
</tr>
|
<tr>
|
<th>buildSpatialDB</th>
|
<td><select name="buildSpatialDB">
|
<option>false</option>
|
<option>true</option>
|
</select> <code>如果不是空间数据库, 是否自动初始化</code></td>
|
</tr>
|
|
<tr>
|
<th>name</th>
|
<td><input name="name" value="" size="30" /> <code>表名</code>
|
</td>
|
</tr>
|
<tr>
|
<th>excelfile</th>
|
<td><input name="excelfile" type="file" onchange="validateFile(this,'.xls', '.xlsx');" accept=".xls,.xlsx" /> <code>(*.xls|*.xlsx) 注:可通过字段名单元的注释进行类型定制,
|
格式为'M[,D]'</code>
|
</td>
|
</tr>
|
<tr>
|
<th>geoFields</th>
|
<td><input name="geoFields" />
|
<code>Geometry数据字段。
|
如单字段存储,则输入该字段名,数据格式为"x1,y1,x2,y2,...";如双字段存储,则输入两个字段名,输入格式为"f_lat,f_lng"</code>
|
</td>
|
</tr>
|
<tr>
|
<th>geoType</th>
|
<td><select name="geoType">
|
<option>POINT</option>
|
<option>LINESTRING</option>
|
<option>POLYGON</option>
|
</select>
|
<code>Geometry数据类型</code>
|
</td>
|
</tr>
|
<tr>
|
<th>srs</th>
|
<td><input name="srs" value="" size="30" /> <code>坐标系,
|
可选</code>
|
</td>
|
</tr>
|
<tr>
|
<th>action</th>
|
<td><select name="action">
|
<option>create</option>
|
<option>recreate</option>
|
<option>append</option>
|
</select> <code>导入方式 create: 新建表; recreate: 如果表已存在, 则删除重建; append:
|
如果表已存在, 则添加新数据</code>
|
</td>
|
</tr>
|
<tr>
|
<td colspan="2"><input type="submit" value="提交" />
|
</td>
|
</tr>
|
</table>
|
</form>
|
|
|
</fieldset>
|
</dd>
|
|
</dl>
|
|
<div id="progress">
|
<div id="m"></div>
|
<div id="p_out">
|
<div id="p_in"></div>
|
</div>
|
<iframe frameborder="0" id="progress_iframe" name="progress_iframe" src="javascript:void(0)"></iframe>
|
</div>
|
</body>
|
|
</html>
|