示例网址为https://iclient.supermap.io/examples/leaflet/editor.html#04_bufferAnalystService
示例缓冲区分析为线的缓冲区,我想做一个点的缓冲区,已经将BufferSetting中左边长度删去,也设置成了圆形的缓冲区形状,还将代码中的url改为自己的huanchongurl,将World:Capitals改为Chemical_Factory@EmergDS,把sql条件改为"Name='铝业化工厂'"
但是还是没有效果,不知道是什么原因,我的地图发布是按照经纬度的,而缓冲区是按米的,是不是这个原因?该如何更改?
改后代码为
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title data-i18n="resources.title_bufferAnalystService"></title>
<script type="text/javascript" src="../js/include-web.js"></script>
</head>
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
<div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
<script type="text/javascript" src="../../dist/leaflet/include-leaflet.js"></script>
<script >
var y="http://localhost:8090/iserver/services/map-1/rest/maps/City@EmergDS ";
var dataUrl="http://localhost:8090/iserver/services/data-1/rest/data";
map = L.map('map', {
center: [ 30.61,103.7 ],
maxZoom: 50,
minZoom: 1,
zoom: 14,
zoomControl:false,
});
L.supermap.tiledMapLayer(y).addTo(map);
bufferAnalystProcess();
function bufferAnalystProcess() {
var huanchongurl="http://localhost:8090/iserver/services/spatialAnalysis-1/restjsr/spatialanalyst";
dsBufferAnalystService = L.supermap.spatialAnalystService(huanchongurl);
dsBufferAnalystParameters = new SuperMap.DatasetBufferAnalystParameters({
dataset: "Chemical_Factory@EmergDS",
filterQueryParameter: new SuperMap.FilterParameter({
attributeFilter: "Name='铝业化工厂'"
}),
bufferSetting: new SuperMap.BufferSetting({
endType: SuperMap.BufferEndType.ROUND,
leftDistance: {value: 100},
semicircleLineSegment: 10
})
});
dsBufferAnalystService.bufferAnalysis(dsBufferAnalystParameters, function (serviceResult) {
var result = serviceResult.result;
resultLayer = L.geoJSON(result.recordset.features, {color: "red"}).addTo(map);
});
}
</script>
</body>
</html>
服务什么的都是发了的。