I am using the android and iOS sdks to perform a geocode request to the server. When I am calling the same endpoint using REST I get different results back.
In my case the REST call has more results.
iOS code:
let locatorTask = AGSLocatorTask(url: URL(string: "https://my-server/services/GeocodeServer/")!) let params = AGSGeocodeParameters() params.maxResults = payload.maxSuggestions params.countryCode = "DE" params.outputSpatialReference = .wgs84() params.resultAttributeNames = ["*"] locatorTask.geocode(withSearchText: payload.searchQuery, parameters: params) { // handle result }
REST call:
https://my-server/services/GeocodeServer/suggest?f=json&text=SomeStreet
It would be nice to know what request url the iOS lib generates.
Solved! Go to Solution.
You can use AGSRequestConfiguration to log some debug info to the console. Try something like this:
let locatorTask = AGSLocatorTask(url: URL(string: "https://my-server/services/GeocodeServer/")!)
if let gc = AGSRequestConfiguration.global().copy() as? AGSRequestConfiguration {
gc.debugLogRequests = true
locatorTask.requestConfiguration = gc
}
That should output the request for you.
Please note that you should not log this debug info in a release version of your app. There is a performance hit to this logging and you should disable it in production and testing.
You can use AGSRequestConfiguration to log some debug info to the console. Try something like this:
let locatorTask = AGSLocatorTask(url: URL(string: "https://my-server/services/GeocodeServer/")!)
if let gc = AGSRequestConfiguration.global().copy() as? AGSRequestConfiguration {
gc.debugLogRequests = true
locatorTask.requestConfiguration = gc
}
That should output the request for you.
Please note that you should not log this debug info in a release version of your app. There is a performance hit to this logging and you should disable it in production and testing.
Thanks! I was able to take a look at the request and I noticed that the client sdk uses a different query param.
It adds `findAddressCandidates?`, `&outSR`, `&forStorage` and `&SingleLine` but the REST calls works fine with just `&text=`.
I would like to only send `&text` and nothing else.
Are we able to configure that?
Okay I think i missed the "suggest" method of the locatorTask that does exactly what I thought.
My question is: Why is there a "suggest" api when we can also search for points using geocode?