url_closestService=host+
"transportationAnalystzhongyuan/rest/networkanalyst/Net_way_province@zhongyuan";
function findClosestFacilities(eventPoint) {
drawCandidatePoint.deactivate();
if(!eventPoint){
alert("请选择事件点!");
return;
}
var findClosestFacilitiesService, parameter, analystParameter, resultSetting;
resultSetting = new SuperMap.REST.TransportationAnalystResultSetting({
returnEdgeFeatures: true,
returnEdgeGeometry: true,
returnEdgeIDs: true,
returnNodeFeatures: true,
returnNodeGeometry: true,
returnNodeIDs: true,
returnPathGuides: true,
returnRoutes: true
});
var weightFieldName = "SmLength";
analystParameter = new SuperMap.REST.TransportationAnalystParameter({
resultSetting: resultSetting,
weightFieldName : weightFieldName
});
parameter = new SuperMap.REST.FindClosestFacilitiesParameters({
event: eventPoint,
expectFacilityCount: 1,
isAnalyzeById: false,
facilities: facilityPoints,
parameter: analystParameter
});
findClosestFacilitiesService = new SuperMap.REST.FindClosestFacilitiesService(url_closestService, {
eventListeners: { "processCompleted": processCompleted }
});
findClosestFacilitiesService.processAsync(parameter);
}
function processCompleted(findClosestFacilitiesEventArgs) {
var result = findClosestFacilitiesEventArgs.result;
var features = [];
alert(result.facilityPathList);
if (result.facilityPathList) {
for (var i = 0, facilityPathList = result.facilityPathList, len = facilityPathList.length; i < len; i++) {
var feature = new SuperMap.Feature.Vector();
feature.geometry = facilityPathList[i].route;
feature.style = style;
features.push(feature);
}
}
closestLayer.addFeatures(features);
}
事件点和设施点都是不为空的Point数组(经纬度);
网络数据集描述:
权重名称: |
|
转向权重字段名称: |
|
投影坐标系名称: |
Longitude / Latitude Coordinate System---GCS_WGS_1984 |
投影坐标系类型: |
PCS_EARTH_LONGITUDE_LATITUDE |
距离(长度)单位: |
METER |
坐标单位: |
DEGREE |
投影方式的名称: |
null |
投影坐标系的地理坐标系的名称: |
GCS_WGS_1984 |
投影坐标系的地理坐标系的类型: |
GCS_WGS_1984 |
投影坐标系的地理坐标系的空间参照类型: |
SPATIALREF_EARTH_LONGITUDE_LATITUDE |
投影坐标系的地理坐标系的大地参照系类型: |
DATUM_WGS_1984 |
网络数据集所有字段名称:
SmID |
SmSdriW |
SmSdriN |
SmSdriE |
SmSdriS |
SmUserID |
SmResistanceA |
SmResistanceB |
SmLength |
SmTopoError |
SmFNode |
SmTNode |
SmEdgeID |
SmGeometrySize |
SmGeoPosition |
Field_SmUserID |
NAME |
CLASS |
ID1 |
Z |
Field_SmUserID_1 |
然而从服务器返回的结果是:
SuperMap.Util.RequestJSONP.supermap_callbacks[38966677173507820]({"facilityPathList":null},200)