首页 / 浏览问题 / 云GIS / 问题详情
缓冲区分析,为啥我的是糊了一层上去?
3EXP 2020年06月03日
map = new SuperMap.Map("map", {
				controls: [
					new SuperMap.Control.Navigation(),
					new SuperMap.Control.Zoom()
				]
			});
			map.addControl(new SuperMap.Control.MousePosition());
			//初始化图层
			layer = new SuperMap.Layer.TiledDynamicRESTLayer("DongXing", url, null, {
				maxResolution: "auto"
			});
			//监听图层信息加载完成事件
			layer.events.on({
				"layerInitialized": addLayer
			});

			//将图层加到地图
			bujianLayer = new SuperMap.Layer.Vector("部件图层");
			roadLayer = new SuperMap.Layer.Vector("道路图层");
			resultLayer = new SuperMap.Layer.Vector("缓冲区图层");
			

			

			function addLayer() {
				//将图层加入到地图
				map.addLayers([layer, bujianLayer, roadLayer,resultLayer]);
				//显示地图范围
				map.setCenter(new SuperMap.LonLat(107.9714026, 21.54921683), 0);

				//加载道路图层
				setTimeout("addRoad()", 1000);
				
				setTimeout("bufferAnalystProcess()", 2000);

			}

			//将道路添加到地图上
			function addRoad() {
				roadLayer.removeAllFeatures();
				var queryParam, queryBySQLParams, queryBySQLService;
				queryParam = new SuperMap.REST.FilterParameter({
					name: "道路中心线@dongxing",
					attributeFilter: "SmID>0"
				});
				queryBySQLParams = new SuperMap.REST.QueryBySQLParameters({
					queryParams: [queryParam]
				});
				queryBySQLService = new SuperMap.REST.QueryBySQLService(url, {
					eventListeners: {
						"processCompleted": (queryEventArgs) => {
							var i, j, feature,
								result = queryEventArgs.result;
							if (result && result.recordsets) {
								for (i = 0; i < result.recordsets.length; i++) {
									if (result.recordsets[i].features) {
										for (j = 0; j < result.recordsets[i].features.length; j++) {
											feature = result.recordsets[i].features[j];
											feature.style = {
												//是否显示描边
												stroke: false
											};
											roadLayer.addFeatures(feature);
										}
									}
								}
							}
						},
						"processFailed": processFailed
					}
				});
				queryBySQLService.processAsync(queryBySQLParams);
			}



			function bufferAnalystProcess() {
				resultLayer.removeAllFeatures();
				var bufferServiceByDatasets = new SuperMap.REST.BufferAnalystService(url2),
					bufferDistance = new SuperMap.REST.BufferDistance({
						value: 10
					}),
					bufferSetting = new SuperMap.REST.BufferSetting({
						endType: SuperMap.REST.BufferEndType.ROUND,
						leftDistance: bufferDistance,
						rightDistance: bufferDistance,
						semicircleLineSegment: 10
					}),
					filterParameter = new SuperMap.REST.FilterParameter({
						attributeFilter: "ROADNAME='广场路'"
					}),
					dsBufferAnalystParameters = new SuperMap.REST.DatasetBufferAnalystParameters({
						dataset: "道路中心线@dongxing",
						filterQueryParameter: filterParameter,
						bufferSetting: bufferSetting
					});
				bufferServiceByDatasets.events.on({
					"processCompleted": (args)=>{
						console.log(args.result.recordset.features,"aaa"); 
						resultLayer.addFeatures(args.result.recordset.features);
					},
					"processFailed": processFailed
				});
				bufferServiceByDatasets.processAsync(dsBufferAnalystParameters);
			}



			function processFailed(e) {
				console.log(e.error.code,e.error.errorMsg);
			}

如果用endType: SuperMap.REST.BufferEndType.ROUND,就整个屏幕是桔黄色的盖住了。

1个回答

您那边的地图是地理坐标系的吧?您说的这个糊是指的什么意思,能截图看下吗?如果您那边使用DatasetBufferAnalyst的话,我建议您可以设置BufferSetting.radiusUnit参数,来明确您那边设置的缓冲区半径分析的长度单位
3,357EXP 2020年06月03日
我这边上传本地图片失败呀 提示缺少图像源文件地址 ,可以加个联系方式吗 私下请教您以下
您可以点击上传,然后选择对应的图片,在点击上传到服务器

我是这样的

...