ArcGIS for Flex API version3.7 Tutorial: 7. Using directions to query the route (shortest path analysis)

Source: Internet
Author: User

By using the Directons component to calculate the route between two points or multipoint, add a travel route on the map and show step-by-point instructions. This section is mainly about how to add the use of the Directons component, a custom layout that displays the palette on the left side of the screen, and two columns in the Map window. Customize your own published network analysis service to replace the default route service.


What you need to be prepared for:
* Adobe Flash Builder 4.5.1 and above
* ArcGIS API for Flex 3.2 and above


Steps:
1 in FB, create a new project, add API libraries and ESRI namespaces
2 Add the Basemap code to set the spatial reference and initial display range.
<s:applicationxmlns:fx= "http://ns.adobe.com/mxml/2009" xmlns:s= "Library://ns.adobe.com/flex/spark" Xmlns:esri = "Http://www.esri.com/2008/ags" ><esri:map id= "Map" >   <esri:extent>      <esri: Webmercatorextent xmin= " -13055785" ymin= "3848161" xmax= " -13025898"        ymax= "3866239" spatialreference= "{New Spatialreference (102100)} "/>   </esri:extent><esri:arcgistiledmapservicelayer/></esri:map ></s:Application>


Tip: Arcgistiledmapservicelayer.url has an address by default, Http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer
3 Setting up a page layout
<?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" <s:layout>   <s: Horizontallayout paddingleft= "2"/></s:layout><esri:map id= "Map" >   <esri:extent>    ...


4 Adding Directions components
Tip: The network Analysis service URL address used in the example refers to a service above ArcGIS online that is limited to the area of the San Diego city. If you want to expand the range of processing, you can: (1) Use the World Network analysis above ArcGIS online and (2) Use your own published ArcGIS Network Analytics Service
...<s:layout>   <s:horizontallayout paddingleft= "2"/></s:layout><esri:directions width= " "Height=" 100% "   map=" {map} "   url=" http://sampleserver6.arcgisonline.com/arcgis/rest/services/ Networkanalysis/sandiego/naserver/route "/><esri:map id=" Map ">   <esri:extent>    ...


5 Save Run
6 Enter the address location of the start and end points, and may also be selected from the map. As shown in the interface:


When you click on the calculation, the results are displayed on the map, as shown in



ArcGIS for Flex API version3.7 Tutorial: 7. Using directions to query the route (shortest path analysis)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.