Sponsored links

Go Back   MP3Car.com > Mp3Car Technical > Software & Software Development > Support Software > Other Cool Stuff


Reply
 
Share Thread Tools Display Modes
Old 11-30-2006, 02:29 PM   #1
Raw Wave
 
shotgunefx's Avatar
 
Join Date: Apr 2005
Location: Boston, MA
Posts: 1,800
shotgunefx is on a distinguished road
Cool 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 07:47 PM.. Reason: bug fix!
shotgunefx is offline   Reply With Quote
Advertisement
 
Advertisement
Advertisement Sponsored links

Old 11-30-2006, 05:23 PM   #2
Raw Wave
 
shotgunefx's Avatar
 
Join Date: Apr 2005
Location: Boston, MA
Posts: 1,800
shotgunefx is on a distinguished road
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.
shotgunefx is offline   Reply With Quote
Old 11-30-2006, 07:48 PM   #3
Raw Wave
 
shotgunefx's Avatar
 
Join Date: Apr 2005
Location: Boston, MA
Posts: 1,800
shotgunefx is on a distinguished road
Bump, added resume and progress bar.
shotgunefx is offline   Reply With Quote
Old 11-30-2006, 08:24 PM   #4
Constant Bitrate
 
Join Date: Dec 2005
Posts: 127
0-0-7 is on a distinguished road
where to get the modules and how to install them ?
0-0-7 is offline   Reply With Quote
Old 11-30-2006, 08:41 PM   #5
Raw Wave
 
shotgunefx's Avatar
 
Join Date: Apr 2005
Location: Boston, MA
Posts: 1,800
shotgunefx is on a distinguished road
Quote: Originally Posted by 0-0-7 View Post
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?
shotgunefx is offline   Reply With Quote
Old 02-11-2007, 10:20 PM   #6
Maximum Bitrate
 
Ruffy's Avatar
 
Join Date: Sep 2006
Location: Georgia
Posts: 513
Ruffy is an unknown quantity at this point
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
Ruffy is offline   Reply With Quote
Old 02-11-2007, 10:34 PM   #7
Maximum Bitrate
 
Ruffy's Avatar
 
Join Date: Sep 2006
Location: Georgia
Posts: 513
Ruffy is an unknown quantity at this point
well i manged to get Geo:istance isntalled using cmd line ppm install Geoistance 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
Ruffy is offline   Reply With Quote
Old 02-11-2007, 10:42 PM   #8
Maximum Bitrate
 
Ruffy's Avatar
 
Join Date: Sep 2006
Location: Georgia
Posts: 513
Ruffy is an unknown quantity at this point
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
Ruffy is offline   Reply With Quote
Sponsored links
Advertisement
 
Advertisement
Old 08-16-2007, 08:39 PM   #9
Low Bitrate
 
eurocarpc's Avatar
 
Join Date: Jun 2006
Location: Madrid, Spain
Posts: 68
eurocarpc is on a distinguished road
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 )

=(
eurocarpc is offline   Reply With Quote
Old 08-16-2007, 08:58 PM   #10
Raw Wave
 
shotgunefx's Avatar
 
Join Date: Apr 2005
Location: Boston, MA
Posts: 1,800
shotgunefx is on a distinguished road
Quote: Originally Posted by eurocarpc View Post
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.
shotgunefx is offline   Reply With Quote
Old 08-16-2007, 09:02 PM   #11
Raw Wave
 
shotgunefx's Avatar
 
Join Date: Apr 2005
Location: Boston, MA
Posts: 1,800
shotgunefx is on a distinguished road
Quote: Originally Posted by Ruffy View Post
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.
shotgunefx is offline   Reply With Quote
Old 08-17-2007, 10:33 AM   #12
Low Bitrate
 
eurocarpc's Avatar
 
Join Date: Jun 2006
Location: Madrid, Spain
Posts: 68
eurocarpc is on a distinguished road
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) ?
__________________
My project: double indash, Golf IV
http://www.mp3car.com/vbulletin/showthread.php?p=841754
eurocarpc is offline   Reply With Quote
Old 08-17-2007, 11:43 AM   #13
Raw Wave
 
shotgunefx's Avatar
 
Join Date: Apr 2005
Location: Boston, MA
Posts: 1,800
shotgunefx is on a distinguished road
Quote: Originally Posted by eurocarpc View Post
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?
shotgunefx is offline   Reply With Quote
Old 08-17-2007, 12:31 PM   #14
Low Bitrate
 
eurocarpc's Avatar
 
Join Date: Jun 2006
Location: Madrid, Spain
Posts: 68
eurocarpc is on a distinguished road
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?
__________________
My project: double indash, Golf IV
http://www.mp3car.com/vbulletin/showthread.php?p=841754
eurocarpc is offline   Reply With Quote
Old 08-17-2007, 12:42 PM   #15
Raw Wave
 
shotgunefx's Avatar
 
Join Date: Apr 2005
Location: Boston, MA
Posts: 1,800
shotgunefx is on a distinguished road
Quote: Originally Posted by eurocarpc View Post
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.
shotgunefx is offline   Reply With Quote
Sponsored links
Advertisement
 
Advertisement
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Google Earth Cache Builder njwashor Other Cool Stuff 54 07-27-2007 11:54 AM
Drop-down menus don't work? Read this! gnomad Announcements 0 10-14-2005 02:15 PM



All times are GMT -5. The time now is 08:30 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.0
Copyright © 1999 - 2008 Mp3Car.com Inc.
"VaultWiki" powered by VaultWiki v2.5.2.
Copyright © 2008 - 2009, Cracked Egg Studios.Ad Management by RedTyger
Message Board Statistics