Select to view content in your preferred language

Locator in sample working, but still using wrong coordinate system?

1605
14
04-15-2010 05:35 AM
LeeAllen
Frequent Contributor
I have implemented the sample flex viewer and am using local state plane data and address locator service.  When I use locator to find address, it finds the addresses and lists matches, but put the locations off in space somewhere.  Is there a place where I need to change the WKID so the the service will put pins in proper place?


Here is what my locatewidget.xml looks like (I have commented out the state list):

<configuration>
<locator>http://gis.snco.us/ArcGIS/rest/services/StreetsAddressLocator/GeocodeServer</locator>
<minscore>40</minscore>
  <!-->listfield>State</listfield>
<listvalues>AK,AL,AR,AZ,CA,CO,CT,DE,DC,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MS,MO,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VA,WA,WI,WV,WY</listvalues-->
<zoomscale>3500</zoomscale>
</configuration>
Tags (2)
0 Kudos
14 Replies
RobertScheitlin__GISP
MVP Emeritus
lallen4585,

    The out of the box LocatorWidget does not re-project results but here is a modified one that does.

http://resources.esri.com/arcgisserver/apis/flex/index.cfm?fa=codeGalleryDetails&scriptID=16359
0 Kudos
LeeAllen
Frequent Contributor
It works like a charm, in version 1.3 as well.
0 Kudos
MelissaJohnson
Frequent Contributor
I believe I am having the same problem with version 2.0 of the Flex Viewer that was just released.  Is this fix still applicable?  I am trying it and having no luck...
Thanks!
Melissa
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Melissa,

   No the issue you are having with the FlexViewer2.0 locator widget like has to do with line 365 of the LocateWidget.mxml where they are saying that if the WKID of your map is not 4326 than reproject the results of the locator to webmercator. So if your map wkid is anything other than 4326 or 102100 (webmercator) than you will have issues.
0 Kudos
MelissaJohnson
Frequent Contributor
Yes I am using Missouri State Plane spatial reference 102697. so it sounds like I am just out of luck using my own locator with this widget.  Thanks for the quick reply!!
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Melissa,

      Not exactly. Are you using all of your own mapservice and base maps or are you using some of esri's? So your locator returning results in 102697 right? Are you using ArcGIS Server 10?
0 Kudos
MelissaJohnson
Frequent Contributor
I am using all of my own map services, no esri services. The address locator finds the address and zooms in, just not to the correct spot.  We have not upgraded ArcGIS Server to 10 yet (it is going to be soon though) and I know some of the functionality of the 2.0 Flex viewer won't work with 9.3.1.  Is that address locator something that I can't use in 2.0 unless I am at 10?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Melissa,

   Nope you can use the locator with 9.3.1 you just have to modify the locatorWidget.mxml code on line 365.

//replace
locateResult.point = map.spatialReference.wkid != 4326 ? WebMercatorUtil.geographicToWebMercator(addrCandidate.location) as MapPoint : addrCandidate.location;
//With
locateResult.point = addrCandidate.location;


The reasoning behind this is your map and your locator are using WKID 102697 and the default esri code is saying that if the WKID of the map is not 4326 than reproject the locator point to web mercator. They did not account for people using their own locators and map services when they developed this code.:(
0 Kudos
MelissaJohnson
Frequent Contributor
I will say it again, you are AWESOME!!!  It works perfectly now...  Thank you for your help! You are a great resource on this forum and are much appreciated by those of us starting out with Flex!
0 Kudos