Geocoder : Restrict Search to Map Extent

6556
11
Jump to solution
11-05-2014 07:34 AM
BrianO_keefe
Regular Contributor II

In the Flex app, Locator widget, I could restrict the address searches to only within the overall extent of the map. As all of my searches happen within Tulsa, Oklahoma, I would LIKE to have my users only have to enter the address and not the City and State in order to run the geocoder. I've been digging around the config.json and such files trying to find out how to make this happen but no luck so far.

Does anyone know if this is an option?

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Esteemed Contributor

Brain,

  I have had better luck using this json (suffix instead) .

{

  "geocoder": {

    "autoComplete": true,

    "minCharacters": 3,

    "name": "Esri World Geocoder",

    "arcgisGeocoder": false,

    "geocoders": [

      {

        "url": "https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer",

        "name": "Esri World Geocoder",

        "singleLineFieldName": "SingleLine",

        "placeholder": "Find address or place",

        "suffix": " Tulsa, OK"

      }

    ]

  }

}

View solution in original post

11 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Brain,

  This should be what you are looking for (hopefully I have the extent of Tulsa correct):

{

  "geocoder": {

    "autoComplete": true,

    "minCharacters": 3,

    "arcgisGeocoder": {

      "placeholder": "Find address or place",

      "searchExtent": {"xmin":-10738000,"ymin":4281800,"xmax":-10592000,"ymax":4344600,"spatialReference":{"wkid":102100}}

    }

  }

}

0 Kudos
YueWu1
by
Regular Contributor

For the "searchExtent", I tested in JS API, it looks like only take Extent Object, the way add "searchExtent" in json is not working. Need more changes in some .js file

RobertScheitlin__GISP
MVP Esteemed Contributor

Brain,

  I have had better luck using this json (suffix instead) .

{

  "geocoder": {

    "autoComplete": true,

    "minCharacters": 3,

    "name": "Esri World Geocoder",

    "arcgisGeocoder": false,

    "geocoders": [

      {

        "url": "https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer",

        "name": "Esri World Geocoder",

        "singleLineFieldName": "SingleLine",

        "placeholder": "Find address or place",

        "suffix": " Tulsa, OK"

      }

    ]

  }

}

BrianO_keefe
Regular Contributor II

Perfection. Thank you kindly sir.

0 Kudos
JssrRR
by
Occasional Contributor II

Robert,

Can we use suffix like you suggest here,  to limit search to a state in USA when using CountryCode, like this  "Texas, US" , right now it works fine, finding results only for USA, but want I the search within Texas only.

s.set("sources", sources.reverse(), sources[4].countryCode = "US")

search extent also works, but I am still getting some results from neighboring states, wanted to know if there was a way to refine it further.

Thank you.

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Saloni,

   This thread was dealing with the Geocoder. Your question has to do with the new Search Dijit it looks like the new Search dijits source does support the suffix property but I would think that "Texas, US" is incorrect and the suffix you would want and try would be "TX" (but I have no experience yet with the Search dijit.

JssrRR
by
Occasional Contributor II

Thanks for the reply Robert.

I tried suffix: "TX, US", it did not work, also tried with USA instead of US.

Neither did this:

s.set("sources", sources.reverse(), sources[4].countryCode = " TX, US");

Not sure if I have it right.

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Saloni,

  No My advice was to leave this alone:

s.set("sources", sources.reverse(), sources[4].countryCode = "US")

And just add the "suffix" of  "TX" to your source 4

JssrRR
by
Occasional Contributor II

Robert,

Thanks, it worked!

0 Kudos