Welcome to the MP3Car.com forums.
You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. Registering will also remove advertisements. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!
If you have any problems with the registration process or your account login, please contact contact us.
|
11-30-2006, 01:29 PM
|
#1
|
|
FLAC
Join Date: Apr 2005
Location: Boston, MA
Vehicle: 2002 Chrysler Sebring Coupe LXI
Posts: 1,747
|
Yet another Cache Builder for Google Earth (Linux/Win/Mac)
Here's V1 of my own take at a cache builder for Google Earth.
It's written in perl, so after installing perl (if you don't have it on your system already), you'll just have to install the required modules.
Code:
ge_cachbuild.pl -lat [pos] -lon [pos] -range [meters] -hkm [km] -vkm [km] -sleep [sec]
-lat (Northwest corner in decimal degrees) ex: 42.832778
-lon (Northwest in decimal degrees) ex: -72.983889
-range (Range in meters) ex: 600
-hkm (Int number of kilometers to scan West to East) ex: 15
-vkm (Int number of kilometers to scan North to South) ex: 10
(Optional)
-sleep (Int number of seconds to sleep before moving), default 3
-hres (Int horiztonal block to resume at)
-vres (Int horiztonal block to resume at)
* To resume where you left off, supply the last -hres, -vres parameters that were output.
Once started, it writes out invalid KML to $KML_FILE
Add $KML_FILE as a network link to refresh once a second and check the "Fly to" option.
You should get an error about an invalid token. Click ignore (this prevents it happening mid-run)
Next it will overlay an image over the area to be scanned, if it's the desired area, hit "y" to continue or "n" to quit.
The overlay will disappear and scanning begins.
Install Tips
---------------------------------------------------------------------------------
Just untar (or use winzip) the file into an appropriate directory of your choosing.
A few things you'll need to do first before it will work.
You need to change some config variables
Code:
# The KML network link file, need a fully qualified path
my $KML_FILE = '/home/lee/cachebuild.kml';
# The overlay file, need a fully qualified path!
my $OVERLAY_FILE = '/home/lee/ge_cachebuild/cachebuild.gif';
# The icon file, need a fully qualified path!
my $ICON = '/home/lee/ge_cachebuild/cachebuild-icon.gif',
Point them to some place reasonable on your system, using FULLY QUALIFIED NAMES
examples:
my $KML_FILE = 'C:\ge_cacher\nutwurk-link.kml';
Don't forget to quote the value.
You'll need to have perl, but you'll also need to install the following modules.
Code:
Geo::Distance
Geo::Forward
For linux users it's easy (I think Mac is the same???)
Code:
> perl -MCPAN -e shell
> install Geo::Forward
> install Geo::Distance
If it asks to install any prerequisites, just say yes.
For windows, it will depend on your perl distro. Look at the appropriate docs on loading modules
Here is a decent Perl for Windows
http://www.activestate.com/Products/ActivePerl/
I banged this out pretty quick, I'll probably make some changes (specifying SE lat/long instead of width and height to scan, for instance)
UPDATED version 1.02
The source
Download ge_cachebuild.pl v1.02
-added resume, % progress to output and GE.
Feedback welcome.
Last edited by shotgunefx : 11-30-2006 at 06:47 PM.
Reason: bug fix!
|
|
|
11-30-2006, 04:23 PM
|
#2
|
|
FLAC
Join Date: Apr 2005
Location: Boston, MA
Vehicle: 2002 Chrysler Sebring Coupe LXI
Posts: 1,747
|
In my haste to clean it up, introduced an error where it would not move down after scanning, so it would keep scanning the same horiztonal line.
Fixed. Link updated.
|
|
|
11-30-2006, 06:48 PM
|
#3
|
|
FLAC
Join Date: Apr 2005
Location: Boston, MA
Vehicle: 2002 Chrysler Sebring Coupe LXI
Posts: 1,747
|
Bump, added resume and progress bar.
|
|
|
11-30-2006, 07:24 PM
|
#4
|
|
Constant Bitrate
Join Date: Dec 2005
Posts: 127
|
where to get the modules and how to install them ?
|
|
|
11-30-2006, 07:41 PM
|
#5
|
|
FLAC
Join Date: Apr 2005
Location: Boston, MA
Vehicle: 2002 Chrysler Sebring Coupe LXI
Posts: 1,747
|
Quote: Originally Posted by 0-0-7 
where to get the modules and how to install them ?
If your running linx, you use the commands in the first post to connect to the CPAN repository (Tens of thousands of libraries, Perl's biggest strength),
If the modules (and the modules they depend on) are pure perl code (which I believe they are), then you can install them the same way on Windows.
Or if you are using Activeperl, you can install modules with "ppm" (Perl Package Manager) and should go something like this.
C:>ppm
PPM>install Module-Name
Modules names on ppm have the "::" replace with a single or double dash IIRC.
Check this out (win)
http://aspn.activestate.com/ASPN/doc...Perl-faq2.html
They don't have all the modules that exist on CPAN. If it doesn't exist on ppm, then you have to install it directly which may be easy (for pure perl modules) or difficult (for modules that depend on C code), I don't think either of these falls in that category.
Some more links.
A guide to installing modules on Win32
A Practical Guide to Compiling C based Modules under ActiveState using Microsoft C++
Again, I don't believe you'll have to do any compiling at all so it should be easy (There is a reason I didn't use any XML libraries to generate the markup)
Have you installed a version of Perl yet?
|
|
|
02-11-2007, 09:20 PM
|
#6
|
|
Maximum Bitrate
Join Date: Sep 2006
Location: Georgia
Vehicle: 2000/Chrysler/300M
Posts: 513
|
ive installed activeperl and the perl package manger doesnt have Geo:  istance
It has Geo::Functions which i installed.
Changed the perl file to point to d:\gearth\ but it's not building a kml file.
Error
Quote:
Can't locate Geo/Distance.pm in @INC (@INC contains: C:/Perl/site/lib C:/Perl/li
b .) at D:\GEarth\ge_cachebuild.pl line 5.
BEGIN failed--compilation aborted at D:\GEarth\ge_cachebuild.pl line 5.
Obviously the geo functions I need arent easily found.
__________________
Car : 00' Chrysler 300M
Speakers : Rainbow Audio SLC 265 | Subs : Diamond Audio D6 12" Subs X2
Amp's : Hifonics ZXi 6006 AB | Hifonics BXi 1606 D
CarPC: HP Laptop AMD Sempron 3000+ | 1.5GB RAM | DVD+RW | 80GB 5400RPM HD | ATI R200 Video
|
|
|
02-11-2007, 09:34 PM
|
#7
|
|
Maximum Bitrate
Join Date: Sep 2006
Location: Georgia
Vehicle: 2000/Chrysler/300M
Posts: 513
|
well i manged to get Geo:  istance isntalled using cmd line ppm install Geo  istance on a copy I found on a repository. Still looking for geo foward
__________________
Car : 00' Chrysler 300M
Speakers : Rainbow Audio SLC 265 | Subs : Diamond Audio D6 12" Subs X2
Amp's : Hifonics ZXi 6006 AB | Hifonics BXi 1606 D
CarPC: HP Laptop AMD Sempron 3000+ | 1.5GB RAM | DVD+RW | 80GB 5400RPM HD | ATI R200 Video
|
|
|
02-11-2007, 09:42 PM
|
#8
|
|
Maximum Bitrate
Join Date: Sep 2006
Location: Georgia
Vehicle: 2000/Chrysler/300M
Posts: 513
|
new error. Got both modules installed
Quote:
D:\GEarth>ge_cachebuild.pl
Use of uninitialized value in concatenation (.) or string at D:\GEarth\ge_cachebuild.pl line 47.
Missing or invalid latitude []
usage:
ge_cachbuild.pl -lat [pos] -lon [pos] -range [meters] -hkm [km] -vkm [km] sleep
[sec]
-lat (Northwest corner in decimal degrees) ex: 42.832778
-lon (Northwest in decimal degrees) ex: -72.983889
-range (Range in meters) ex: 600
-hkm (Int number of kilometers to scan West to East) ex: 15
-vkm (Int number of kilometers to scan North to South) ex: 10
(Optional)
-sleep (Int number of seconds to sleep before moving), default 3
-hres (Int horiztonal block to resume at)
-vres (Int vertical block to resume at)
* To resume where you left off, supply the last -hres, -vres parameters that were output.
D:\GEarth>ge_cachebuild.pl
__________________
Car : 00' Chrysler 300M
Speakers : Rainbow Audio SLC 265 | Subs : Diamond Audio D6 12" Subs X2
Amp's : Hifonics ZXi 6006 AB | Hifonics BXi 1606 D
CarPC: HP Laptop AMD Sempron 3000+ | 1.5GB RAM | DVD+RW | 80GB 5400RPM HD | ATI R200 Video
|
|
|
08-16-2007, 07:39 PM
|
#9
|
|
Newbie
Join Date: Jun 2006
Location: Madrid, Spain
Vehicle: 2002 VW Golf IV
Posts: 36
|
Use of uninitialized value in concatenation (.) or string at ./ge_cachebuild.pl line 48.
Same thing to me... I had to force the install of Geo:  istance.
( Ubuntu 6.06 )
=(
|
|
|
08-16-2007, 07:58 PM
|
#10
|
|
FLAC
Join Date: Apr 2005
Location: Boston, MA
Vehicle: 2002 Chrysler Sebring Coupe LXI
Posts: 1,747
|
Quote: Originally Posted by eurocarpc 
Use of uninitialized value in concatenation (.) or string at ./ge_cachebuild.pl line 48.
Same thing to me... I had to force the install of Geo:  istance.
( Ubuntu 6.06 )
=(
Does it exit?
By itself, "Use of uninitialized value" is usually a harmless message.
Line 48 is checking to see if you passed a -lon (longitude) parameter, if you didn't, it will die with a usage message.
The usage message references $nw_long, which if you haven't passed a -lonvalue, will be "uninitialized", hence the warning. It shouldn't cause the program to exit, as it's a warning, not an error.
Why am I referencing a value that's not there? I had planned on adding a check to see if it looked like a valid lat/long, hence "Missing or invalid", just never got around to it.
|
|
|
08-16-2007, 08:02 PM
|
#11
|
|
FLAC
Join Date: Apr 2005
Location: Boston, MA
Vehicle: 2002 Chrysler Sebring Coupe LXI
Posts: 1,747
|
Quote: Originally Posted by Ruffy 
new error. Got both modules installed
Sorry I didn't see this reply before now, your not passing the command line options as stated in the first post.
It barks
Quote:
Missing or invalid latitude
because lat is checked first, if you supplied lat and not lon, it would bark about lon. It stops checking errors after the first.
|
|
|
08-17-2007, 09:33 AM
|
#12
|
|
Newbie
Join Date: Jun 2006
Location: Madrid, Spain
Vehicle: 2002 VW Golf IV
Posts: 36
|
Hi! I'm trying to make it work by setting the variables by hand in the perl file. Besides, I (being a bit stupid) would appreciate if you could explain what exactly means:
-lon (Northwest in decimal degrees) ex: -72.983889 ?
-range (Range in meters) ex: 600 ?
-sleep (Int number of seconds to sleep before moving), default 3 ?
-hres (Int horiztonal block to resume at) ?
-vres (Int horiztonal block to resume at) ?
|
|
|
08-17-2007, 10:43 AM
|
#13
|
|
FLAC
Join Date: Apr 2005
Location: Boston, MA
Vehicle: 2002 Chrysler Sebring Coupe LXI
Posts: 1,747
|
Quote: Originally Posted by eurocarpc 
Hi! I'm trying to make it work by setting the variables by hand in the perl file. Besides, I (being a bit stupid) would appreciate if you could explain what exactly means:
-lon (Northwest in decimal degrees) ex: -72.983889 ?
-range (Range in meters) ex: 600 ?
-sleep (Int number of seconds to sleep before moving), default 3 ?
-hres (Int horiztonal block to resume at) ?
-vres (Int horiztonal block to resume at) ?
-lon is the longitude, The -lat/-lon pair you specify is the northwest corner of where scanning starts.
-range is the distance from the ground in meters of the viewpoint (what it's called in GE), the higher up you are, the more you should be able to fit into the cache.
-sleep is just how long to pause between scanning. If it's too fast for your internet connection, it may move from an area before you've downloaded the map data.
(-hres,-vres) are for if you get interrupted and want to resume where you left off. As the program is scanning along, it spits out the current lat/lon and (hres,vres) parameters. If you need to stop the program for any reason (it can take a long time to scan larger areas), just jot these two numbers down. Then when you start it up again, specify them on the command line via -hres and -vres and it will pick up from where it left off. Do not specify them at all unless you are resuming.
Maybe a more detailed explanation of how it works would be helpful.
The lat/lon specified on the command line indicate the Northwest corner of the area we would like to scan. How large an area to scan is determined by hkm (how far horizontally/East), vkm (how far vertically/South). The reason I set it up so that you only specified the NW coordinate and the area as offsets, was it just easier to handle them that way and I didn't have to worry about people entering them backwards, etc.
An example run from the command line
Code:
ge_cachbuild.pl -lat 42.832778 -lon -72.983889 -range 600 -hkm 15 -vkm 10 -sleep 2
This is going to start at 42.832778,-72.983889 (Just North of the NW border of Massachusetts) and scan East 15 kilometers and south 10 kilometers, at a range of 600 meters.
When the program starts, it calculates the Southeast corner by adding hkm and vkm to the Northwest coordinate.
It then divides that area into a grid of MxN blocks (horizontal distance/range)x(vertical distance/range),
When scanning starts, it starts off the viewpoint in the KML file in the NE corner, moves horizontal -range meters, then sleeps for -sleep seconds, and keeps repeating this until it has reached the East side.
Once it does, it resets back to the West side and moves South -range meters and repeats so on and so forth until the entire area is scanned.
Also, instead of hard-coding the values in the script, you would probably be better off making a batch file that runs the script with the appropriate values.
Is this helpful?
|
|
|
08-17-2007, 11:31 AM
|
#14
|
|
Newbie
Join Date: Jun 2006
Location: Madrid, Spain
Vehicle: 2002 VW Golf IV
Posts: 36
|
It was helpful indeed, but:
I uncompressed the file again, and used it with this parameters:
./ge_cachebuild.pl -lat 40.294747 -lon -3.433333 -range 600 -hkm 100 -vkm 100
Which intends to be a 100x100km area around Madrid.
And the grid does not overlay on top of the area I intented... It goes SE by a few dozen kms... =(
Am I doing something wrong?
|
|
|
08-17-2007, 11:42 AM
|
#15
|
|
FLAC
Join Date: Apr 2005
Location: Boston, MA
Vehicle: 2002 Chrysler Sebring Coupe LXI
Posts: 1,747
|
Quote: Originally Posted by eurocarpc 
It was helpful indeed, but:
I uncompressed the file again, and used it with this parameters:
./ge_cachebuild.pl -lat 40.294747 -lon -3.433333 -range 600 -hkm 100 -vkm 100
Which intends to be a 100x100km area around Madrid.
And the grid does not overlay on top of the area I intented... It goes SE by a few dozen kms... =(
Am I doing something wrong?
Is 40.294747,-3.433333 the center of the area you want or the NW corner? It sounds like you are entering the center. If you entered the center instead of the corner, it would put it SE of where you would expect, and with a 100x100km range, a few dozen sounds like 50km off where you would expect.
An easy way to get the NW position is to go into GE and get it from there or go to google maps and pick it, then click the "Link to this page", the url will then give you the lat/lon.
Maybe I'll rewrite the options to specify the coordinates by the center (or as a pair NW,SE) as it seems like that will be more intuitive for most.
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 09:18 PM.
|
|