Quick query of geographic location
The Geocoder component provides a quick, geographically-based query that can be queried to display the geographic location of a map by entering an address by adding a query input box. Using Geocoder to move the map display to the specified location area is faster than panning and blooming maps. This feature requires the use of the locator service (location services).
Prerequisites:
* Adobe Flash Builder 4.5.1 and later
* Used ArcGIS API for Flex is 3.2 and later
1 new project in FB, add ArcGIS API and reference Esri namespace
2 Add code to add a basemap:
<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" ><esri:map id= "Map" > <esri:extent> <esri: Webmercatorextent xmin= " -20119163" ymin= "1160734" xmax= " -1333999" ymax= "10416341"/> </esri:extent> <esri:ArcGISTiledMapServiceLayer/></esri:Map></s:Application>
Note: The basemap used in this example is the online tile service Http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer
3 Next, add the Geocoder component.
Note: If you do not set the URL for Geocoder, it will default to the ArcGIS Online World Geocoding Service. This URL can be set to any custom GeoCode service, or a layer that contains services. If you use your own GeoCode service, you need to configure the URL.
... <esri:arcgistiledmapservicelayer/></esri:map><esri:geocoder width= "30" height= " top= "horizontalcenter=" 0 "map=" {map} "/></s:application>
4 Finally, save the running program
5 Enter a location and address to query
As shown in the following:
Results
Using the Geocoder component for geo-location queries does not require writing a large amount of code. This component has a lot of functionality. Remember the following steps.
* Add Map Basemap
* Add geocoder Component Configuration URL
ArcGIS for Flex API version3.7 Tutorial: 6. Using Geocoder for geo-querying