/usr/bin/geoinfo is in gpsdrive-scripts 2.10~pre4-6.dfsg-5.2ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | #!/usr/bin/perl
# Handling of POI/Streets Vector Data:
# For now:
# Retrieve POI Data from Different Sources
# And import them into mySQL for use with gpsdrive
# Get version number from version-control system, as integer
my $Version = '$Revision: 1683 $';
$Version =~ s/\$Revision:\s*(\d+)\s*\$/$1/;
my $VERSION ="geoinfo.pl (c) Joerg Ostertag
Initial Version (Jan,2005) by Joerg Ostertag <joerg.ostertag\@rechengilde.de>
Version 0.9-$Version
";
BEGIN {
my $dir = $0;
$dir =~s,[^/]+/[^/]+$,,;
unshift(@INC,"$dir/perl_lib");
# For Debug Purpose in the build Directory
unshift(@INC,"./perl_lib");
unshift(@INC,"./osm/perl_lib");
unshift(@INC,"./scripts/osm/perl_lib");
unshift(@INC,"../scripts/osm/perl_lib");
# For DSL
unshift(@INC,"/opt/gpsdrive/share/perl5");
unshift(@INC,"/opt/gpsdrive"); # For DSL
};
use strict;
use warnings;
#use POI::KismetXml;
use Data::Dumper;
#use Date::Manip qw(ParseDate DateCalc UnixDate);
use File::Basename;
use File::Copy;
use File::Path;
use Getopt::Long;
use HTTP::Request;
use IO::File;
use Pod::Usage;
use Geo::Gpsdrive::Utils::Debug;
use Geo::Gpsdrive::DBFuncs;
use Geo::Gpsdrive::Utils;
use Geo::Gpsdrive::Gps;
use Geo::Gpsdrive::DB_Defaults;
use Geo::Gpsdrive::GpsDrive;
use Geo::Gpsdrive::JiGLE;
use Geo::Gpsdrive::Kismet;
use Geo::Gpsdrive::OSM;
use Geo::Gpsdrive::PocketGpsPoi;
use Geo::Gpsdrive::Way_Txt;
use Geo::Gpsdrive::getstreet;
use Geo::Gpsdrive::gettraffic;
my ($man,$help);
our $CONFIG_DIR = "$ENV{'HOME'}/.gpsdrive"; # Should we allow config of this?
our $CONFIG_FILE = "$CONFIG_DIR/gpsdriverc";
our $MIRROR_DIR = "$CONFIG_DIR/MIRROR";
our $UNPACK_DIR = "$CONFIG_DIR/UNPACK";
our $GPSDRIVE_DB_NAME = "geoinfo";
our $development_version = (`id` =~ m/tweety/);
our $no_delete;
my @osm_files = ();
my $do_mapsource_points = 0;
my $do_cameras = 0;
my $do_all = 0;
my $do_create_db = 0;
my $do_gpsdrive_tracks = 0;
my $do_kismet_tracks = 0;
my $do_jigle = 0;
my $do_import_defaults = 0;
my $do_import_way_txt = 0;
my $do_traffic;
my $show_traffic;
our $do_delete_db_content = 0;
our $do_collect_init_data = 0;
our $street;
our $ort;
our $plz;
our $thread;
our $type;
our $sql;
our $file;
our ($lat_min,$lat_max,$lon_min,$lon_max) = (0,0,0,0);
our $lang = 'de';
our $db_user = $ENV{DBUSER} || '';
our $db_password = $ENV{DBPASS} || '';
Geo::Gpsdrive::DBFuncs::db_read_mysql_sys_pwd();
$db_user ||= 'gast';
$db_password ||= 'gast';
our $db_host = $ENV{DBHOST} || 'localhost';
#$db_host = 'host=localhost;mysql_socket=/home/tweety/.gpsdrive/mysql/mysqld.socket';
my $areas_todo;
my $do_list_areas=0;
my $do_show_version=0;
# Set defaults and get options from command line
Getopt::Long::Configure('no_ignore_case');
pod2usage(1)
unless @ARGV;
GetOptions (
'create-db' => \$do_create_db,
'fill-defaults' => \$do_import_defaults,
'openstreetmap:s@' => \@osm_files,
'osm:s@' => \@osm_files,
'osm_polite=s' => \$Geo::Gpsdrive::OSM::OSM_polite,
'mapsource_points=s' => \$do_mapsource_points,
'cameras' => \$do_cameras,
'gpsdrive-tracks' => \$do_gpsdrive_tracks,
'kismet-tracks=s' => \$do_kismet_tracks,
'jigle=s' => \$do_jigle,
'import-way-txt' => \$do_import_way_txt,
'all' => \$do_all,
'u=s' => \$db_user,
'p=s' => \$db_password,
'db-name=s' => \$GPSDRIVE_DB_NAME,
'db-user=s' => \$db_user,
'db-password=s' => \$db_password,
'db-host=s' => \$db_host,
'delete-db-content' => \$do_delete_db_content,
'collect-init-data' => \$do_collect_init_data,
'lat_min=s' => \$lat_min,
'lat_max=s' => \$lat_max,
'lon_min=s' => \$lon_min,
'lon_max=s' => \$lon_max,
'lat-min=s' => \$lat_min,
'lat-max=s' => \$lat_max,
'lon-min=s' => \$lon_min,
'lon-max=s' => \$lon_max,
'area=s' => \$areas_todo,
'list-areas' => \$do_list_areas,
'no-delete' => \$no_delete,
'd+' => \$DEBUG,
'debug+' => \$DEBUG,
'verbose' => \$VERBOSE,
'v+' => \$VERBOSE,
'debug_range=s' => \$debug_range,
'no-mirror' => \$no_mirror,
'proxy=s' => \$PROXY,
'MAN' => \$man,
'man' => \$man,
'street=s' => \$street, #need for getstreet
'city=s' => \$ort,
'zip=s' => \$plz,
'sql' => \$sql,
'thread' => \$thread,
'file' => \$file,
'get-traffic' => \$do_traffic,
'show-traffic' => \$show_traffic,
'h|help|x' => \$help,
'lang=s' => \$lang,
'version' => \$do_show_version,
)
or pod2usage(1);
if ( $do_show_version ) {
print "$VERSION\n";
};
if ( $do_all ) {
$do_create_db
= @osm_files
= $do_gpsdrive_tracks
= $do_cameras
= $do_jigle
= $do_import_defaults
= 1;
if ( $ENV{'LANG'} =~ /de_DE/ ) {
print "\n";
print "=============================================================================\n";
print "I assume i'm in Germany (LANG='$ENV{'LANG'}')\n";
}
}
if ( $do_list_areas ) {
print Geo::Gpsdrive::Filter::Area->list_areas()."\n";
}
pod2usage(1) if $help;
pod2usage(-verbose=>2) if $man;
########################################################################################
########################################################################################
########################################################################################
#
# Main
#
########################################################################################
########################################################################################
########################################################################################
Geo::Gpsdrive::DBFuncs::create_db()
if $do_create_db;
Geo::Gpsdrive::DB_Defaults::fill_defaults()
if $do_import_defaults || $do_create_db;
# Get and Unpack openstreetmap http://www.openstreetmap.org/
Geo::Gpsdrive::OSM::import_Data($areas_todo,@osm_files)
if ( @osm_files );
Geo::Gpsdrive::gettraffic::gettraffic()
if $do_traffic;
Geo::Gpsdrive::gettraffic::showtraffic()
if $show_traffic;
# Convert MapSource Waypoints to gpsdrive POI
Geo::Gpsdrive::mapsource::import_Data()
if ( $do_mapsource_points );
# Get and Unpack POCKETGPS_DIR http://www.pocketgpspoi.com
Geo::Gpsdrive::PocketGpsPoi::import_Data()
if ( $do_cameras );
# Import Waypoints from Way.txt
Geo::Gpsdrive::Way_Txt::import_Data()
if $do_import_way_txt;
# extract street Data from all tracks
Geo::Gpsdrive::GpsDrive::import_Data()
if ( $do_gpsdrive_tracks );
# extract street Data from all tracks
Geo::Gpsdrive::Kismet::import_Data($do_kismet_tracks)
if ( $do_kismet_tracks );
# extract WLAN Points from JiGLE Data
Geo::Gpsdrive::JiGLE::import_Data($do_jigle)
if ( $do_jigle );
__END__
=head1 NAME
B<geoinfo.pl> Version 0.9
=head1 DESCRIPTION
B<geoinfo.pl> is a program to download and convert waypoints
and other geospacial data for use with the new gpsdrive
POI Database.
You need to have mySQL Support.
This Programm is completely experimental, but some Data
can already be retrieved with it.
So: Have Fun, improve it and send me fixes :-))
WARNING:
This programm replaces some/all waypoints of desire.
So any changes made to the database may be overwritten!!!
If you have any self collected/changed Data do a backup first!!
=head1 SYNOPSIS
B<Common usages:>
geoinfo.pl [-d] [-v] [-h] [--mapsource_points='Filename']
=head1 OPTIONS
=over 2
=item B<--man> Complete documentation
Complete documentation
=item B<--create-db>
Try creating the tables inside the geoinfo database.
This also fills the database with some predefined types.
and imports wour way*.txt Files.
This also creates and modified the old waypoints table.
This implies --fill-defaults
=item B<--fill-defaults>
Fill the Databases with usefull defaults. This option is
needed before you can import any of the other importers.
=item B<--openstreetmap> B<--osm>[=filename]
Download and import openstreetmap Data.
If no parameter is given. planet.osm is downloaded and then imported.
If a filename is given this Filename is imported. The file needs to
be a *.osm File. You can get a osm File by saving your edited Data whis josm.
Currently we only read Nodes from OSM. But the rules in icons.xml are a
little bit outdated. So not every POI from osm is really imported. If you
like more POIs imported from OSM, please update icons.xml.
=item B<--all>
Triggers all of the above
=item B<--collect-init-data>
Collects default data and writes them into the default Files.
This option is normally used by the maintainer to create the
Defaults for filling the DB.
=item B<--gpsdrive-tracks>
Read all gpsdrive Tracks
and insert into streets DB
=item B<--import-way-txt>
Read all gpsdrive way*.txt
and insert into poi DB
=item B<--kismet-tracks=Directory>
Read all Kismet .gps Files in 'Directory', extract the Tracks
and insert them into streets DB
=item B<--jigle=Directory>
Read all jigle Files in directory, extract the Wavelan points
and insert them into POI DB
See http://www.wigle.net/ for the jiggle client
=item B<--get-traffic>
use for get traffic information from http://www.freiefahrt.info/rdstmc.do and write it in mysql
This feature is not completels implemented yet.
=item B<--show-traffic>
show traffic from mysql database
This feature is not completels implemented yet.
=item B<--street --ort [--plz] [--sql]>
use this for download street coordinates at the moment only germany is supported
Example: ./geoinfo.pl --street "Straße des Friedens" --ort Teutschenthal --plz 06179 --sql
--street is needed for the streetname, if the name has more then one word you have to use ""
--ort is for the name of the city
--plz is not evertime necessary only in a big city or if the there are more citys with the same name or a similarly name
whitout --sql the result will be write in ~/.gpsdrive/way.txt
=item B<--lat_min --lat_max --lon_min --lon_max>
For example for debug reasons for some inserts limit to the
given rectangle.
This feature is not implemented on all insert statements yet.
The values must be set to a none 0 value to be accepted.
=item B<--no-delete>
Does not delete the old entries in the DB prior to inserting the new ones.
=item B<--db-name>
Name of Database to use; default is geoinfo
=item B<--db-user>
username to connect to mySQL database. Default is gast
=item B<--db-password>
password for user to connect to mySQL database. Default is gast
=item B<--db-host>
hostname for connecting to your mySQL database. Default is localhost
=item B<--no-mirror>
Do not try mirroring the files from the original Server. Only use
files found on local Filesystem.
=item B<--proxy="hostname:port">
use proxy for download
=item B<--lang>
language of the POI-Type descriptions that will be used in the database.
At the moment the default is 'de' for german. If no entries are available
for the specified language, the english ones will be used.
=item B<--area=germany> Area Filter
Only read area for processing
Currently only for osm imports
to see which areas are available, use --list-areas
=item B<--list-areas>
print all areas possible
=back
|