Location search: specific address and local business

I am creating an iOS app. I currently have a search bar that can be used to search for a local business (e.g. pizza, gas station, bank). The search string text is added as a URL parameter and sent to the Yahoo Local API. I would like to use the same search bar to find specific addresses, but this is not an API function. I think I should either:

A) Create some function that can differentiate between broad business search and specific location search. Send business requests to the API and send search requests to CLGeocoder.

B) Find a more generic API.

C) Do something else that I haven't considered yet.

I could add a separate search box and use it to find addresses, but I'm wondering if this can be done from the same search bar. If anyone could offer any advice or point me in the right direction, I would appreciate it. Thank.

+3


source to share


2 answers


You will probably have a hard time doing A, since addresses and POIs are freeform strings, especially when they are human-made strings. I would prefer to add some kind of switch that the user can toggle to find businesses or addresses.



For B, you can take a look at google maps api if it suits your needs. This seems to be pretty generic about the input parameters.

0


source


+1 for an interesting question. It's definitely a programming issue, but it's a UX issue too.

I think you can do it all in one box. I work for SmartyStreets , where we parse and process addresses. Here are a few things I've learned from experience related to your question:

  • Don't use regular expressions to parse or resolve addresses. It's too complicated. Addresses come in different forms, as Matei said. Freeform strings can be anything. The temptation is to use a regular expression, but there is a smarter way.
  • Very few location / address APIs actually provide the value and results you are looking for, at least according to their TOS. For example, Google, Yahoo !, and others require a map to be displayed and do not allow automated requests (for example, no one actively initiates a request).
  • Most APIs only perform address approximation, not address validation. So the results you get are speculation at best. Google is good at guessing, but results may come back, which looks legitimate, but not really. I've seen this a lot and it bit me. Geolocation / geocoding APIs have their place, but they also have their limitations.

So, for example: a user enters a POI or address in this text box. You don't know which one he is, or if he is both. And if you really know if a POI or address exists? I don't know of a (inexpensive) API that does both at once - there are enterprise ones I've seen, but ... maybe too many hits for too many bucks. Here is a simpler approach that I will try.



  • Find the CASS-Certified service for address verification. The SmartyStreets API LiveAddress ( various demo on the homepage ) is one such service (inexpensive, even free to use in small volumes). While the API doesn't parse single-line addresses directly, it's very easy to use this algorithm (with a working example here ) - it's even easier in Objective C because you don't have to mess with JSONP like you do in Javascript.

  • If LiveAddress or an equivalent service (I encourage you to do some research and let me know if you have any further questions - I'll be happy to help) returns any results, the string was the address. Some CASS certified services to be alerted will also return bogus addresses or guesses and it is difficult / impossible to distinguish between the two. LiveAddress will only return valid addresses. So if the LiveAddress returns a result (usually the first one using the above algorithm), the string is definitely an address or POI followed by an address. (And yes, LiveAddress will geocode each address.)

  • If no results were returned, it was the POI / business name. If your app adheres to Google or Yahoo TOS, ask for their API because they are good at guessing and find more general matches on things like this.

Another option is to first request the Maps API and then return it (if any), send it via LiveAddress to make sure it exists and learn more about it.

Hope you point in the right direction (no pun intended). Let me know if you would like to clarify anything or any other questions related to the address.

0


source







All Articles