0

I'm developing an Android app that has postal address routing in it.

We would like to sort each address in a database table in such a way where each address can be printed out for our driver. We don't want to spend time sorting addresses ourselves when a database table would be ideal for that.

I was thinking somehow to create a primary key in the table on a number that we can easily sort in ascending order. That would make it easy to create a manifest for the driver.

I was researching and found that there was something called WOEID (Where on Earth ID) which I think represents a region but I'm not sure if it would be good for us since 2 postal address in the same neighbourhood could use the same WOEID.

For example these 3 addresses have the same WOEID:

100 Bowden St., Lowell, MA
131 Stedman St., Lowell, MA
50 Stromquest Ave., Lowell, MA

The concept of using a single number like WOEID is perfect for us but we need to sort addresses like these in order so we know which ones are closest to each other.

Maybe there is a web site we can use to send out a request from within our app providing them with the postal address and the site will return a single number representing that address in a format our app can parse.

Maybe there is a way to Geocode or convert latitude and longitude numbers into a single number we can use.

Thanks.

Matt
  • 22,721
  • 17
  • 71
  • 112
Emad-ud-deen
  • 4,734
  • 21
  • 87
  • 152

2 Answers2

0

So the problems arise when multiple addresses share the same WOEID? I don't know how many resources are available but couldn't it be in idea to fed this data to some API like Google Maps and calculate the distance from your position to there?

If you want to avoid google a really basic approach could be to do the calculation by yourself. (Though this would be more of an estimation.)

However I got the feeling you want to find the best route over total distance so I think your problem is also related to the travelling salesman problem

Given a list of cities and their pairwise distances, the task is to find the shortest possible tour that visits each city exactly once.

nuala
  • 2,681
  • 4
  • 30
  • 50
  • Yes, that's what we are trying to do. I used to work for a company that did routing for the Paratransit industry but they would not allow us to know the secret they use to convert the addresses into the single number they use in the database table. Since I'm a beginner to all of this, can you tell me how to obtain this information and maybe lead me to a tutorial? – Emad-ud-deen Nov 29 '11 at 10:41
0

I found a web site that allows me to do a reverse Geocoding. It returns a latitude and longitude.

I experimented a bit and found that I can add the latitude and longitude together to get a single number. Since giving an exact address to the web site will give results not completely what I'm looking for I give it just a street and city and US state to locate. I can then use the latitude and longitude returned and then sort the house addresses in numeric ascending order.

For example we have many streets that are very grid like so 1 number from the adding of the latitude and longitude represent many homes on 1 particular street. On another street a block away I did the same thing. Now all I have to do is just list everything in the database table like this: City chosen by a dropdown, US state also chosen by a dropdown, then the geocoded number for each street followed by the home numbers.

Here is the web site I used to get the Geocoding along with a sample street address:

http://where.yahooapis.com/geocode?q=stedman+st,+lowell,+ma
Emad-ud-deen
  • 4,734
  • 21
  • 87
  • 152