var resultSetting = new TransportationAnalystResultSetting({ returnEdgeFeatures: true, returnEdgeGeometry: true, returnEdgeIDs: true, returnNodeFeatures: true, returnNodeGeometry: true, returnNodeIDs: true, returnPathGuides: true, returnRoutes: true }); var analystParameter = new TransportationAnalystParameter({ resultSetting: resultSetting, weightFieldName: "SmLength" }); var findTSPPathsParameter = new FindTSPPathsParameters({ endNodeAssigned: false, isAnalyzeById: false, nodes: [{"x":103.8309063,"y":32.7453405},{"x":102.9470697,"y":31.34793928},{"x":104.1419508,"y":30.73949706}], parameter: analystParameter }); var routeLayerStyle = new Style({ stroke: new Stroke({ color: 'rgba(255, 0, 0, 0)', width: 5 }), fill: new Fill({ color: 'rgba(255, 0, 0, 0.1)' }) }); const serviceUrl="http://localhost:8090/iserver/services/transportationAnalyst-UntitledWorkspace/rest/networkanalyst/SiChuan_Network@SiChuan" let self = this; new NetworkAnalystService(serviceUrl).findTSPPaths(findTSPPathsParameter, function (serviceResult) { console.log(serviceResult) serviceResult.result.tspPathList.map(function (result) { try { console.log(result.route) var features = new GeoJSON().readFeatures(result.route); if (features && features.length > 0) { console.log(features) var routeSource = new VectorSource({ features: features }); var pathLayer = new VectorLayer({ source: routeSource, style: routeLayerStyle }); self.map.addLayer(pathLayer); } else { console.warn('No features found in the GeoJSON data.'); } } catch (error) { console.error("Error parsing GeoJSON:", error); } }); }); features有结果