Select to view content in your preferred language

Geocoding Question

1728
4
08-30-2011 04:52 AM
AndyWhitley
Emerging Contributor
I like using the default LocateWidget in Flexviewer.  How can you tailor this to only display streets in your county, without having to enter the city or zip.  Where can this be changed? Any suggestions would be appreciated.
Tags (2)
0 Kudos
4 Replies
BjornSvensson
Esri Regular Contributor
How can you tailor [LocateWidget] to only display streets in your county, without having to enter the city or zip ...?


County is not one of the field supported by the locator, but if it was a city, state, or zip code it could be done...

The Flex Viewer include an example of the latter in the widgets/Locate folder called LocateWidget_RanchoCucamonga.xml  which you can also see online at http://help.arcgis.com/en/webapps/flexviewer/live/widgets/Locate/LocateWidget_RanchoCucamonga.xml

It has the default value set and the visibility of the field turned off, thus "hardcoding" it and not allowing you end-user to change it.
<fields>
<field name="City" defaultvalue="Rancho Cucamonga" editable="false"/>
<field name="Zip" defaultvalue="91730" listvalues="91701,91729,91730,91737,91739"/>
<field name="Zip4" visible="false"/>
<field name="State" defaultvalue="CA" visible="false"/>
<field name="Country" defaultvalue="USA" visible="false"/>
</fields>

For more information, see http://links.esri.com/locatewidget
0 Kudos
AndyWhitley
Emerging Contributor
This works well.

Thanks
0 Kudos
NancyGnanicys
Deactivated User
I'm using the geocoder in Flexviewer found below:
http://tasks.arcgisonline.com/ArcGIS/rest/services/Locators/TA_Address_NA_10/GeocodeServer

What I am confused about is, when I add in using the Viewer for Flex 3.0 user interface and then preview it, it gives me only one line, and I have to enter in the city and state still.  I just want the users to be able to search only within the city as there is no need to search out side of it.  The confusion comes is, which .xml file do I add the code that is presented so it knows to only search within the city? 

What I have done so far and did not work :
in config.xml changed the LocateWidget_NA to a copied version with the new field input tags

<widget left="100" top="90" icon="assets/images/i_target.png" label="Find an address" config="widgets/Locate/COPYLocateWidget_NA.xml" url="widgets/Locate/LocateWidget.swf" preload="open"/>

The code to my COPYLocateWidget_NA.xml within my widgets folder is as follows:

<?xml version="1.0" ?>
<configuration label="North American Geocoding">
    <locator>http://tasks.arcgisonline.com/ArcGIS/rest/services/Locators/TA_Address_NA_10/GeocodeServer</locator>
    <minscore>40</minscore>
    <fields>
<field name="City" defaultvalue="Helena" editable="false" />
<field name="Zip" defaultvalue="59601" listvalues="59601" />
<field name="Zip4" visible="false" />
<field name="State" defaultvalue="MT" visible="false" />
<field name="Country" defaultvalue="USA" visible="false" />
        </fields>
    <zoomscale>10000</zoomscale>
</configuration>

<!--
    See Locate widget tag reference at
    http://links.esri.com/locatewidget
-->


Pleas Point me in the right direction making it work?
0 Kudos
BjornSvensson
Esri Regular Contributor
What I am confused about is, when I add in using the Viewer for Flex 3.0 user interface and then preview it, it gives me only one line

If the service supports a single line input (like the one you are using), then the widget will default to use that (single line input).  Unless you specify the following in your locate widget xml file:
<usesingleline>false</usesingleline>
See http://resources.arcgis.com/en/help/flex-viewer/concepts/index.html#/Locate_widget_tags/01m30000000r...
0 Kudos