#138611 - 01/02/2003 06:54
How to get routes for GPSapp?
|
member
Registered: 18/02/2002
Posts: 179
Loc: Germany
|
Hi! Since I live in Germany, I cannot use mapsonus.com. I've found greenflag.com. It is very similar to mapsonus.com and since it covers whole europe, I think it's quite interesting for others, too. After saving the site to an .htm file, I can extract the coordinates and route information with GPS Utility. How can I convert the route information into the GPSapp format?
Thorsten
_________________________
----------------------------
MK1: 00314 (4GB)
MK2a: 030103104 (30GB)
Installed in a BMW 323ti
|
Top
|
|
|
|
#138612 - 01/02/2003 09:21
Re: How to get routes for GPSapp?
[Re: Warp10]
|
enthusiast
Registered: 20/08/2002
Posts: 340
Loc: Pittsburgh, PA
|
Hmm, where are you getting the coordinates from?
The url's of the step-by-step directions?
In any case, create a file containing lines with
<lat> <long> <descr>
And add something like the following function to parse_mapsonus.py:
def parse_simple(desc):
f = open(desc)
wps=[]
while 1:
line = f.readline().strip()
if not line: break
parts = line.split()
lat = float(parts[0])
long = float(parts[1])
desc = " ".join(parts[2:])
wps.append(Wpoint(Coord(lat, long), desc))
return wps
and replace the line that reads 'wpoints = parse(inname)' with 'wpoints = parse_simple(inname)'
_________________________
40GB - serial #40104051 gpsapp
|
Top
|
|
|
|
#138613 - 01/02/2003 17:50
Re: How to get routes for GPSapp?
[Re: jaharkes]
|
member
Registered: 18/02/2002
Posts: 179
Loc: Germany
|
I use GPS Utility to extract the coordinates from the .html file. I don't know where it gets them from, sorry.
I save the route to a .txt file and then I have to edit this file to match your format (<lat> <long> <descr>), which is quite time consuming. I don't know if I can force GPS Utility to output to that format.
The code you've posted works great. Thanks!
Thorsten
_________________________
----------------------------
MK1: 00314 (4GB)
MK2a: 030103104 (30GB)
Installed in a BMW 323ti
|
Top
|
|
|
|
#138614 - 01/02/2003 18:25
Re: How to get routes for GPSapp?
[Re: Warp10]
|
addict
Registered: 14/01/2002
Posts: 443
Loc: Raleigh, NC
|
GPS Utility doesn't list an import rule for Greenflag.. How do you import the route html page? Also, the pages that Greenflag generates doesn't seem to contain any information other than the distance/time/directions.. Did you set any options on the site to display GPS coords?
|
Top
|
|
|
|
#138615 - 01/02/2003 18:53
Re: How to get routes for GPSapp?
[Re: Yang]
|
member
Registered: 18/02/2002
Posts: 179
Loc: Germany
|
Be sure you use the latest version of GPS Utility. To import the .html file you have to select 'MapsOnUS (html, htm)' in the file format list of the 'File->Open...' dialog. I don't know why the author didn't make an extra menu entry for greenflag.com; maybe he just forgot it. I think you also have to select step by step instructions, because the coordinates are used as an argument for a script or something to draw the mini maps.
Thorsten
Edited by Warp10 (01/02/2003 18:54)
_________________________
----------------------------
MK1: 00314 (4GB)
MK2a: 030103104 (30GB)
Installed in a BMW 323ti
|
Top
|
|
|
|
#138616 - 01/02/2003 19:17
Re: How to get routes for GPSapp?
[Re: Warp10]
|
addict
Registered: 14/01/2002
Posts: 443
Loc: Raleigh, NC
|
Ahh.. I think it parses the URL to the images for each turn. This won't give you the route information, but it will give you the coords for the directions.. As for importing, you'll either have to learn Python, or get someone to write it for you.. You really don't need GPS Utility to extract the information, as the python script can simply be written to parse the HTML output from greenflag. Also, GPS Utility doesn't allow for formatting the output.
Edited by Yang (01/02/2003 19:21)
|
Top
|
|
|
|
#138617 - 01/02/2003 19:25
Re: How to get routes for GPSapp?
[Re: Yang]
|
addict
Registered: 14/01/2002
Posts: 443
Loc: Raleigh, NC
|
If you give me 5 min to re-learn python, I'll see about making a parse_greenflag.py for you.
|
Top
|
|
|
|
#138618 - 01/02/2003 19:29
Re: How to get routes for GPSapp?
[Re: Yang]
|
member
Registered: 18/02/2002
Posts: 179
Loc: Germany
|
Wow, that would really be great!!! I would have to learn python from scratch...
Thorsten
_________________________
----------------------------
MK1: 00314 (4GB)
MK2a: 030103104 (30GB)
Installed in a BMW 323ti
|
Top
|
|
|
|
#138619 - 01/02/2003 19:40
Re: How to get routes for GPSapp?
[Re: Warp10]
|
addict
Registered: 14/01/2002
Posts: 443
Loc: Raleigh, NC
|
Heh.. I wouldn't say I'm that far away from scratch.. I'd be more comfortable with Perl, but I'll give it a shot..
[Edit]No wonder Python isn't very popular.. The lack of any kind of code structure syntax makes reading it next to impossible.
Edited by Yang (01/02/2003 20:18)
|
Top
|
|
|
|
#138620 - 01/02/2003 21:33
Re: How to get routes for GPSapp?
[Re: Yang]
|
addict
Registered: 14/01/2002
Posts: 443
Loc: Raleigh, NC
|
I can't read the script well enough to figure out where the changes need to be made. I'll give it annother look tomarrow, but that code is confusing..
|
Top
|
|
|
|
#138621 - 16/02/2003 09:43
Re: How to get routes for GPSapp?
[Re: Yang]
|
journeyman
Registered: 12/01/2003
Posts: 64
Loc: Germany
|
Hi Yang,
found some open source-code for phyton-to-c conversion (see file attached). Maybe it helps a bit.
Juergen
Attachments
141581-python2c-1.0a4.zip (40 downloads)
|
Top
|
|
|
|
#138622 - 16/02/2003 11:07
Re: How to get routes for GPSapp?
[Re: fossi]
|
addict
Registered: 14/01/2002
Posts: 443
Loc: Raleigh, NC
|
Getting a 404 for the file, but found annother copy elsewhere. I'll have to look through the source code, but from what I can tell, even it can't really figure out what the code is supposed to do. Python is a language that relies on it's flow to be encoded by the indentation. So far, the python2c script has found several inconsistant indentation errors, so the C code it genereated has wacky code blocks in it.
I attached the output to show what I mean.
Attachments
141590-parse_mapsonus.0.16.c (181 downloads)
|
Top
|
|
|
|
#138623 - 16/02/2003 11:10
Re: How to get routes for GPSapp?
[Re: Yang]
|
addict
Registered: 14/01/2002
Posts: 443
Loc: Raleigh, NC
|
Oh, and here's the python2c file I found here.
*Note, I had to comment out the 'import wmod' line to get it to run.*
Attachments
141591-python2c.py (226 downloads)
|
Top
|
|
|
|
#138624 - 16/02/2003 11:20
Re: How to get routes for GPSapp?
[Re: Yang]
|
journeyman
Registered: 12/01/2003
Posts: 64
Loc: Germany
|
Try to post it again! (see attached)
BTW: Thanks for your work, would also be keen on converting greenflag, as I live in Germany, too.
Attachments
141593-python2c-1.0a4.zip (30 downloads)
|
Top
|
|
|
|
#138625 - 16/02/2003 11:24
Re: How to get routes for GPSapp?
[Re: Warp10]
|
journeyman
Registered: 12/01/2003
Posts: 64
Loc: Germany
|
Hi Warp10,
could you please give me a short description of using gps utility to generate data that is useful for gpsapp. All my tries don't generate coordinates similar to the expected format.
|
Top
|
|
|
|
#138626 - 16/02/2003 12:25
Re: How to get routes for GPSapp?
[Re: fossi]
|
addict
Registered: 14/01/2002
Posts: 443
Loc: Raleigh, NC
|
Umm... I don't think that trying to convert directly to C is the best way to go.. see the attached file..
Edit: Nevermind.. let's just say that it's now a 5483 line file..
Attachments
141602-__parse_mapsonus.c (176 downloads)
|
Top
|
|
|
|
#138627 - 16/02/2003 12:35
Re: How to get routes for GPSapp?
[Re: fossi]
|
addict
Registered: 14/01/2002
Posts: 443
Loc: Raleigh, NC
|
I think I'm going to go a different route now. I know this goes against all sensible programming practices, but I'll just write a perl script to extract the information from the greenflag .html, and generate a file that parse_mapsonus.py can read. If you think of it in the sense that it allows further changes to the parse_mapsonus.py script without having to change the parse_greenflag.pl script, it's not that much of a hack..
|
Top
|
|
|
|
#138628 - 16/02/2003 14:51
Re: How to get routes for GPSapp?
[Re: Yang]
|
addict
Registered: 14/01/2002
Posts: 443
Loc: Raleigh, NC
|
Man.. If I knew how easy this was I'd have done it a lot longer.. Here's the script, documentation is included inside.
Let me know if you run accross any routes that it can't handle. As I live in the US, I just tossed a couple cities I know of in the UK at it and used that as my benchmark.
Attachments
141610-greenflag2mapsonus.pl (221 downloads)
|
Top
|
|
|
|
#138629 - 16/02/2003 14:58
Re: How to get routes for GPSapp?
[Re: Yang]
|
enthusiast
Registered: 20/08/2002
Posts: 340
Loc: Pittsburgh, PA
|
Wow, that download looks like a very serious vulnerability in the BBS software.
_________________________
40GB - serial #40104051 gpsapp
|
Top
|
|
|
|
#138631 - 16/02/2003 15:09
Re: How to get routes for GPSapp?
[Re: jaharkes]
|
veteran
Registered: 19/06/2000
Posts: 1495
Loc: US: CA
|
No kidding. Makes me wonder...
At least that doesn't work, but executing perl scripts is a Bad Thing (tm).
Attachments
141614-uhoh.php (215 downloads)
Edited by ricin (16/02/2003 15:11)
_________________________
Donato MkII/080000565 MkIIa/010101253 ricin.us
|
Top
|
|
|
|
#138632 - 16/02/2003 15:15
Re: How to get routes for GPSapp?
[Re: jaharkes]
|
addict
Registered: 14/01/2002
Posts: 443
Loc: Raleigh, NC
|
Eek.. Here's it as a .txt file..
Attachments
141616-greenflag2mapsonus.txt (180 downloads)
|
Top
|
|
|
|
#138633 - 16/02/2003 15:22
UBB.Threads bug?
[Re: ricin]
|
carpal tunnel
Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
|
Testing....
Edit: Uh oh. This is a gigantic bug.
The file I attached had the following contents:#!/usr/bin/python
print "Content-type: text/html"
print ""
print "<HTML><HEAD><TITLE>UBB.Threads bug</TITLE></HEAD>"
print "<BODY>"
print "This shouldn't work.<P>"
print "If it does, this is a major bug."
print "</BODY></HTML>" I don't know if this is really a UBB.Threads bug or if it's a empeg.comms.net misconfig, but it definitely needs to be fixed.
Attachments
141617-print.py (131 downloads)
Edited by wfaulk (16/02/2003 15:24)
_________________________
Bitt Faulk
|
Top
|
|
|
|
#138634 - 16/02/2003 15:24
Re: UBB.Threads bug?
[Re: wfaulk]
|
veteran
Registered: 19/06/2000
Posts: 1495
Loc: US: CA
|
Uh oh. I would suggest going to (at least) version 6.1 ASAP, or at least inplementing the attachment wrapper script from it. See here.
Edited by ricin (16/02/2003 15:26)
_________________________
Donato MkII/080000565 MkIIa/010101253 ricin.us
|
Top
|
|
|
|
#138635 - 16/02/2003 23:39
Re: How to get routes for GPSapp?
[Re: Yang]
|
journeyman
Registered: 12/01/2003
Posts: 64
Loc: Germany
|
Have tested the script (on windows platform) and did not get good results.
Response from the script:
END {MARK.END} End Point
MIN 0
Nothing more, the input file is unchanged.
Attached my input file from greenflag.
Attachments
141661-test.txt (192 downloads)
|
Top
|
|
|
|
#138636 - 16/02/2003 23:55
Re: How to get routes for GPSapp?
[Re: fossi]
|
addict
Registered: 14/01/2002
Posts: 443
Loc: Raleigh, NC
|
Didn't seem to go through.. I'm getting a 404 for the file..
|
Top
|
|
|
|
#138637 - 16/02/2003 23:55
Re: How to get routes for GPSapp?
[Re: fossi]
|
journeyman
Registered: 12/01/2003
Posts: 64
Loc: Germany
|
O.K., attachment does not work, so find my sample file on
www.bndlg.de/~fossi/test.txt
|
Top
|
|
|
|
#138638 - 17/02/2003 00:15
Re: How to get routes for GPSapp?
[Re: fossi]
|
addict
Registered: 14/01/2002
Posts: 443
Loc: Raleigh, NC
|
Found, debugged, fixed, posted...
|
Top
|
|
|
|
#138639 - 17/02/2003 13:14
Re: How to get routes for GPSapp?
[Re: Yang]
|
journeyman
Registered: 12/01/2003
Posts: 64
Loc: Germany
|
Hi Yang,
wow great, this one works perfectly - many thanks!
Now some comments from my side:
1. when viewing the greenflag results, saving the page as .htm does not wok, but viewing the page as sourcecode and then saving the file does
2. for convenient use I like automation so much, therefore here an idea for an automated conversion process: www.bndlg.de/~fossi/convert.zip
Usage:
1. Decompress the zip-file
2. edit convert.bat to match your empeg's IP-address
3. make sure that perl and phyton support is installed
4. Save a greenflag result in the directory of the decompressed convert.zip as *.htm file (e.g. test.htm), extension .htm is required
5. run: convert.bat with filename (without .htm extension) as argument, e.g.: "convert test"
6. now a file called test should be converted to the right format and transmitted to the empeg in the routes-directory
Please comment.
Is it worth while to work more on this issue to make it more failure prooven?
Juergen
|
Top
|
|
|
|
#138640 - 17/02/2003 17:19
Re: UBB.Threads bug?
[Re: wfaulk]
|
carpal tunnel
Registered: 08/06/1999
Posts: 7868
|
Edit: Uh oh. This is a gigantic bug.
This is fixed now. Scripts now will give a forbidden error, due to options -ExecCGI being enabled for the files directory.
|
Top
|
|
|
|
|
|