一、使用
<body>
<input type="text" id="fid">
<button onclick="queryByFID()">fid查询</button>
<div id="map_container">
</div>
<script>
var docLayer = new Zondy.Map.Doc('', 'city', {
ip: 'localhost',
port: 6163
})
var map = new ol.Map({
target: "map_container",
layers: [gaodeMapLayer, docLayer],
view: new ol.View({
projection: 'EPSG:4326',
center: [114.30, 30.50],
zoom: 4
})
})
function queryByFID() {
var fid = document.getElementById("fid").value;
console.log(fid)
/* 1、设置查询结构 */
const queryStruct = new Zondy.Service.QueryFeatureStruct();
queryStruct.IncludeGeometry = true;
queryStruct.IncludeWebGraphic = true
/* 2、设置查询参数 */
const queryParam = new Zondy.Service.QueryParameter({
struct:queryStruct,
objectIds:fid
})
/* 3、调用查询服务 */
const queryService = new Zondy.Service.QueryDocFeature(
queryParam,
'city',
0,{
ip:'localhost',
port:6163
}
)
/* 4、回到 */
queryService.query(querySuccess)
}
function querySuccess(result){
var format = new Zondy.Format.PolygonJSON();
var features = format.read(result);
console.log(features);
}
</script>
</body>
</html>