自己做个网站需要些什么,html个人主页制作,开发公司运行管理情况建议及意见,114啦怎么建设网站ArcGIS 提供两种网络分析#xff0c;即基于Geometric Network的有向网络或者设施网络和基于Network Dataset的无向网络#xff0c;在这里网络的分析指后者#xff0c;ArcGIS api支持网络分析中的最短路径分析、服务区分析、临近设施分析。本文主要讲的是临近设施分析#x… ArcGIS 提供两种网络分析即基于Geometric Network的有向网络或者设施网络和基于Network Dataset的无向网络在这里网络的分析指后者ArcGIS api支持网络分析中的最短路径分析、服务区分析、临近设施分析。本文主要讲的是临近设施分析关于发布网络服务在这里就不在叙述了三种分析发布相同只是在后台ArcMap中处理方式有点区别。 一、概述 1、概念 临近设施服务计算事件和设施之间的行驶成本并决定那一个距离最近最后给出最佳的路径在这里认为这算是最短距离的升级版本 2、相关的类 ClosestFacilityTask执行命令声明需要一个Rest资源即NAServer服务ClosestFacilityParameters参数ClosestFacilitySolveResult处理结果(这里没用到该类用处非常大)二、参数声明与设置 closestFacilityTask new ClosestFacilityTask(http://localhost:6080/arcgis/rest/services/Test/CloseFacilityTest/NAServer/CloseFacility);//临近设施分析参数var params new ClosestFacilityParameters();//单位params.impedenceAttribute Miles;params.defaultCutoff 7.0;//是否返回事件信息params.returnIncidents false;//是否返回路径params.returnRoutes true;//路径是否有参数params.returnDirections true;//服务点params.facilities new FeatureSet();//事件点params.incidents new FeatureSet();//点障碍params.pointBarriers new FeatureSet();//空间参考params.outSpatialReference map.SpatialReference; 在这里有很多参数可以设置服务点、事件点、路径、空间参考是必须要设置的其他参数可以根据自己需要设置这里FeatureSet是要素类的轻量级的表示相当于地理数据中的一个要素类Feature的集合FeatureSet中的每个Feature可能包含Geometry、属性、符号、InfoTemplate。FeatureSet是api和arcgis server通讯的非常重要的对象。当使用查询、地理出咯i和路径分析的时候FeatureSet常常作为这些分析功能的输入或输出参数。 三、符号样式 //服务点符号样式var facilityPointSymbol new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_SQUARE,20,new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,new Color([89, 95, 35]), 2),new Color([130, 159, 83, 0.40]));//事件点符号样式var incidentPointSymbol new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE,16,new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,new Color([89, 95, 35]), 2),new Color([130, 159, 83, 0.40]));//障碍点的符号样式var barrierSymbol new SimpleMarkerSymbol();barrierSymbol.style SimpleMarkerSymbol.STYLE_X;barrierSymbol.setSize(12);barrierSymbol.setColor(new Color(#f1a340));incidentsGraphicsLayer new GraphicsLayer();//结果路径线符号样式var routePolylineSymbol new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,new Color(#0078df),4.0); 四、分析结果处理 function showRoute(solveResult) {//路径分析的结果var routeResults solveResult.routes;//路径分析的长度var res routeResults.length;if (res 0) {for (var i 0; i res; i) {var graphicroute routeResults[i];var graphic graphicroute;graphic.setSymbol(routePolylineSymbol);map.graphics.add(graphic);}}else {alert(没有返回结果);}} 五、全部源码 !DOCTYPE html
html
headmeta http-equivContent-Type contenttext/html; charsetutf-8meta nameviewport contentinitial-scale1, maximum-scale1,user-scalablenotitleClosest Facilities/titlelink relstylesheet hrefhttps://js.arcgis.com/3.25/dijit/themes/claro/claro.csslink relstylesheet hrefhttps://js.arcgis.com/3.25/esri/css/esri.cssstyle typetext/css#map{width: 100%;height: 600px;border: 1px solid #000;}/stylescript srchttps://js.arcgis.com/3.25//scriptscript src../Scripts/jquery-1.7.1.js/script/headbodydiv idmap/divinput idserver typebutton value服务点 /input ideventPoint typebutton value事件点 /input idbarriers typebutton value障碍点 /input idanalyse typebutton value分析 /input idclear typebutton value清除 /script require([dojo/on,dojo/dom,dojo/_base/array,esri/Color,dojo/parser,dijit/registry,esri/urlUtils,esri/map,esri/lang,esri/graphic,esri/InfoTemplate,esri/layers/GraphicsLayer,esri/renderers/SimpleRenderer,esri/layers/ArcGISDynamicMapServiceLayer,esri/geometry/Point,esri/tasks/FeatureSet,esri/tasks/ClosestFacilityTask,esri/tasks/ClosestFacilityParameters,esri/symbols/SimpleMarkerSymbol,esri/symbols/SimpleLineSymbol,esri/symbols/TextSymbol,dijit/form/ComboBox,dijit/layout/BorderContainer,dijit/layout/ContentPane], function (on, dom, array, Color, parser, registry,urlUtils, Map, esriLang, Graphic, InfoTemplate, GraphicsLayer, SimpleRenderer, ArcGISDynamicMapServiceLayer,Point, FeatureSet,ClosestFacilityTask, ClosestFacilityParameters,SimpleMarkerSymbol, SimpleLineSymbol, TextSymbol) {var incidentsGraphicsLayer, routeGraphicLayer, closestFacilityTask;var map new Map(map);var layer new esri.layers.ArcGISDynamicMapServiceLayer(http://localhost:6080/arcgis/rest/services/Test/CloseFacilityTest/MapServer);map.addLayer(layer)closestFacilityTask new ClosestFacilityTask(http://localhost:6080/arcgis/rest/services/Test/CloseFacilityTest/NAServer/CloseFacility);//临近设施分析参数var params new ClosestFacilityParameters();//单位params.impedenceAttribute Miles;params.defaultCutoff 7.0;//是否返回事件信息params.returnIncidents false;//是否返回路径params.returnRoutes true;//路径是否有参数params.returnDirections true;//服务点params.facilities new FeatureSet();//事件点params.incidents new FeatureSet();//点障碍params.pointBarriers new FeatureSet();//空间参考params.outSpatialReference map.SpatialReference;//服务点符号样式var facilityPointSymbol new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_SQUARE,20,new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,new Color([89, 95, 35]), 2),new Color([130, 159, 83, 0.40]));//事件点符号样式var incidentPointSymbol new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE,16,new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,new Color([89, 95, 35]), 2),new Color([130, 159, 83, 0.40]));//障碍点的符号样式var barrierSymbol new SimpleMarkerSymbol();barrierSymbol.style SimpleMarkerSymbol.STYLE_X;barrierSymbol.setSize(12);barrierSymbol.setColor(new Color(#f1a340));incidentsGraphicsLayer new GraphicsLayer();//结果路径线符号样式var routePolylineSymbol new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,new Color(#0078df),4.0);//定义一个标志//selectPointID0什么都不做//selectPointID1是添加服务点//selectPointID2是添加事件点//selectPointID3是添加障碍点var selectPointID;//添加服务点$(#server).click(function () {selectPointID 1;});//添加事件点$(#eventPoint).click(function () {selectPointID 2;});//添加障碍点$(#barriers).click(function () {selectPointID 3;});//清除所有障碍、事件、服务点和路径线on(map, mouse-down, function (evt) {//通过selectPointID判断是添加是停靠点还是障碍点switch (selectPointID) {case 0:break;case 1://获得服务点的坐标var pointServer evt.mapPoint;var gr new Graphic(pointServer, facilityPointSymbol);//构建服务点的参数params.facilities.features.push(gr);break;case 2://获得事件点的坐标var pointEvent evt.mapPoint;var gr new Graphic(pointEvent, incidentPointSymbol);//构建事件点的参数params.incidents.features.push(gr);break;case 3://获得障碍点的坐标var pointBarrier evt.mapPoint;var gr new Graphic(pointBarrier, barrierSymbol);//构建障碍点的参数params.pointBarriers.features.push(gr);break;}//如果selectPointID不等于0将点的坐标在地图上显示出来if (selectPointID ! 0) {addTextPoint(服务点, pointServer, facilityPointSymbol);addTextPoint(事件点, pointEvent, incidentPointSymbol);addTextPoint(障碍点, pointBarrier, barrierSymbol);}});//文本符号文本信息点坐标符号function addTextPoint(text, point, symbol) {var textSymbol new TextSymbol(text);textSymbol.setColor(new Color([128, 0, 0]));var graphicText Graphic(point, textSymbol);var graphicpoint new Graphic(point, symbol);//用默认的图层添加map.graphics.add(graphicpoint);map.graphics.add(graphicText);}//分析执行事件$(#analyse).click(function () {selectPointID 0;//如果服务点或者事件点的个数有一个为0提示用户参数输入不对if (params.facilities.features.length 0 || params.incidents.features.length 0) {alert(输入参数不全无法分析);return;}//执行路径分析函数closestFacilityTask.solve(params, showRoute)});//处理路径分析返回的结果。function showRoute(solveResult) {//路径分析的结果var routeResults solveResult.routes;//路径分析的长度var res routeResults.length;if (res 0) {for (var i 0; i res; i) {var graphicroute routeResults[i];var graphic graphicroute;graphic.setSymbol(routePolylineSymbol);map.graphics.add(graphic);}}else {alert(没有返回结果);}}});/script
/body
/html六、成果图 七、总结 在这里我为了省事参数设置的不多三种分析其实差别不是很大使用的方式也比较相似如果说恶心应该是在发布数据之前的构造网络错误出一堆奈何我对着不是个很了解浪费了很多的时间技术不行还需要很多努力。 转载于:https://www.cnblogs.com/tuboshu/p/10752345.html