Jump to content

isti

Inactive Members
  • Content Count

    9
  • Joined

  • Last visited

Community Reputation

0 Neutral

About isti

  • Rank
    Undergraduate

Profile Information

  • Gender
    Female
  • Location
    Indonesia
  1. Dear All, Hereby I wanna share my concern, I try to build a network analyst in flex, with the closest facility. The problem was occurred while the process of solving closest route to find the incident. In arcgis desktop, there is no problem about the distance between incident and facility, the route can be solve greatly. But while I publish in arcgis server and I set as the input data in flex, the distance is limit. the closest route is only solve when the distance between incident and facility less than 1 meters. Is there any parameter that I missed while I publish?Or Is there any procedure to manage the maximum distance of the closest route? thanks for the responses. regards isti
  2. isti

    network analyst in flex

    <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:esri="http://www.esri.com/2008/ags" pageTitle="Closest Facility sample"> <!-- Description: This sample demonstrates how to work with ClosestFacilityTask. The ClosestFacilityTask is used to find the closest facilities around an input location. The ClosestFacilityParameters object is used to define how many facilities to find and various other properties, such as travel direction and cutoff. The closest facility solver measures the cost of traveling between incidents and facilities and determines which are nearest to one other. When finding closest facilities, you can specify how many to find and whether the direction of travel is toward or away from them. The closest facility solver displays the best routes between incidents and facilities, reports their travel costs, and returns driving directions. Documentation: For more information, see the API documentation. http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/events/ClosestFacilityEvent.html http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/tasks/ClosestFacilityTask.html http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/tasks/supportClasses/ClosestFacilityParameters.html http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/tasks/supportClasses/ClosestFacilitySolveResult.html http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/tasks/supportClasses/NAMessage.html ArcGIS REST API documentation: http://resources.arcgis.com/en/help/rest/apiref/naserver.html http://resources.arcgis.com/en/help/rest/apiref/nalayer.html http://resources.arcgis.com/en/help/rest/apiref/cfSolve.html ArcGIS for Server documentation: http://resources.arcgis.com/en/help/main/10.1/index.html#/Network_analysis_services/015400000276000000/ ArcGIS for Desktop documentation: http://resources.arcgis.com/en/help/main/10.1/index.html#/What_is_the_ArcGIS_Network_Analyst_extension/004700000001000000/ http://resources.arcgis.com/en/help/main/10.1/index.html#/About_the_ArcGIS_Network_Analyst_extension_tutorial/00470000005r000000/ http://resources.arcgis.com/en/help/main/10.1/index.html#/Closest_facility_analysis/00470000004n000000/ NOTE: In order to support this workflow (author and publish the services) in your own environment, you will need a streets network dataset such as StreetMap Premium for ArcGIS, ArcGIS Network Analyst for Desktop, and ArcGIS Network Analyst for Server. --> <fx:Style> @namespace mx "library://ns.adobe.com/flex/mx"; mx|ToolTip { font-size: 14; backgroundColor: #EEEEEE; } </fx:Style> <fx:Script> <![CDATA[ import com.esri.ags.FeatureSet; import com.esri.ags.Graphic; import com.esri.ags.SpatialReference; import com.esri.ags.events.ClosestFacilityEvent; import com.esri.ags.events.MapEvent; import com.esri.ags.events.MapMouseEvent; import com.esri.ags.geometry.MapPoint; import com.esri.ags.tasks.supportClasses.NAMessage; import mx.controls.Alert; import mx.rpc.events.FaultEvent; [Bindable]private var incidents:FeatureSet = new FeatureSet([]); private function myMap_loadHandler(event:MapEvent):void { var facilitiesSet:FeatureSet = new FeatureSet([]); var facility1:Graphic = new Graphic(new MapPoint(103.97772701878839, -5.720166185589641, myMap.spatialReference), null, { Name: "Hyatt" }); var facility2:Graphic = new Graphic(new MapPoint(101.517737, -8.252759, myMap.spatialReference), null, { Name: "Hyatt" }); var facility3:Graphic = new Graphic(new MapPoint(106.437474, -5.468513, myMap.spatialReference), null, { Name: "Hyatt" }); var facility4:Graphic = new Graphic(new MapPoint(106.423958, -8.077054, myMap.spatialReference), null, { Name: "Hyatt" }); var facility5:Graphic = new Graphic(new MapPoint(106.937557, -3.360054, myMap.spatialReference), null, { Name: "Tin Fish" }); facilitiesSet.features.push(facility1, facility2, facility3, facility4, facility5); facilitiesGraphicsLayer.graphicProvider = facilitiesSet.features; cfParams.facilities = facilitiesSet; cfParams.outSpatialReference = myMap.spatialReference; } private function myMap_mapClickHandler(event:MapMouseEvent):void { clearClosestFacility(); var incident:Graphic = new Graphic(event.mapPoint, null, { Name: "My Location" }); incidentsGraphicsLayer.add(incident); incidents.features.push(incident); cfTask.solve(cfParams); } private function solveCompleteHandler(event:ClosestFacilityEvent):void { var routes:Array = []; for (var i:int = 0; i < event.closestFacilitySolveResult.routes.length; i++) { var r:Graphic = event.closestFacilitySolveResult.routes; r.toolTip = r.attributes.Name; if (r.attributes.Total_TravelTime) { r.toolTip += " in " + Math.round(Number(r.attributes.Total_TravelTime * 60)) + " seconds."; } routes.push(r); } // Check for messages if (event.closestFacilitySolveResult.messages.length > 0) { var msg:NAMessage = event.closestFacilitySolveResult.messages[0] as NAMessage; incidentsGraphicsLayer.remove(incidents.features.pop()); Alert.show("Unexpected Message:\n\n" + msg.description, "Closest Facility Error " + msg.type); } routes.reverse(); // to get the route with the lowest time rendered first routeGraphicsLayer.graphicProvider = routes; } private function faultHandler(event:FaultEvent):void { Alert.show(event.fault.faultString + "\n\n" + event.fault.faultDetail, "Closest Facility Error " + event.fault.faultCode); // remove the last incident incidentsGraphicsLayer.remove(incidents.features.pop()); } private function clearButton_clickHandler(event:MouseEvent):void { clearClosestFacility(); } private function clearClosestFacility():void { routeGraphicsLayer.clear(); incidentsGraphicsLayer.clear(); incidents = new FeatureSet([]); } ]]> </fx:Script> <fx:Declarations> <esri:ClosestFacilityTask id="cfTask" concurrency="last" fault="faultHandler(event)" requestTimeout="30" showBusyCursor="true" solveComplete="solveCompleteHandler(event)" url="http://localhost:6080/arcgis/rest/services/BB_percobaan_closest/NAServer/Closest%20Facility"/> <esri:ClosestFacilityParameters id="cfParams" defaultCutoff="5" defaultTargetFacilityCount="{int(facilityCount.selectedItem)}" incidents="{incidents}" returnDirections="true" returnIncidents="true" returnRoutes="true"/> <esri:SimpleMarkerSymbol id="incidentSymbol" color="0xB0000F" size="20" style="triangle"> <esri:SimpleLineSymbol width="3" color="0x81000B"/> </esri:SimpleMarkerSymbol> <esri:SimpleMarkerSymbol id="facilitySymbol" color="0x589426" size="18" style="circle"> <esri:SimpleLineSymbol width="3" color="0x3B631A"/> </esri:SimpleMarkerSymbol> </fx:Declarations> <s:controlBarLayout> <s:VerticalLayout gap="10" paddingBottom="7" paddingLeft="10" paddingRight="10" paddingTop="7"/> </s:controlBarLayout> <s:controlBarContent> <s:RichText width="100%"> This sample demonstrates how to work with ClosestFacilityTask. The ClosestFacilityTask is used to find the closest facilities around an input location. The ClosestFacilityParameters object is used to define how many facilities to find and various other properties, such as travel direction and cutoff. </s:RichText> <s:HGroup verticalAlign="baseline"> <s:Label text="Click on map to add incidents and find routes for the "/> <s:DropDownList id="facilityCount" width="45" requireSelection="true" selectedIndex="2"> <s:ArrayList> <fx:int>1</fx:int> <fx:int>2</fx:int> <fx:int>3</fx:int> <fx:int>4</fx:int> <fx:int>5</fx:int> </s:ArrayList> </s:DropDownList> <s:Label text="closest facilities."/> </s:HGroup> <s:Button id="clearButton" click="clearButton_clickHandler(event)" label="Clear incidents and routes"/> </s:controlBarContent> <esri:Map id="myMap" load="myMap_loadHandler(event)" mapClick="myMap_mapClickHandler(event)"> <esri:extent> <esri:Extent xmin="105.37767525215254" ymin="-6.621948913528887" xmax="106.33421857649633" ymax=" -6.112744258281206"> <esri:SpatialReference wkid="4326"/> </esri:Extent> </esri:extent> <esri:ArcGISDynamicMapServiceLayer url="http://localhost:6080/arcgis/rest/services/service_peta_OYU/MapServer"/> <esri:GraphicsLayer id="routeGraphicsLayer"> <esri:renderer> <!--<esri:ClassBreaksRenderer field="Total_TravelTime"> <esri:ClassBreakInfo maxValue="0.50" symbol="{new SimpleLineSymbol('solid', 0xCF0000, 0.8, 6)}"/> <esri:ClassBreakInfo maxValue="1.00" minValue="0.50" symbol="{new SimpleLineSymbol('solid', 0xEF0E0E, 0.8, 6)}"/> <esri:ClassBreakInfo minValue="1.00" symbol="{new SimpleLineSymbol('solid', 0xFF2F2F, 0.8, 6)}"/> </esri:ClassBreaksRenderer>--> <esri:UniqueValueRenderer> <esri:UniqueValueInfo label="First" symbol="{new SimpleLineSymbol('solid', 0x4CBD36, 1.0, 6)}" value="1"/> <esri:UniqueValueInfo label="Second" symbol="{new SimpleLineSymbol('solid', 0x2C32BD, 1.0, 6)}" value="2"/> <esri:UniqueValueInfo label="Third" symbol="{new SimpleLineSymbol('solid', 0x3ABABD, 1.0, 6)}" value="3"/> <esri:UniqueValueInfo label="Fourth" symbol="{new SimpleLineSymbol('solid', 0xBDAF3B, 1.0, 6)}" value="4"/> <esri:UniqueValueInfo label="Fifth" symbol="{new SimpleLineSymbol('solid', 0xBD433A, 1.0, 6)}" value="5"/> </esri:UniqueValueRenderer> </esri:renderer> </esri:GraphicsLayer> <esri:GraphicsLayer id="facilitiesGraphicsLayer" symbol="{facilitySymbol}"/> <esri:GraphicsLayer id="incidentsGraphicsLayer" symbol="{incidentSymbol}"/> </esri:Map> </s:Application>
  3. isti

    network analyst in flex

    here are the full scripts,,thanks
  4. isti

    network analyst in flex

    Those script are same as the default network analyst in arcgis for flex. I just modify the input map, and my network analyst service. But the difference is in my application can not solve the route.
  5. isti

    network analyst in flex

    <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:esri="http://www.esri.com/2008/ags" pageTitle="Closest Facility sample"> <!-- Description: This sample demonstrates how to work with ClosestFacilityTask. The ClosestFacilityTask is used to find the closest facilities around an input location. The ClosestFacilityParameters object is used to define how many facilities to find and various other properties, such as travel direction and cutoff. The closest facility solver measures the cost of traveling between incidents and facilities and determines which are nearest to one other. When finding closest facilities, you can specify how many to find and whether the direction of travel is toward or away from them. The closest facility solver displays the best routes between incidents and facilities, reports their travel costs, and returns driving directions. Documentation: For more information, see the API documentation. http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/events/ClosestFacilityEvent.html http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/tasks/ClosestFacilityTask.html http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/tasks/supportClasses/ClosestFacilityParameters.html http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/tasks/supportClasses/ClosestFacilitySolveResult.html http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/tasks/supportClasses/NAMessage.html ArcGIS REST API documentation: http://resources.arcgis.com/en/help/rest/apiref/naserver.html http://resources.arcgis.com/en/help/rest/apiref/nalayer.html http://resources.arcgis.com/en/help/rest/apiref/cfSolve.html ArcGIS for Server documentation: http://resources.arcgis.com/en/help/main/10.1/index.html#/Network_analysis_services/015400000276000000/ ArcGIS for Desktop documentation: http://resources.arcgis.com/en/help/main/10.1/index.html#/What_is_the_ArcGIS_Network_Analyst_extension/004700000001000000/ http://resources.arcgis.com/en/help/main/10.1/index.html#/About_the_ArcGIS_Network_Analyst_extension_tutorial/00470000005r000000/ http://resources.arcgis.com/en/help/main/10.1/index.html#/Closest_facility_analysis/00470000004n000000/ NOTE: In order to support this workflow (author and publish the services) in your own environment, you will need a streets network dataset such as StreetMap Premium for ArcGIS, ArcGIS Network Analyst for Desktop, and ArcGIS Network Analyst for Server. --> <fx:Style> @namespace mx "library://ns.adobe.com/flex/mx"; mx|ToolTip { font-size: 14; backgroundColor: #EEEEEE; } </fx:Style> <fx:Script> <![CDATA[ import com.esri.ags.FeatureSet; import com.esri.ags.Graphic; import com.esri.ags.SpatialReference; import com.esri.ags.events.ClosestFacilityEvent; import com.esri.ags.events.MapEvent; import com.esri.ags.events.MapMouseEvent; import com.esri.ags.geometry.MapPoint; import com.esri.ags.tasks.supportClasses.NAMessage; import mx.controls.Alert; import mx.rpc.events.FaultEvent; [Bindable]private var incidents:FeatureSet = new FeatureSet([]); private function myMap_loadHandler(event:MapEvent):void { var facilitiesSet:FeatureSet = new FeatureSet([]); var facility1:Graphic = new Graphic(new MapPoint(-13043098, 3856928, new SpatialReference(102100)), null, { Name: "Hyatt" }); var facility2:Graphic = new Graphic(new MapPoint(-13042125, 3856513, new SpatialReference(102100)), null, { Name: "Tin Fish" }); var facility3:Graphic = new Graphic(new MapPoint(-13042081, 3856754, new SpatialReference(102100)), null, { Name: "The Broken Yolk Cafe" }); var facility4:Graphic = new Graphic(new MapPoint(-13042580, 3857208, new SpatialReference(102100)), null, { Name: "Ralphs" }); var facility5:Graphic = new Graphic(new MapPoint(-13042175, 3856901, new SpatialReference(102100)), null, { Name: "Royal Thai Cuisine" }); var facility6:Graphic = new Graphic(new MapPoint(-13042343, 3857046, new SpatialReference(102100)), null, { Name: "Royal India" }); var facility7:Graphic = new Graphic(new MapPoint(-13042285, 3856726, new SpatialReference(102100)), null, { Name: "Rama" }); facilitiesSet.features.push(facility1, facility2, facility3, facility4, facility5, facility6, facility7); facilitiesGraphicsLayer.graphicProvider = facilitiesSet.features; cfParams.facilities = facilitiesSet; cfParams.outSpatialReference = myMap.spatialReference; } private function myMap_mapClickHandler(event:MapMouseEvent):void { clearClosestFacility(); var incident:Graphic = new Graphic(event.mapPoint, null, { Name: "My Location" }); incidentsGraphicsLayer.add(incident); incidents.features.push(incident); cfTask.solve(cfParams); } private function solveCompleteHandler(event:ClosestFacilityEvent):void { var routes:Array = []; for (var i:int = 0; i < event.closestFacilitySolveResult.routes.length; i++) { var r:Graphic = event.closestFacilitySolveResult.routes[i]; r.toolTip = r.attributes.Name; if (r.attributes.Total_TravelTime) { r.toolTip += " in " + Math.round(Number(r.attributes.Total_TravelTime * 60)) + " seconds."; } routes.push(r); } // Check for messages if (event.closestFacilitySolveResult.messages.length > 0) { var msg:NAMessage = event.closestFacilitySolveResult.messages[0] as NAMessage; incidentsGraphicsLayer.remove(incidents.features.pop()); Alert.show("Unexpected Message:\n\n" + msg.description, "Closest Facility Error " + msg.type); } routes.reverse(); // to get the route with the lowest time rendered first routeGraphicsLayer.graphicProvider = routes; } private function faultHandler(event:FaultEvent):void { Alert.show(event.fault.faultString + "\n\n" + event.fault.faultDetail, "Closest Facility Error " + event.fault.faultCode); // remove the last incident incidentsGraphicsLayer.remove(incidents.features.pop()); } private function clearButton_clickHandler(event:MouseEvent):void { clearClosestFacility(); } private function clearClosestFacility():void { routeGraphicsLayer.clear(); incidentsGraphicsLayer.clear(); incidents = new FeatureSet([]); } ]]> </fx:Script> <fx:Declarations> <esri:ClosestFacilityTask id="cfTask" concurrency="last" fault="faultHandler(event)" requestTimeout="30" showBusyCursor="true" solveComplete="solveCompleteHandler(event)" url="http://localhost:6080/arcgis/rest/services/BB_percobaan_closest/NAServer/Closest%20Facility"/> <esri:ClosestFacilityParameters id="cfParams" defaultCutoff="5" defaultTargetFacilityCount="{int(facilityCount.selectedItem)}" incidents="{incidents}" returnDirections="true" returnIncidents="true" returnRoutes="true"/> <esri:SimpleMarkerSymbol id="incidentSymbol" color="0xB0000F" size="20" style="triangle"> <esri:SimpleLineSymbol width="3" color="0x81000B"/> </esri:SimpleMarkerSymbol> <esri:SimpleMarkerSymbol id="facilitySymbol" color="0x589426" size="18" style="circle"> <esri:SimpleLineSymbol width="3" color="0x3B631A"/> </esri:SimpleMarkerSymbol> </fx:Declarations> <s:controlBarLayout> <s:VerticalLayout gap="10" paddingBottom="7" paddingLeft="10" paddingRight="10" paddingTop="7"/> </s:controlBarLayout> <s:controlBarContent> <s:RichText width="100%"> This sample demonstrates how to work with ClosestFacilityTask. The ClosestFacilityTask is used to find the closest facilities around an input location. The ClosestFacilityParameters object is used to define how many facilities to find and various other properties, such as travel direction and cutoff. </s:RichText> <s:HGroup verticalAlign="baseline"> <s:Label text="Click on map to add incidents and find routes for the "/> <s:DropDownList id="facilityCount" width="45" requireSelection="true" selectedIndex="2"> <s:ArrayList> <fx:int>1</fx:int> <fx:int>2</fx:int> <fx:int>3</fx:int> <fx:int>4</fx:int> <fx:int>5</fx:int> </s:ArrayList> </s:DropDownList> <s:Label text="closest facilities."/> </s:HGroup> <s:Button id="clearButton" click="clearButton_clickHandler(event)" label="Clear incidents and routes"/> </s:controlBarContent> <esri:Map id="myMap" load="myMap_loadHandler(event)" mapClick="myMap_mapClickHandler(event)"> <esri:extent> <esri:Extent xmin="-13042947" ymin="3856278" xmax="-13041347" ymax="3857116"> <esri:SpatialReference wkid="102100"/> </esri:Extent> </esri:extent> <esri:ArcGISTiledMapServiceLayer url="http://localhost:6080/arcgis/rest/services/service_peta_OYU/MapServer"/> <esri:GraphicsLayer id="routeGraphicsLayer"> <esri:renderer> <!--<esri:ClassBreaksRenderer field="Total_TravelTime"> <esri:ClassBreakInfo maxValue="0.50" symbol="{new SimpleLineSymbol('solid', 0xCF0000, 0.8, 6)}"/> <esri:ClassBreakInfo maxValue="1.00" minValue="0.50" symbol="{new SimpleLineSymbol('solid', 0xEF0E0E, 0.8, 6)}"/> <esri:ClassBreakInfo minValue="1.00" symbol="{new SimpleLineSymbol('solid', 0xFF2F2F, 0.8, 6)}"/> </esri:ClassBreaksRenderer>--> <esri:UniqueValueRenderer field="FacilityRank"> <esri:UniqueValueInfo label="First" symbol="{new SimpleLineSymbol('solid', 0x4CBD36, 1.0, 6)}" value="1"/> <esri:UniqueValueInfo label="Second" symbol="{new SimpleLineSymbol('solid', 0x2C32BD, 1.0, 6)}" value="2"/> <esri:UniqueValueInfo label="Third" symbol="{new SimpleLineSymbol('solid', 0x3ABABD, 1.0, 6)}" value="3"/> <esri:UniqueValueInfo label="Fourth" symbol="{new SimpleLineSymbol('solid', 0xBDAF3B, 1.0, 6)}" value="4"/> <esri:UniqueValueInfo label="Fifth" symbol="{new SimpleLineSymbol('solid', 0xBD433A, 1.0, 6)}" value="5"/> </esri:UniqueValueRenderer> </esri:renderer> </esri:GraphicsLayer> <esri:GraphicsLayer id="facilitiesGraphicsLayer" symbol="{facilitySymbol}"/> <esri:GraphicsLayer id="incidentsGraphicsLayer" symbol="{incidentSymbol}"/> </esri:Map> </s:Application> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Here are the script that I already used. I built that script in Adobe Flash Builder 4.5, and I still have this notice --> No "facilities" found for "My Location" in "Incident" No Solution Found. Is there any mistake in my script? Thanks for the response.. regards isti
  6. isti

    network analyst in flex

    Thanks for the response, In my ArcGIS desktop, the closest facility works. It can find the closest facility based on the incident location, but while I input in flex the alert is appeared. Then, how to make sure there is no mistake on my data. Because it works in arcGIS desktop. Thanks. regards isti
  7. Dear All, I wanna share my concern about creating the application in flex. I wanna create the application of sea routing, then I utilize network analyst; the closest facility and new route facility. While creating the application for new route there is no problem appeared. Flex application to find the new route with the input data can works as well. But the problem is appeared when execute the closest facility, I already used the default parameter in ArcGIS 10.1, but It doesn't work. The parameters are same as the default but, in my application can not input the point as the facility and incident. the alert is --> No "facilities" found for "My Location" in "Incident" No Solution Found. Then I check the way I publish the network analyst from arcGIS 10.1, and the parameter as the input in Flex there are no mistakes, but the application to create route still doesn't work. I really appreciate for the responses. Thanks regards isti
  8. Thanks Sergeant,, Actually I have all the vessel location in my country, and I can load them in network analysis as facilities, my concern is when the accident happen which is only one accident, i wanna get only one route, which is the closest vessel can reach. What i have right now is when i set the route=incident to facility= i ll get the closest route, but i need the direction from facility to incident.i still can't solve this problem. and the second problem, my data is all of my archipelago that consist of various depth, and i wanna set the depth under 4000 restricted.i already set in attribute parameter --> field evaluator-->restricted = "True" If [depth] < 4000 then restricted= "False" end if when I activate, the route still pass the depth under 4000, or i made mistake with my pre logic script .. regards
  9. Hi GIS expert, I would like to share my concern, nowadays i try to manage sea routing (closest facility)with network analysis in arcGIS 10.1, and I have some problem though, 1. how to set only one incident for each vessel/facility to find out the route 2. I already set the depth restriction in atribute parameter and evaluator, the route can only pass the depth sea more than 4000 meters. But when I activate the rule, it doesnt work,. The vessel route still pass the depth sea under 4000 meters. I really appreciate who response and share the way to fix it. regards
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.