GPSApp users: MapsOnUs got good.

Posted by: tfabris

GPSApp users: MapsOnUs got good. - 17/01/2005 16:26

For those using GPSApp on their empegs, you probably already know that MapsOnUs is pretty much the only way you can use the web to get routes into the empeg.

In the past, creating a route with MapsOnUs was tricky for me, because it would sometimes do strange things, such as:

- Calling a freeway onramp an "unnamed road" instead of just saying "Take I-80 West".

- Confusing small roads with highways; A freeway onramp that appeared on many of my routes was called "highway 193". When there's no highway by that name anywhere near there.

- Making a route line that cut across blank terrain, even though the highway line was nearby. In these cases I had to hand-position an intermediate "correction" destination by clicking on the map. Big pain.

- Misdirecting you on small residential roads (like the ones near my house).

Anyone else get that behavior in the past?

Well, anyway, I just punched in a new set of directions (hadn't needed to for the last few months), and suddenly MapsOnUs is working flawlessly. All the problems I'd had before are corrected now. Yay! I don't know if it's because their database has been updated, or they've fixed code bugs, or what, I'm just glad to see it working that way.

And the Python parser script still seems to work fine on their output page.

Just wanted to put that in here for anyone else using GPSApp. Enjoy!
Posted by: schofiel

Re: GPSApp users: MapsOnUs got good. - 19/01/2005 10:45

Quote:
Calling a freeway onramp an "unnamed road" instead of just saying "Take I-80 West"


This is a good indicator that the underlying maps have good node granularity, a good thing.

Quote:
- Making a route line that cut across blank terrain, even though the highway line was nearby. In these cases I had to hand-position an intermediate "correction" destination by clicking on the map. Big pain.

- Misdirecting you on small residential roads (like the ones near my house).


This sort of behaviour shows that their route-matrix construction algorithm has defects: the second one typically shows that it is returning too many choices of matrix and the app that does the choice of route has got poor controls on choice of route criteria (also shown in the "missed highway" symptom above).

If the routing app now behaves better, then it's pretty obvious they've been working on the routing app.
Posted by: robricc

Re: GPSApp users: MapsOnUs got good. - 08/02/2005 16:49

I was just checking out Google Maps. Looks like there are coordinates in the HTML source. Doesn't appear to be turn-by-turn at first glance.
Posted by: tfabris

Re: GPSApp users: MapsOnUs got good. - 09/02/2005 02:08

Ooo. Didn't know about this. Interesting little app. Having a go at it...
Posted by: n6mod

Re: GPSApp users: MapsOnUs got good. - 14/02/2005 18:51

Google Maps is based on technology developed (and sold to Google) by some friends of mine. (Tony- That was the other startup in the house in Berkeley)

It's a long shot, but I'll see if I can get them to sneak in some gpsapp-friendly output.

-Z
Posted by: tfabris

Re: GPSApp users: MapsOnUs got good. - 14/02/2005 19:12

Oooooooo cool.
Posted by: jaharkes

Re: GPSApp users: MapsOnUs got good. - 09/03/2005 15:48

It's already there in a somewhat friendly format. The vector that is drawn for the directions seems to be an encoded string of actual coordinates. They simply decode it, scale it and draw it with some javascript foo.

I haven't had time to really play with gpsapp in a while, but the attached file was able to parse the google maps data. I got directions, clicked on the 'link to this page' and saved the page as plain html.

Then I fed it into the parser and it spit out something that looks like it would be a valid input file for gpsapp. It doesn't strip down the turn-by-turn descriptions yet, so gpsapp will probably repeat itself like 'turn left at turn left at that street' and quite a bit of code was simply cut and pasted from parse_mapsonus.

edit: updated the script to add the destination address as the last waypoint.
Posted by: tfabris

Re: GPSApp users: MapsOnUs got good. - 09/03/2005 17:19

Whoa. COOOOOL.
Posted by: tfabris

Re: GPSApp users: MapsOnUs got good. - 29/10/2005 16:12

Oh.
My.
God.

I could KISS YOU.

It works. Turns and all.

I simply edited my batch file and replaced "parse_mapsonus.py" with "parse_google.py" and ran it, and IT WORKED.

GAAAAAAAAAAAAAAH THIS IS SO COOL.

AAAAAAAAAAAAAAAAA!!!!!

<head explodes>
Posted by: canuckInOR

Re: GPSApp users: MapsOnUs got good. - 01/11/2005 00:11

/me disassembles monitor and wipes tfabris head off the inside.
Posted by: tfabris

Re: GPSApp users: MapsOnUs got good. - 01/11/2005 08:11

Quick question.

When using the Google maps route I tried, my position was offset from the map, north and east by several meters, more than I would usually account for with consumer GPS accuracy and map data difficulties.

If I find that my position is always consistently off by X number of meters north and east, is there a way I can configure GPSapp to compensate? Like an offset command in its configurations info in config.ini?
Posted by: jaharkes

Re: GPSApp users: MapsOnUs got good. - 01/11/2005 14:46

It could be that Google's coordinates are already in the WGS84 (gps) coordinate system. Typically map data in the US is in NAD27 coordinates.

In the parse_google.py file, there is a function 'decodePolyline'. It contains a line where we convert from NAD27toWGS84 which might not be necessary if they already did the conversion for us. The difference between the two coordinate systems tends to be about 200 meters.

You could replace coord=NAD27toWGS84(Coord(lat*SCALE,lon*SCALE)) with coord=Coord(lat*SCALE,lon*SCALE) and see if that does the trick.
Posted by: tfabris

Re: GPSApp users: MapsOnUs got good. - 01/11/2005 17:40

Hm. Not sure if the difference I'm seeing is as big as 200 meters. But I'll give it a shot and see. Thanks.
Posted by: tfabris

Re: GPSApp users: MapsOnUs got good. - 01/11/2005 18:12

Okay, I've tried to make that change in the code a bunch of different times now, and it fails completely, no route file is generated. I don't know why it's failing because I don't see any console errors output. I'm pasting the text exactly as you wrote it, exactly in place of the existing line. So I don't know what's wrong, but I can't try this.
Posted by: siberia37

Re: GPSApp users: MapsOnUs got good. - 01/11/2005 21:08

This might be worth a try:

def NAD27toWGS84(coord):
return ConvertDatum(coord, Datum_WGS84, Datum_WGS84)

(change the existing NAD27toWGS84 function), then you keep the coord= line the way it was before.
Posted by: tfabris

Re: GPSApp users: MapsOnUs got good. - 01/11/2005 22:08

Nope, same error. No route file gets generated when I change that function as you showed.
Posted by: mtempsch

Re: GPSApp users: MapsOnUs got good. - 02/11/2005 04:27

Shot in the blue, not knowing exactly how/with what you edit the file, but might it be an introduction of a non-Unix style linefeed upsetting the script?
Posted by: JBjorgen

Re: GPSApp users: MapsOnUs got good. - 02/11/2005 11:41

Heh...same thing I thought.
Posted by: Daria

Re: GPSApp users: MapsOnUs got good. - 02/11/2005 11:53

Quote:
It could be that Google's coordinates are already in the WGS84 (gps) coordinate system. Typically map data in the US is in NAD27 coordinates.



This suggests yes, as did a quick check of my house.
Posted by: tfabris

Re: GPSApp users: MapsOnUs got good. - 02/11/2005 14:28

Quote:
might it be an introduction of a non-Unix style linefeed upsetting the script?

First thing I checked. Taking the existing, working script, editing and resaving with the CR/LF pairs (no textual edits), and running it, works.

Only editing that function in the ways suggested cause it to fail. Not the CR/LF issue.
Posted by: tfabris

Re: GPSApp users: MapsOnUs got good. - 02/11/2005 14:29

Quote:
This suggests yes, as did a quick check of my house.

Ah, good. Now if we could just get that python script to work without the data conversion, we'd be in good shape.
Posted by: Daria

Re: GPSApp users: MapsOnUs got good. - 02/11/2005 14:56

I suppose in a bit I will look.
Posted by: Roger

Re: GPSApp users: MapsOnUs got good. - 02/11/2005 14:57

Quote:
Quote:
This suggests yes, as did a quick check of my house.

Ah, good. Now if we could just get that python script to work without the data conversion, we'd be in good shape.


Python is whitespace sensitive. The code snippet above doesn't have any leading whitespace. Did you make sure that the body of the function was indented under the name?
Posted by: Daria

Re: GPSApp users: MapsOnUs got good. - 02/11/2005 16:25

Try
Posted by: tfabris

Re: GPSApp users: MapsOnUs got good. - 02/11/2005 17:16

Okay, that works!

But it looks to be exactly like the modification you supplied above.

I tried to make the whitespace match exatly when I made the modifications, but perhaps I just got it wrong.

Now it's off to try a little drive and see if the coordinates match the real world better. THANK YOU!
Posted by: Daria

Re: GPSApp users: MapsOnUs got good. - 02/11/2005 17:19

I didn't supply the mod. I just used an editor on a real platform
Posted by: tfabris

Re: GPSApp users: MapsOnUs got good. - 02/11/2005 17:42

Okay, fantastic, the modified version of the script is correct. Without the NAD27 to WGS84 data conversion, the car's position on the map route is perfectly nailed. Fantastic!

Now for the next problem.

Every single turn is wrong. Every single turn tells me (for example) to go left when it's clearly right. Also, as I execute that turn, it doesn't advance me to the next waypoint.

I'm pretty sure this is because the Google Maps data has some kind of a "hiccup" in the data points at each turn location. This happened before when we tried to use another mapping program. instead of a turn looking like this...

Code:

|
|
|
O-------



If you magnifiy it really small, in the data points it acutally looks like this:

Code:

|
|
|
O--|-------
\ |
\|
|



Is there any way we can fix that in the script?
Posted by: tfabris

Re: GPSApp users: MapsOnUs got good. - 02/11/2005 17:55

No wait!!!!!

It's simpler than that.

That was the problem with the other mapping program. With this one it's not nearly as thorny an issue. The problem is that each turn contains two data points that are the exact same point. For example:

52 -4942
252 -4957
253 -5154
253 -5154
Take the Stewart St. exit 166 to Denny Way
246 -5177
234 -5307
233 -5328

That should be VERY EASY to fix in the script, right?
Posted by: Daria

Re: GPSApp users: MapsOnUs got good. - 02/11/2005 19:03

Quote:
No wait!!!!!

It's simpler than that.

That was the problem with the other mapping program. With this one it's not nearly as thorny an issue. The problem is that each turn contains two data points that are the exact same point. For example:

52 -4942
252 -4957
253 -5154
253 -5154
Take the Stewart St. exit 166 to Denny Way
246 -5177
234 -5307
233 -5328

That should be VERY EASY to fix in the script, right?


For anyone but you, apparently
Posted by: tfabris

Re: GPSApp users: MapsOnUs got good. - 02/11/2005 19:25

Hey, I don't know python. Not my fault!

And I know my editor didn't have anything to do with it because I've successfully edited the old MapsOnUs python script to add more text phrases to strip out of the turn directions. I'm guessing it was a whitespace-sensitivity issue (despite my attempts to match the whitespace correctly).

Anyway...

Does anyone know where in the script one might handle that correction?
Posted by: tfabris

Re: GPSApp users: MapsOnUs got good. - 02/11/2005 20:39

Okay, there's a function in the old mapsonus parse routine that looks like this:

Code:

# create a route as a combination of 'shape' and 'turn' information
# make sure we discard duplicate records.
waypoints = []
for i in range(-1, len(coords)):
if route.has_key(i):
if len(waypoints) and waypoints[-1].coord == coords[i]:
del waypoints[-1]
waypoints.append(route[i])
else:
if waypoints[-1].coord != coords[i]:
waypoints.append(Wpoint(coords[i]))
return waypoints



The matching code in the new routine seems to be
Code:


h.segments[len(h.coords)-1] = h.destination
wpoints = []
for i in range(len(h.coords)):
wpoints.append(Wpoint(h.coords[i], h.segments.get(i)))
return wpoints



But I don't think a direct replacement will work because objects like "route" don't exist in the new code. Or am I reading that wrong?
Posted by: tfabris

Re: GPSApp users: MapsOnUs got good. - 02/11/2005 20:46

In the meantime, I'm working on a really complete "Strip" statement for the top of the script. Working OK so far, I have to throw a bunch of test cases at it next.
Posted by: wfaulk

Re: GPSApp users: MapsOnUs got good. - 02/11/2005 21:01

The obvious thing to do would be to check on output to see if the line it's getting ready to print is the same as the last line it printed. You need to be careful about the descriptions, though.
Posted by: wfaulk

Re: GPSApp users: MapsOnUs got good. - 02/11/2005 21:14

I haven't even begun to test this. Not even run it through the interpreter to make sure the syntax is right.
Posted by: tfabris

Re: GPSApp users: MapsOnUs got good. - 02/11/2005 21:46

Naw, that one doesn't produce any file as output. Thanks for the stab at it. Perhaps you'll get a chance to run it through the interpreter soon?
Posted by: tfabris

Re: GPSApp users: MapsOnUs got good. - 02/11/2005 21:55

By the way, if anyone wants it, I've got a strip command that's working pretty well so far in my test cases. The line is:

discard="((Start|End)\sPoint|follow|Continue onto|Continue on|continue|Continue|bears?|Bear|bear|turn|TURN|Turn |Go |into the |Take the|Take |Merge into|into|to |Set by click|sharply|left at|right at|left|right|straight|onto|as road goes into|as it|Head\s(North|West|East|South)\son)\s?"

And you have to chage the comment mark here so that the strip command gets called:

self.desc = re.sub(discard, "", desc).strip()
#self.desc = desc.strip()
Posted by: jaharkes

Re: GPSApp users: MapsOnUs got good. - 02/11/2005 22:00

Here is a version that removes duplicates from the route (and which doesn't do datum conversion).
Posted by: wfaulk

Re: GPSApp users: MapsOnUs got good. - 02/11/2005 22:00

Okay. A couple of syntax errors. Here it is again.
Posted by: tfabris

Re: GPSApp users: MapsOnUs got good. - 02/11/2005 22:03

WOOO! SIMULTANEOUSLY!!!

I love you guys, you rock. So much.
Posted by: tfabris

Re: GPSApp users: MapsOnUs got good. - 02/11/2005 22:15

Just tried Jan's version. Works great!

Didn't try yours, yet, Bitt, sorry. Grabbed the first one my mouse fell upon, and it works.

YAY, DIRECTIONS FOR GPSAPP WORK AGAIN!

REJOICE!

So, Jan, you can update your script with the modified character-stripping commands I posted earlier in the thread, and put it up at the GPSapp web site. And if you fix up the instructions to describe how to use it with Google instead of Mapsonus, then I'll edit the FAQ to remove the note about how mapsonus stopped working.
Posted by: jaharkes

Re: GPSApp users: MapsOnUs got good. - 03/11/2005 00:01

Ok, ok, and... ok. Haven't actually updated the tarball or CVS, just included a description and link to the parse_google script on the gpsapp page.
Posted by: tfabris

Re: GPSApp users: MapsOnUs got good. - 03/11/2005 00:38

Cool.

Thanks everyone, for all the help.

Now, that's one more year I can go without dropping the cash on a nav system.
Posted by: tfabris

Re: GPSApp users: MapsOnUs got good. - 03/11/2005 03:59

I just took an actual drive with some mapping data using this script, and it worked perfectly. The Google map data is very accurate, moreso than I was used to seeing with mapsonus.

Awesome.
Posted by: tfabris

Re: GPSApp users: MapsOnUs got good. - 13/01/2006 20:55

Did Google Maps just change the output format of their web page?

I just tried converting a couple sets of directions with Parse_google.py and got errors. Is anyone else besides me using Parse_google.py and do you get the same problem?