0

My objective here is to identify while the user is asking for directions, if the user has already been in one of the streets (even if not in the exact same coordinates) that were given in the result of the google maps directions search.

It happens like this:
When the user is just browsing the streets, the app, from time to time, asks google where the user is, using the geocode api. And then it registers it (I still need to know which information should I use).

On another time in the future, the user will ask for directions to a specific place he wants to go, the app will ask for alternatives to google maps, then it will decide which path is the one to use having into account if the user will recognize as much as possible as he progresses or the other way around, according to a configuration.

The problem is that I have no clue what to use as the unique identifier for each street.

Note: For now I'm not dividing the big streets into sectors. It should be easier that way. Ofc, if that's easier than considering the whole street, I'll divide the streets into sectors.

I already tested that i cannot use the coordinates of where the user is. In order not to overlap with near streets and to give a good precision, I'm unable to use the coordinates, even if truncated.
I also checked that using the name of the place that the geocode returns does not seem usable when I'm asking for directions. The directions api does not name the streets with the same identifier...

Help please.

Thanks in advance.

brunoais
  • 6,258
  • 8
  • 39
  • 59

1 Answers1

0

I know you've probably moved on or figured this out by now, but I'll tell you what I would do.

If I wanted to identify streets that might be familiar, I would identify blocks on the street as a set of start and end coordinates. You could check for proximity to the ends of the blocks.

You should be able to find the ends of a block by geocoding the address of a point on the block and split the address line string up by spaces. parse the first number into an int, subtract the modulus of the street number divided by 100, then add one for the beginning and 99 for the end.

String[] splitAddr  = address.getAddressLine(0).toString().split("\\s");        
    houseNum    = splitAddr[0];
    street      = address.getAddressLine(0).toString().substring(houseNum.length());        
    blockNum    = Integer.parseInt(houseNum);
    blockNum    = (blockNum - (blockNum % 100));
    blockstart  = blockNum + 1;
    blockEnd    = blockNum + 99
Nick
  • 742
  • 8
  • 14
  • Unfortunately, you are missing a key point here."block by geocoding the address of a point on the block" I'd ran out of geocoding queries in a flash. In just 5 directions queries, I'd use so many requests that I'd be classified as abusing the system. – brunoais May 15 '13 at 07:43