Fetch the repository succeeded.
<!--********************************************************************
* Copyright© 2000 - 2026 SuperMap Software Co.Ltd. All rights reserved.
*********************************************************************-->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title data-i18n="resources.title_mapQueryBySQL"></title>
<style>
#toolbar {
position: absolute;
top: 50px;
right: 10px;
width: 240px;
text-align: center;
z-index: 1000;
border-radius: 4px;
}
</style>
</head>
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
<div id="toolbar" class="panel panel-primary">
<div class='panel-heading'>
<h5 class='panel-title text-center' data-i18n="resources.title_queryBySQL"></h5></div>
<div class='panel-body content'>
<div class='panel'>
<div class='input-group'>
<span class='input-group-addon'>SQL</span>
<input min="0" class="form-control" id="sql" placeholder="SMID < 10" />
</div>
</div>
<input type="button" class="btn btn-default" data-i18n="[value]resources.text_query" onclick="query()"/>
<input type="button" class="btn btn-default" data-i18n="[value]resources.text_input_value_clear" onclick="clearFeatures()"/>
</div>
</div>
<div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
<script type="text/javascript" include="bootstrap" src="../js/include-web.js"></script>
<script type="text/javascript" src="../../dist/leaflet/include-leaflet.js"></script>
<script type="text/javascript">
var host = window.isLocal ? window.server : "https://iserver.supermap.io";
var map, resultLayer,
url = host + "/iserver/services/map-world/rest/maps/World";
map = L.map('map', {
preferCanvas: true,
crs: L.CRS.EPSG4326,
center: {lon: -120, lat: 0},
maxZoom: 18,
zoom: 2
});
new L.supermap.TiledMapLayer(url).addTo(map);
function query() {
clearFeatures();
var sql = document.getElementById("sql").value || "SMID < 10";
var param = new L.supermap.QueryBySQLParameters({
queryParams: {
name: "Capitals@World.1",
attributeFilter: sql
}
});
new L.supermap
.QueryService(url)
.queryBySQL(param).then((serviceResult) => {
var result = serviceResult.result;
resultLayer = L.geoJSON(result.recordsets[0].features).addTo(map);
});
}
function clearFeatures() {
resultLayer && map.removeLayer(resultLayer);
}
</script>
</body>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。