使用产品:supermap-iserver-11.0.1-windows-x64 + iclient for leaflet操作系统:win10 x64
问题详细描述:
执行 findPath 操作时出错,原因是:第1个点没有被捕捉
坐标系是3857,而且添加的两个marker能在地图上正确显示,就在道路上。
function findPathProcess() {
//添加站点
var marker1 = L.marker([36.657713212960374, 114.59746226276602]).addTo(map);
// marker1.bindPopup(resources.text_site1);
var marker2 = L.marker([36.65376290170532, 114.59201053539056]).addTo(map);
// marker2.bindPopup(resources.text_site2);
//创建最佳路径分析服务实例
findPathService = new L.supermap.NetworkAnalystService(serviceUrl);
//创建最佳路径分析参数实例
var resultSetting = new L.supermap.TransportationAnalystResultSetting({
returnEdgeFeatures: true,
returnEdgeGeometry: true,
returnEdgeIDs: true,
returnNodeFeatures: true,
returnNodeGeometry: true,
returnNodeIDs: true,
returnPathGuides: true,
returnRoutes: true
});
var analystParameter = new L.supermap.TransportationAnalystParameter({
resultSetting: resultSetting,
weightFieldName: "changdu"
});
findPathParameter = new L.supermap.FindPathParameters({
isAnalyzeById: false,
nodes: [L.latLng(36.657713212960374,114.59746226276602), L.latLng(36.65376290170532,114.59201053539056)],
parameter: analystParameter
});
console.log('findPathParameter:',findPathParameter)
var myIcon = L.icon({
iconUrl: "../images/walk.png",
iconSize: [20, 20]
});
//进行查找
findPathService.findPath(findPathParameter, function (serviceResult) {
console.log('serviceResult',serviceResult)
// var result = serviceResult.result;
// result.pathList.map(function (result) {
// L.geoJSON(result.route).addTo(map);
// L.geoJSON(result.pathGuideItems, {
// pointToLayer: function (geoPoints, latlng) {
// L.marker(latlng, {icon: myIcon}).addTo(map);
// },
// filter: function (geoJsonFeature) {
// if (geoJsonFeature.geometry && geoJsonFeature.geometry.type === 'Point') {
// return true;
// }
// return false;
// }
// }).addTo(map);
// })
}
)
}