summaryrefslogtreecommitdiff
path: root/debian
diff options
context:
space:
mode:
authorChristian Perrier <bubulle@debian.org>2012-10-07 13:27:36 +0100
committerChristian Perrier <bubulle@debian.org>2012-10-07 13:27:36 +0100
commit99f5c8bf63a674faf8c507aea7425b935814548a (patch)
treeb3202c295c4bb71ec09e3748d49b43a9fec6b4cd /debian
gpsdrive (2.10~pre4-6.dfsg-5.2) unstable; urgency=low
* Non-maintainer upload [ Allison Randal ] * Disable optional mapnik libraries, gpsdrive is incompatible with APIs of mapnik version 2.0.0. * debian/patches/107-fix-disable-mapnik.dpatch: Fix known bug with gpsdrive-2.10pre4 when disabling Mapnik library. # imported from the archive
Diffstat (limited to 'debian')
-rw-r--r--debian/NEWS.Debian11
-rw-r--r--debian/README.Debian59
-rw-r--r--debian/TODO18
-rw-r--r--debian/changelog362
-rw-r--r--debian/compat1
-rw-r--r--debian/control49
-rw-r--r--debian/copyright129
-rw-r--r--debian/docs18
-rw-r--r--debian/examples6
-rw-r--r--debian/gpsdrive-data.install3
-rw-r--r--debian/gpsdrive-scripts.install14
-rw-r--r--debian/gpsdrive-scripts.manpages6
-rw-r--r--debian/gpsdrive.install6
-rw-r--r--debian/gpsdrive.manpages2
-rw-r--r--debian/man/gpsfetchmap.1327
-rw-r--r--debian/patches/00list24
-rw-r--r--debian/patches/01-make.dpatch266
-rw-r--r--debian/patches/03-manpage.dpatch446
-rw-r--r--debian/patches/10-mapnikdir.dpatch252
-rw-r--r--debian/patches/100-fix-insecure-tempfiles.dpatch86
-rw-r--r--debian/patches/101-signalposreq.dpatch70
-rw-r--r--debian/patches/102-unittest.dpatch26
-rw-r--r--debian/patches/103-no-textquery.dpatch18
-rw-r--r--debian/patches/104-fix-xcursor-check.dpatch19
-rw-r--r--debian/patches/105-add-boost-links.dpatch19
-rw-r--r--debian/patches/107-fix-disable-mapnik.dpatch24
-rw-r--r--debian/patches/20-homedir.dpatch44
-rw-r--r--debian/patches/30-icons.dpatch52
-rw-r--r--debian/patches/40-backported.dpatch80
-rw-r--r--debian/patches/50-scripts.dpatch31
-rw-r--r--debian/patches/60-sql.dpatch31
-rw-r--r--debian/patches/70-perl.dpatch362
-rw-r--r--debian/patches/80-dbus.dpatch109
-rw-r--r--debian/patches/85-settings.dpatch26
-rw-r--r--debian/patches/90-usage.dpatch48
-rw-r--r--debian/patches/95-newapi.dpatch18
-rw-r--r--debian/patches/96-mapnik-plugins-dir.dpatch29
-rw-r--r--debian/patches/97-osmxml.dpatch82
-rw-r--r--debian/patches/98-mapnik-exception.dpatch51
-rw-r--r--debian/patches/99-autobestmap.dpatch26
-rw-r--r--debian/patches/gpsdrive2.10pre7_osm_proj.patch572
-rwxr-xr-xdebian/rules158
-rw-r--r--debian/scripts/gpsfetchmap.pl1975
43 files changed, 5955 insertions, 0 deletions
diff --git a/debian/NEWS.Debian b/debian/NEWS.Debian
new file mode 100644
index 0000000..bf00a7b
--- /dev/null
+++ b/debian/NEWS.Debian
@@ -0,0 +1,11 @@
+gpsdrive (2.10~pre4-3) unstable; urgency=low
+
+ The mapnik library since version 0.5.0 introduces a more strict checking
+ of the map configuration file ~/.gpsdrive/osm.xml.
+ If gpsdrive fails to initialize mapnik during startup please either remove
+ ~/.gpsdrive/osm.xml or remove/fix all elements mapnik is complaining
+ about, usually missing world_boundaries or a database connection problem.
+ If removed, the file will be re-created during next start of gpsdrive with
+ the world_boundaries part commented out.
+
+ -- Andreas Putzo <andreas@putzo.net> Thu, 28 Feb 2008 23:20:02 +0000
diff --git a/debian/README.Debian b/debian/README.Debian
new file mode 100644
index 0000000..32a665c
--- /dev/null
+++ b/debian/README.Debian
@@ -0,0 +1,59 @@
+gpsdrive for Debian
+-------------------
+
+Using gpsdrive with mapnik 2.0
+------------------------------
+
+* Gpsdrive is incompatible with the new APIs of mapnik 2.0.0. This
+ optional library is now disabled in the package.
+
+ -- Allison Randal <allison@canonical.com> Thu, 01 Dec 2011 12:48:22 -0800
+
+Upgrading from gpsdrive 2.09 (etch)
+-------------------------------------
+* The mysql database schema has been changed.
+ The existing database can be upgraded with the same command to create a new database.
+ geoinfo --db-user=root --db-password=<password> --create-db --fill-defaults
+ See README.mysql.gz for a more detailed description how to setup the mysql database.
+* Existing waypoints can be imported with convert-waypoints and poi-manager:
+ convert-waypoints
+ poi-manager -i -f way_converted_txt.gpx
+ poi-manager -i -f way_converted_sql.gpx
+ If everything went fine the old files can safely be removed:
+ rm ~/.gpsdrive/way.txt
+ rm ~/.gpsdrive/way-SQLRESULT.txt
+
+
+Using gpsdrive with mapnik
+---------------------------
+* Install osm2pgsql and postgresql-8.3-postgis if not already done.
+ aptitude install osm2pgsql postgresql-8.3-postgis
+* Download a OpenStreetmap planet file from http://planet.openstreetmap.org/,
+ wget http://planet.openstreetmap.org/planet-latest.osm.bz2
+* Set up postgresql:
+ sudo -u postgres createuser -Upostgres -S -D -R `whoami`
+ sudo -u postgres createdb -Upostgres -EUNICODE gis
+ echo GRANT ALL ON SCHEMA PUBLIC TO `whoami` | sudo -u postgres psql -Upostgres gis
+ sudo -u postgres createlang -Upostgres plpgsql gis
+ sudo -u postgres psql gis < /usr/share/postgresql-8.3-postgis/lwpostgis.sql
+ echo GRANT ALL ON geometry_columns TO `whoami` | sudo -u postgres psql -Upostgres gis
+ echo GRANT ALL ON spatial_ref_sys TO `whoami` | sudo -u postgres psql -Upostgres gis
+* Import planet.osm (this may take a long time).
+ osm2pgsql -v planet-latest.osm.bz2
+* Gpsdrive should now be usable with mapnik. Simply enable the mapnik checkbox in the
+ gpsdrive sidebar menu.
+* For world boundaries (e.g. not just street data) please do the following:
+ wget http://artem.dev.openstreetmap.org/files/world_boundaries.tar.bz2
+ sudo tar xjvf world_boundaries.tar.bz2 -C /usr/share/gpsdrive/mapnik
+
+If you use a different database setup or path for the world boundaries you may
+need to edit ~/.gpsdrive/osm.xml to reflect your changes.
+Replace `whoami` in above commands with your username if you create the database
+with a different account.
+
+ -- Andreas Putzo <andreas@putzo.net> Wed Oct 15 20:06:28 CEST 2007
+
+All scripts installed by gpsdrive has been renamed to a version without language extension,
+ e.g. /usr/bin/gpsfetchmap.pl has been renamed to /usr/bin/gpsfetchmap.
+
+ -- Andreas Putzo <andreas@putzo.net> Wed Jul 18 16:18:55 CEST 2007
diff --git a/debian/TODO b/debian/TODO
new file mode 100644
index 0000000..fabe370
--- /dev/null
+++ b/debian/TODO
@@ -0,0 +1,18 @@
+Debian maintainers TODO list
+----------------------------
+
+* Help upstream to get the perl module namespace organized.
+* Remove the following patches on next release as they are fixed upstream
+ - 01-make (upstream switched to cmake)
+ - 03-manpage
+ - 20-homedir (~/.gpsdrive/osm.xml no longer overwritten)
+ - 40-backported (bugfixes backported from upstream vcs)
+ - 60-sql (uses sqlite now)
+ - 90-usage (fixed upstream)
+ - 95-newapi (should be fixed)
+ - 96-mapnik-plugins-dir (should be fixed)
+ - 98-mapnik-exception (fixed upstream)
+ - 99-autobestmap (fixed upstream)
+* Create a bpo package for 2.4.10pre5
+
+-- Andreas Putzo <andreas@putzo.net> at Tue Jul 15 20:56:13 UTC 2008
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..8021119
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,362 @@
+gpsdrive (2.10~pre4-6.dfsg-5.2) unstable; urgency=low
+
+ * Non-maintainer upload
+
+ [ Allison Randal ]
+ * Disable optional mapnik libraries, gpsdrive is incompatible with
+ APIs of mapnik version 2.0.0.
+ * debian/patches/107-fix-disable-mapnik.dpatch:
+ Fix known bug with gpsdrive-2.10pre4 when disabling Mapnik library.
+
+ -- Christian Perrier <bubulle@debian.org> Sun, 07 Oct 2012 14:27:36 +0200
+
+gpsdrive (2.10~pre4-6.dfsg-5.1) unstable; urgency=medium
+
+ * Non-maintainer upload.
+ * debian/patches/104-fix-xcursor-check.dpatch:
+ - Define Xcursor within AC_CHECK_LIB, fix FTBFS.
+ (Closes: #615653, 628310)
+ * debian/patches/105-add-boost-links.dpatch:
+ - Link against boost-filesystem and boost-system.
+
+ -- Luca Falavigna <dktrkranz@debian.org> Thu, 01 Sep 2011 22:44:02 +0200
+
+gpsdrive (2.10~pre4-6.dfsg-5) unstable; urgency=low
+
+ * Added 103-no-textquery patch to remove Text::Query use. Removed
+ dependency on the libtext-query-perl package.
+ Thanks Jonathan Yu.
+ * Revised debian/control for a better layout.
+ * Vcs-* fields now point the trunk branch.
+
+ -- Francesco Paolo Lovergine <frankie@debian.org> Mon, 08 Mar 2010 11:23:39 +0100
+
+gpsdrive (2.10~pre4-6.dfsg-4) unstable; urgency=low
+
+ * Do not depend on versioned python.
+ * Policy bumped to 3.8.4.
+ * Moved to libmysqlclient-dev build-dep.
+ * Now suggests postgresql-8.4-postgis.
+ * Debhelper level moved to 7.
+ * Removed superfluous config.{guess,sub} override.
+ * Added me as an uploader.
+
+ -- Francesco Paolo Lovergine <frankie@debian.org> Thu, 04 Feb 2010 16:53:01 +0100
+
+gpsdrive (2.10~pre4-6.dfsg-3) unstable; urgency=low
+
+ * Regenerate aclocal.m4 with libtoolize in debian/rules.
+ Thanks to Adam D. Barratt (Closes: #527956)
+ * Updated build-dep to libmapnik-dev >= 0.6.
+ * Updated 96-mapnik-plugins-dir.dpatch to define the correct
+ MAPNIK_PATH.
+
+ -- Andreas Putzo <andreas@putzo.net> Thu, 11 Jun 2009 19:26:06 +0000
+
+gpsdrive (2.10~pre4-6.dfsg-2) unstable; urgency=low
+
+ * Remove example script gpssmswatch. Prone to symlink attacks
+ and removed upstream.
+ * Added 101-signalposreq.dpatch to remove signalposreq() from
+ gpsdrive to fix a potential symlink vulnerability. Removed
+ unused unlinks of temporary files (Closes: #508597,#508596).
+ * Added 102-unittest.dpatch to use mkdtemp in src/unit_test.c to
+ fix a symlink vulnerability.
+ * Updated patch for geo-code to avoid a potential race condition
+ (CVE-2008-5380).
+
+ -- Andreas Putzo <andreas@putzo.net> Mon, 29 Dec 2008 16:08:22 +0000
+
+gpsdrive (2.10~pre4-6.dfsg-1) unstable; urgency=low
+
+ * Added .dfsg to version to allow a sourceful upload
+ that really removes files with unknown or incompatible
+ licenses (gpsfetchmap.pl, map-icons/japan, map-icons/nickw)
+ from the upstream tarball, generated using the get-orig-source
+ target in debian/rules. (Closes: #497115)
+ * Fixed spelling error in short description of the gpsdrive-data package.
+ (Closes: #494657)
+ * Added patch 100-fix-insecure-tempfiles.dpatch that uses mktemp
+ in geo-code to avoid symlink attacks. Thanks Moritz Muehlenhoff for
+ the patch. (Closes: #496436)
+
+ -- Andreas Putzo <andreas@putzo.net> Sun, 31 Aug 2008 17:40:05 +0000
+
+gpsdrive (2.10~pre4-6) unstable; urgency=low
+
+ * gpsdrive-data: Remove dependency on gpsdrive and put it
+ back to Recommends which is sufficient.
+
+ -- Andreas Putzo <andreas@putzo.net> Sun, 10 Aug 2008 20:35:58 +0000
+
+gpsdrive (2.10~pre4-5) unstable; urgency=low
+
+ * Add missing Replaces to the gpsdrive-data package
+ and add a dependency on gpsdrive. (Closes: #493892)
+ * Update Suggests and README.Debian to postgresql-8.3-postgis.
+ * Remove make install for map-icons in debian/rules.
+ * Added Vcs-* fields to debian/control.
+
+ -- Andreas Putzo <andreas@putzo.net> Thu, 07 Aug 2008 10:13:33 +0000
+
+gpsdrive (2.10~pre4-4) unstable; urgency=low
+
+ * No longer create openstreetmap-map-icons-* binary packages.
+ They are build from the openstreetmap-map-icons source package
+ now. (Closes: #482866).
+ * Build a gpsdrive-data packages that contains architecture independent
+ files.
+ * Added DM-Upload-Allowed field to debian/control.
+ * Bumped Policy to 3.8.0, without changes.
+ * Updated 50-scripts.dpatch to fix bashism in wpget.
+ (Closes: #489603).
+ * Removed debian revison from mapnik dependency to
+ fix a lintian warning.
+ * Added 99-autobestmap.dpatch so that the toggle button
+ in gpsdrive works again. Already fixed upstream.
+ (Closes: #480234).
+ * Wrap lines in copyright file at 80 characters.
+
+ * Upload sponsored by Petter Reinholdtsen.
+
+ -- Andreas Putzo <andreas@putzo.net> Sat, 19 Jul 2008 20:01:39 +0000
+
+>>>>>>> .r2096
+gpsdrive (2.10~pre4-3) unstable; urgency=low
+
+ * Fix regression of last upload in the mapnik handling.
+ Mapnik no longer tolerates errors in the map config file.
+ - Add 97-osmxml.dpatch to fix a syntax error and to comment
+ the world_boundaries.
+ (Closes: #472825)
+ - Add 98-mapnik-exception.dpatch to handle errors more gracefully.
+ - Add NEWS file to explain how to handle existing osm.xml files
+ * Updated 50-scripts.dpatch (gpsdrive_mapnik_gentiles.py) to search
+ for osm.xml in user's home directory.
+ Thanks to Giovanni Mascellani.
+ (Closes: #466227)
+
+ -- Andreas Putzo <andreas@putzo.net> Wed, 26 Mar 2008 18:35:38 +0000
+
+gpsdrive (2.10~pre4-2) unstable; urgency=low
+
+ [ Andreas Putzo ]
+ * Enable DBUS support. All gps receivers supported by
+ gpsd should work with this interface.
+ - Added 80-dbus.dpatch
+ - Added libdubs-glib-1-dev to Build-Depends
+ - Changed debian/rules to use --enable-dbus
+ * Add 90-usage.dpatch to fix usage output
+ (Closes: #456152)
+ * Update 03-manpage.dpatch.
+ - Reflect usage changes.
+ - Changed mailinglist.
+ - Changed AUTHORS.
+ - Minor cosmetic changes.
+ * Updated 70-perl.dpatch, correcting module path of Geo::Gpsdrive::Filter.
+ Thanks to Michael Eric Menk.
+ (Closes: #458273)
+ * Add settings.dpatch using basename() to determine patch of way.txt in
+ gpsdriverc.
+ (Closes: #459213)
+ * Remove geo-nearest from the gpsdrive-scripts package.
+ Script no longer works with geocaching.com.
+ (Closes: #464982)
+ * Revise long description, removing redundancy.
+ (Closes: #467046)
+
+ [ Francesco Paolo Lovergine ]
+ * Added 95-newapi.dpatch patch to manage new mapnik 0.5 API.
+ Thanks Dominic Hargreaves.
+ (Closes: #465344,#466472)
+ * Added 96-mapnik-plugin-dir.dpatch to use the mapnik-plugin-dir utility
+ instead of the embedded lib path. This is suboptimal because
+ it should be autoconfiscated instead in gpsdrive bulding system.
+ But it works :)
+ * Policy bumped to 3.7.3, without changes.
+
+ -- Andreas Putzo <andreas@putzo.net> Tue, 26 Feb 2008 22:37:16 +0000
+
+gpsdrive (2.10~pre4-1) unstable; urgency=low
+
+ * New upstream release.
+ * Split the package to lower dependencies (-scripts) and
+ disk space usage (map-icons).
+ * Repackage upstream tarball to remove the debian/ dir.
+ Added get-orig-source target to debian/rules.
+ * Removed gpsfetchmap.pl from upstream tarball due to license issues.
+ A new version has been released under GPL which will be installed from
+ debian/scripts/gpsfetchmap.pl now. Updated the manpage for that reason.
+ * Removed map-icons with unclear licenses.
+ * Updated debian/copyright.
+ * Add Homepage field in debian/control.
+ * Bumped to debhelper compat level 5.
+ * Removed some docs and install some of the scripts as examples.
+ * Added Build-Depends on automake1.9.
+ * Add 01-make.dpatch to remove unneeded dirs from Makefile.{am,in}
+ and to remove checks for perl modules in configure.ac
+ * Add 03-manpage.dpatch, merged typo fixes for manpage from old patch.
+ * Add 10-mapnikdir.dpatch to install mapnik files in gpsdrive dir.
+ * Add 20-homedir.dpatch to avoid overriding files in user's homedir.
+ * Add 30-icons.dpatch so that the icons are found.
+ * Add 40-backported.dpatch to include some bugfixes from upstream VCS.
+ * Add 50-scripts.dpatch to use python2.5.
+ * Add 60-sql.dpatch, merged from old patch.
+ * Add 70-perl.dpatch to avoid namespace clashes for the perl modules.
+ * Removed 04_missing_includes.dpatch - package builds fine with gcc-4.3.
+ * Removed 05_start_gpsd.dpatch - feature has been removed.
+ * Added postgres and osm2pgsql to Suggests in debian/control.
+ * Updated dependencies.
+ * Updated debian readme file with install/upgrade hints.
+
+ -- Andreas Putzo <andreas@putzo.net> Tue, 16 Oct 2007 20:00:05 +0000
+
+gpsdrive (2.10~pre2-2) unstable; urgency=low
+
+ * Removed libfly.so, libnautic.so, because they weren't used.
+ * Removed gpsfetchmap wrapper from debian/.
+ * Fixed mistake in debian/rules which caused gpsdrive to configure twice.
+ * Documentation were installed twice in different dirs.
+ * Added missing perl dependencies.
+
+ -- Andreas Putzo <andreas@putzo.net> Sun, 29 Jul 2007 12:27:49 +0000
+
+gpsdrive (2.10~pre2-1) unstable; urgency=low
+
+ * New upstream release. Closes: #321429.
+ - Proxy support works again
+ Closes: #300443.
+ Closes: #400745.
+ - Package can be build twice in a row (FTBFS). Closes: #424369.
+ * Acknowledge NMU. Closes: 343815.
+ * Set Debian GIS Project as new Maintainer and myself as Uploader.
+ Closes: #406522.
+ * Added missing #includes (FTBFS gcc-4.3). Closes: #417498.
+ * Fixed typos.
+ Closes: #363622.
+ Closes: #428263.
+ * Suggesting libmysqlclient15off now.
+ Closes: #357397.
+ * Switched to dpatch, rewrite of debian/rules.
+ * Build-depend on autotools-dev to symlink to config.guess/config.sub.
+ * Updated debian/copyright, debin/control
+ * Fixed misspelled email address in debian/changelog.
+ * Created manpages for gpsfetchmap and friendsd2
+ * Changed gpsdrive.c to use the correct command line switches for gpsd
+ Closes: #317809
+
+ -- Andreas Putzo <andreas@putzo.net> Tue, 17 Jul 2007 16:29:39 +0200
+
+gpsdrive (2.09-2.2) unstable; urgency=low
+
+ * Porter NMU.
+ * Update config.guess/config.sub. Closes: #317323.
+ * Update po/de.po. Closes: #314065.
+
+ -- Aurelien Jarno <aurel32@debian.org> Sun, 10 Dec 2006 23:24:43 +0100
+
+gpsdrive (2.09-2.1) unstable; urgency=low
+
+ * Non-maintainer upload.
+ * Build-depend on libmysqlclient15-dev instead of the obsolete
+ libmysqlclient10-dev which should be removed for etch; requires minor
+ source changes due to changed library name and a small ABI change.
+ Closes: #343815.
+
+ -- Steve Langasek <vorlon@debian.org> Mon, 20 Feb 2006 01:00:45 -0800
+
+gpsdrive (2.09-2sarge1) stable-security; urgency=high
+
+ * Non-maintainer upload by the Security Team
+ * Corrected format string to fix arbitrary code execution
+ [src/friendsd.c, CVE-2005-3523]
+
+ -- Martin Schulze <joey@infodrom.org> Mon, 7 Nov 2005 07:32:56 +0100
+
+gpsdrive (2.09-2) unstable; urgency=low
+
+ * closes: #286902 (does not compile with gcc-4.x (FTBFS (amd64/gcc-4.0)))
+ * closes: #224905 (gpsdrive: Please give gpsd it's own package)
+ * closes: #238050 (new upstream version)
+ * closes: #282886 (gpsdrive: missing dependency to libgdk-pixbuf2)
+ (was never needed, since libgdk-pixbuf2 is part
+ of libgtk2.0)
+
+ -- Frank Kirschner <kirfrank@debian.org> Mon, 10 Jan 2005 12:05:36 +0100
+
+gpsdrive (2.09-1) unstable; urgency=low
+
+ * new upstream release
+ * closes: #248609 (mapblast/expedia map-servers do work again)
+
+ -- Frank Kirschner <kirfrank@debian.org> Tue, 25 May 2004 11:44:03 +0200
+
+gpsdrive (2.07-1) unstable; urgency=low
+
+ * new upstream release
+ * replaced non-free script 'gpsfetchmap' with a wrapper to 'gpsfetchmap.pl'
+ closes: #224913
+
+ -- Frank Kirschner <kirfrank@debian.org> Tue, 27 Jan 2004 13:25:20 +0100
+
+gpsdrive (2.04-2) unstable; urgency=low
+
+ * closes: #200247 (bug in loadmapconfig() on map_koord.txt files < 512 bytes
+ long) (This was not a real bug)
+ * Suggests libmysql for MySQL support.
+ * fixed several lintian warnings
+
+ -- Frank Kirschner <kirfrank@debian.org> Thu, 9 Oct 2003 14:20:05 +0200
+
+gpsdrive (2.04-1) unstable; urgency=low
+
+ * new upstream release.
+ * closes: #186437 (MySQL Support needed)
+ * closes: #194403 (mapblast doesn't send images)
+ * closes: #197789 (FTBFS with g++-3.3: Missing <cassert> include)
+ * closes: #197832 (gpsfetchmap script gives syntax error)
+ * closes: #199364 (Expedia map service changed, no longer directly
+ compatible with gpsdrive)
+ * closes: #210807 (Gpsdrive requires xfonts-75dpi to run)
+ * closes: #210977 (much newer version available)
+
+ -- Frank Kirschner <kirfrank@debian.org> Thu, 9 Oct 2003 09:33:26 +0200
+
+gpsdrive (2.0-0pre9-1) unstable; urgency=low
+
+ * new upstream release.
+
+ -- Frank Kirschner <kirfrank@debian.org> Tue, 1 Jul 2003 20:00:06 +0200
+
+gpsdrive (1.32-1) unstable; urgency=low
+
+ * new upstram release. (closes: #183066)
+
+ -- Frank Kirschner <kirfrank@debian.org> Wed, 12 Mar 2003 17:14:37 +0100
+
+gpsdrive (1.30-1) unstable; urgency=low
+
+ * new upstream release. (closes: #170823)
+
+ -- Frank Kirschner <kirfrank@debian.org> Sat, 30 Nov 2002 12:18:33 +0100
+
+gpsdrive (1.18-1) unstable; urgency=low
+
+ * new upstream release.
+ * added xutils to build-dependencies. (closes: #144287)
+
+ -- Frank Kirschner <kirfrank@debian.org> Wed, 24 Apr 2002 23:40:31 +0200
+
+gpsdrive (1.17-1) unstable; urgency=low
+
+ * new package-maintainer. (closes: #143320)
+ * new upstream release.
+
+ -- Frank Kirschner <kirfrank@debian.org> Wed, 17 Apr 2002 18:44:47 +0200
+
+gpsdrive (1.6-1) unstable; urgency=low
+
+ * Initial Release.
+
+ -- Cosimo Alfarano <kalfa@debian.org> Fri, 7 Dec 2001 19:14:57 +0100
+
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..7f8f011
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+7
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..cc5b8a7
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,49 @@
+Source: gpsdrive
+Section: utils
+Priority: optional
+Maintainer: Debian GIS Project <pkg-grass-devel@lists.alioth.debian.org>
+Uploaders: Andreas Putzo <andreas@putzo.net>, Francesco Paolo Lovergine <frankie@debian.org>
+DM-Upload-Allowed: yes
+Build-Depends: debhelper (>= 7), automake1.9, libtool, pkg-config, libpcre3-dev, libgtk2.0-dev,libart-2.0-dev, libxml2-dev, libmysqlclient-dev,
+ autotools-dev, dpatch, libboost-dev, libboost-filesystem-dev, libboost-serialization-dev, libdbus-glib-1-dev, libltdl-dev (>= 2.4)
+Standards-Version: 3.8.4
+Homepage: http://gpsdrive.de
+Vcs-Svn: svn://svn.debian.org/svn/pkg-grass/packages/gpsdrive/trunk
+Vcs-Browser: http://svn.debian.org/viewsvn/pkg-grass/packages/gpsdrive/trunk
+
+Package: gpsdrive
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, gpsdrive-data, openstreetmap-map-icons-square, openstreetmap-map-icons-classic
+Recommends: gpsd, gpsdrive-scripts
+Suggests: flite | festival, osm2pgsql, mysql-server, postgresql-8.4-postgis
+Description: Car navigation system
+ Map-based navigation system that displays the current
+ position provided by a GPS receiver on a zoomable map.
+ Maps can be downloaded from different map providers or
+ rendered on-the-fly using the OpenStreetMap dataset.
+ .
+ Route planning, optionally with spoken directions,
+ is supported through waypoints.
+
+Package: gpsdrive-data
+Architecture: all
+Recommends: gpsdrive
+Replaces: gpsdrive (<= 2.10~pre4-4)
+Description: Car navigation system
+ Map-based navigation system that displays the current
+ position provided by a GPS receiver on a zoomable map.
+ Maps can be downloaded from different map providers or
+ rendered on-the-fly using the OpenStreetMap dataset.
+ .
+ This package contains the data files.
+
+Package: gpsdrive-scripts
+Architecture: all
+Depends: gpsdrive, ${perl:Depends}, python, python-imaging, libdbi-perl, libdbd-mysql-perl, libdate-manip-perl, libfile-slurp-perl,
+ libmime-base64-perl, libtime-local-perl, libwww-curl-perl, libwww-mechanize-perl, libxml-parser-perl, libxml-simple-perl, libxml-twig-perl,
+ libxml-writer-perl, perlmagick, perl-tk
+Description: Various scripts for gpsdrive
+ Gpsdrive is a car (bike, ship, plane) navigation system.
+ .
+ This package contains various scripts to download maps
+ from different sources and to manage point-of-interests.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..850ed70
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,129 @@
+This package was debianized by Frank Kirschner <kirfrank@debian.org> on
+Wed Apr 17 18:35:19 CEST 2002.
+
+The current Debian Maintainer is the Debian GIS Team
+<pkg-grass-devel@lists.alioth.debian.org>.
+
+It was downloaded from http://gpsdrive.de/packages/gpsdrive-2.10pre4.tar.gz The
+debian/ dir has been removed from the tarball. The file scripts/gpsfetchmap.pl
+has been removed from the tarball because of a non-free license. The license has
+been changed upstream to GPL. This version will be installed instead. The
+directories data/map-icons/{japan,nickw} have been removed due to unclear
+license issues. They are not used by gpsdrive anyway.
+
+Upstream Authors:
+
+ GpsDrive Development Team
+ Fritz Ganter <ganter@ganter.at>
+ Joerg Ostertag <joerg@ostertag.name>
+ Guenter Meyer <d.s.e@sordidmusic.com>
+ Christoph Metz <loom@mopper.de>
+ and Contributors.
+
+Copyright:
+
+ Copyright (C) 2001-2006 Fritz Ganter
+ 2006-2007 The GpsDrive Development Team
+
+License:
+
+This package is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+ This package is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this package; if not, write to the Free Software Foundation, Inc., 51
+ Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+On Debian systems, the complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL'
+
+
+The files
+ src/lib_map/map_load.c
+ src/lib_map/map_render.c
+ src/lib_map/map_transform.c
+ src/lib_map/map_port_cpp.cpp
+ src/lib_map/map_render_cpp.cpp
+ src/util/gmapview.c
+ src/util/gps.c
+ src/util/mmapview.c
+ src/util/wmapview.c
+ src/util/worldgen.c
+ src/util/qmapview.cpp
+are Copyright (C) 2005 Daniel Wallner and are licensed under the GNU General
+Public License version 2 or later (see above).
+
+
+The files
+ scripts/gpssql_backup.sh
+ scripts/gpssql_restore.sh
+are Copyleft 2002 Sven Fichtner <sven.fichtner@flugfunk.de>.
+
+
+The files
+ scripts/osm/perl_lib/Geo/OSM/OsmChangeReaderV5.pm
+ scripts/osm/perl_lib/OsmReader*.pm
+ scripts/osm/perl_lib/OsmChangeReader*.pm
+are Copyright (C) 2006 Oliver Whilte
+ 2007 Martijn van Oosterhout <kleptog@svana.org>
+and are licensed under the GNU General Public License version 2 or later
+(see above).
+
+
+The file
+ scripts/geo-code
+is Copyright (C) Rick Richardson <rickr@mn.rr.com>
+and has been donated to the public domain.
+
+
+The file
+ scripts/gpsreplay
+is Copyright (C) 2002,2003 Tim Witham <twitham@surewest.net>
+and is licensed under the GNU General Public License version 2 or later
+(see above).
+
+
+The file
+ scripts/gpspoint2gpsdrive.pl
+is Copyright (C) 2002 Stephen Merrony <steve@cygnet.co.uk>
+and is licensed under the GNU General Public License version 2 or later
+(see above).
+
+
+The file
+ scripts/wpcvt
+is Copyright (C) 2002 Ned Konz <ned@bike-nomad.com>
+and is licensed under the GNU General Public License version 2 or later
+(see above).
+
+
+The file
+ scripts/osm/perl_lib/Geo/OSM/OsmXML.pm
+is Copyright (C) 2006 Oliver White <oliver.white@blibbleblobble.co.uk>
+and is licensed under the GNU General Public License version 2 or later
+(see above).
+
+
+The files
+ scripts/osm/perl_lib/Geo/OSM/APIClientV4.pm
+ scripts/osm/perl_lib/Geo/OSM/EntitiesV3.pm
+ scripts/osm/perl_lib/Geo/OSM/APIClientV5.pm
+are Copyright (C) 2007 Martijn van Oosterhout <kleptog@svana.org>
+and are licensed under the GNU Lesser General Public License.
+
+On Debian systems, the complete text of the GNU Lesser General
+Public License can be found in `/usr/share/common-licenses/LGPL'
+
+
+The files
+ data/map-icons/*
+are Copyright (C) 2007 Joerg Ostertag
+ 2007 Guenther Meyer
+and have been donated to the public domain.
diff --git a/debian/docs b/debian/docs
new file mode 100644
index 0000000..f26f0c5
--- /dev/null
+++ b/debian/docs
@@ -0,0 +1,18 @@
+README
+NEWS
+Documentation/CREDITS
+Documentation/FAQ.gpsdrive
+Documentation/FAQ.gpsdrive.fr
+Documentation/GPS-receivers
+Documentation/LISEZMOI
+Documentation/LISEZMOI.SQL
+Documentation/LISEZMOI.kismet
+Documentation/NMEA.txt
+Documentation/README.Bluetooth
+Documentation/README.OpenStreetMap-Vektordata
+Documentation/README.SQL
+Documentation/README.kismet
+Documentation/README.lib_map
+Documentation/README.mysql
+Documentation/README.nasamaps
+Documentation/TODO
diff --git a/debian/examples b/debian/examples
new file mode 100644
index 0000000..ffa4298
--- /dev/null
+++ b/debian/examples
@@ -0,0 +1,6 @@
+scripts/gpssql_backup.sh
+scripts/gpssql_restore.sh
+scripts/nasaconv.sh
+scripts/wp2sql
+scripts/wpcvt
+scripts/wpget
diff --git a/debian/gpsdrive-data.install b/debian/gpsdrive-data.install
new file mode 100644
index 0000000..63440f1
--- /dev/null
+++ b/debian/gpsdrive-data.install
@@ -0,0 +1,3 @@
+usr/share/gpsdrive/maps
+usr/share/gpsdrive/pixmaps
+usr/share/gpsdrive/poi
diff --git a/debian/gpsdrive-scripts.install b/debian/gpsdrive-scripts.install
new file mode 100644
index 0000000..9985fdf
--- /dev/null
+++ b/debian/gpsdrive-scripts.install
@@ -0,0 +1,14 @@
+usr/bin/convert-waypoints.pl
+usr/bin/geo-code
+usr/bin/geocache2way
+usr/bin/geoinfo.pl
+usr/bin/gpspoint2gpsdrive.pl
+usr/bin/gpsreplay
+usr/bin/poi-manager.pl
+#usr/bin/gpsdrive_mapnik_gentiles.py
+usr/share/perl5/Geo/Filter/* usr/share/perl5/Geo/Gpsdrive/Filter
+usr/share/perl5/Geo/GPX/* usr/share/perl5/Geo/Gpsdrive/GPX
+usr/share/perl5/Geo/Geometry.pm usr/share/perl5/Geo/Gpsdrive
+usr/share/perl5/Geo/Gpsdrive/*
+usr/share/perl5/Geo/OSM/Planet.pm usr/share/perl5/Geo/Gpsdrive/OSM
+usr/share/perl5/Utils/* usr/share/perl5/Geo/Gpsdrive/Utils
diff --git a/debian/gpsdrive-scripts.manpages b/debian/gpsdrive-scripts.manpages
new file mode 100644
index 0000000..baf15a6
--- /dev/null
+++ b/debian/gpsdrive-scripts.manpages
@@ -0,0 +1,6 @@
+man/convert-waypoints.pl.1
+man/geo-code.1
+man/geoinfo.pl.1
+debian/man/gpsfetchmap.1
+man/gpspoint2gpsdrive.pl.1
+man/poi-manager.pl.1
diff --git a/debian/gpsdrive.install b/debian/gpsdrive.install
new file mode 100644
index 0000000..f9b69ca
--- /dev/null
+++ b/debian/gpsdrive.install
@@ -0,0 +1,6 @@
+usr/bin/gpsdrive
+usr/bin/friendsd2
+usr/share/applications/gpsdrive.desktop
+usr/share/gpsdrive/map_koord.txt
+#usr/share/gpsdrive/mapnik/osm.xml
+usr/share/map-icons/icons.xml usr/share/gpsdrive/map-icons/
diff --git a/debian/gpsdrive.manpages b/debian/gpsdrive.manpages
new file mode 100644
index 0000000..daa0697
--- /dev/null
+++ b/debian/gpsdrive.manpages
@@ -0,0 +1,2 @@
+man/friendsd2.1
+man/gpsdrive.1
diff --git a/debian/man/gpsfetchmap.1 b/debian/man/gpsfetchmap.1
new file mode 100644
index 0000000..1a98997
--- /dev/null
+++ b/debian/man/gpsfetchmap.1
@@ -0,0 +1,327 @@
+.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sh \" Subsection heading
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.if \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.\"
+.\" For nroff, turn off justification. Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.hy 0
+.if n .na
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "GPSFETCHMAP 1"
+.TH GPSFETCHMAP 1 "2007-10-04" "perl v5.8.8" "User Contributed Perl Documentation"
+.SH "NAME"
+\&\fBgpsfetchmap\fR \- Download maps from a mapserver.
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+\&\fBgpsfetchmap\fR is a program to download maps from a mapserver for use with gpsdrive.
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+\&\fBCommon usages:\fR
+.PP
+gpsfetchmap \-w <\s-1WAYPOINT\s0 \s-1NAME\s0> \-sc <\s-1SCALE\s0> \-a <#> \-p
+.PP
+gpsfetchmap \-la <latitude \s-1MM\s0.DDDD> \-lo <latitude \s-1MM\s0.DDDD> \-sc <\s-1SCALE\s0> \-a <#> \-p
+.PP
+gpsfetchmap \-sla <start latitude \s-1MM\s0.DDDD> \-endla <end latitude \s-1MM\s0.DDDD> \-slo <start longitude \s-1MM\s0.DDDD> \-endlo <end longitude \s-1MM\s0.DDDD> \-sc <\s-1SCALE\s0> \-a <#> \-p
+.PP
+gpsfetchmap \-sc <\s-1SCALE\s0> \-a <#> \-r <\s-1WAYPOINT\s0 1> <\s-1WAYPOINT\s0 2> ... <\s-1WAYPOINT\s0 n> \-p
+.PP
+\&\fBAll options:\fR
+.PP
+gpsfetchmap [\-w <\s-1WAYPOINT\s0 \s-1NAME\s0>]
+ [\-la <latitude \s-1DD\s0.MMMM>] [\-lo <longitude \s-1DD\s0.MMMM>]
+ [\-sla <start latitude \s-1DD\s0.MMMM>] [\-endla <end latitude \s-1DD\s0.MMMM>]
+ [\-slo <start longitude \s-1DD\s0.MMMM>] [\-endlo <end longitude \s-1DD\s0.MMMM>]
+ [\-sc <\s-1SCALE\s0>] [\-a <#>] [\-p] [\-m <\s-1MAPSERVER\s0>]
+ [\-u <\s-1UNIT\s0>] [\-md <\s-1DIR\s0>] [\-W <\s-1FILE\s0>] [\-t <\s-1FILE\s0>] [\-r]
+ [\-C <\s-1FILE\s0>] [\-P <\s-1PREFIX\s0>] [\-F] [\-d] [\-v] [\-h] [\-M] [\-n] [\-U] [\-c]
+.SH "OPTIONS"
+.IX Header "OPTIONS"
+.IP "\fB\-w, \-\-waypoint <\s-1WAYPOINT\s0 \s-1NAME\s0\fR>" 8
+.IX Item "-w, --waypoint <WAYPOINT NAME>"
+Takes a waypoint name and uses the latitude and longitude for that waypoint as
+the centerpoint of the area to be covered. Waypoints are read from 'way.txt',
+or file defined by '\-W'.
+the special name gpsd asks your local gpsd where your gps thinks you are and uses
+this point as center.
+This, '\-la' and '\-lo', '\-sla', '\-ela', '\-slo' and '\-elo' or '\-a' is required.
+A special name is gpsd this waypoint asks your gps where you currently are.
+.IP "\fB\-la, \-\-lat <latitude \s-1DD\s0.MMMM\fR>" 8
+.IX Item "-la, --lat <latitude DD.MMMM>"
+Takes a latitude in format \s-1DD\s0.MMMM and uses that as the latitude for the centerpoint of the area
+to be covered. Will be overriden by the latitude of waypoint if '\-w' is used. This and '\-lo', '\-w' or '\-sla', '\-ela', '\-slo', '\-elo' is required.
+.IP "\fB\-lo, \-\-lon <longitude \s-1DD\s0.MMMM\fR>" 8
+.IX Item "-lo, --lon <longitude DD.MMMM>"
+Takes a longitude in format \s-1DD\s0.MMMM and uses that as the longitude for the centerpoint of the area
+to be covered. Will be overriden by the longitude of waypoint if '\-w' is used. This and '\-la', '\-w' or '\-sla', '\-ela', '\-slo', '\-elo' is required.
+.IP "\fB\-sla \-\-start\-lat <start latitude \s-1DD\s0.MMMM\fR>" 8
+.IX Item "-sla --start-lat <start latitude DD.MMMM>"
+Takes a latitude in format \s-1DD\s0.MMMM and uses that as the start latitude for the area to be covered. Will override '\-la' and '\-lo' but will be overriden by '\-w'. This, '\-ela', '\-slo' and '\-elo' or '\-w' or '\-la' and '\-lo' is required.
+.IP "\fB\-ela \-\-end\-lat <end latitude \s-1DD\s0.MMMM\fR>" 8
+.IX Item "-ela --end-lat <end latitude DD.MMMM>"
+Takes a latitude in format \s-1DD\s0.MMMM and uses that as the end latitude for the area to be covered. Will override '\-la' and '\-lo' but will be overriden by '\-w'.
+This, '\-sla', '\-slo' and '\-elo' or '\-w' or '\-la' and '\-lo' is required.
+.IP "\fB\-slo \-\-start\-lon <start longitude \s-1DD\s0.MMMM\fR>" 8
+.IX Item "-slo --start-lon <start longitude DD.MMMM>"
+Takes a longitude in format \s-1DD\s0.MMMM and uses that as the start longitude for the area to be covered. Will override '\-la' and '\-lo' but will be overriden by '\-w'. This, '\-sla', '\-ela' and '\-elo' or '\-w' or '\-la' and '\-lo' is required.
+.IP "\fB\-elo \-\-end\-lon <end longitude \s-1DD\s0.MMMM\fR>" 8
+.IX Item "-elo --end-lon <end longitude DD.MMMM>"
+Takes a longitude in format \s-1DD\s0.MMMM and uses that as the end longitude for the area to be covered. Will override '\-la' and '\-lo' but will be overriden by '\-w'. This, '\-sla', '\-ela' and '\-slo' or '\-w' or '\-la' and '\-lo' is required.
+.IP "\fB\-sc, \-\-scale <\s-1SCALE\s0\fR>" 8
+.IX Item "-sc, --scale <SCALE>"
+Scales of map(s) to download. Default: 50000.
+.Sp
+Formats:
+.Sp
+.Vb 2
+\& \(aq####\(aq
+\& \- Just this scale.
+.Ve
+.Sp
+.Vb 2
+\& \(aq####,####,####\(aq
+\& \- All scales in the list. May be combined with other formats.
+.Ve
+.Sp
+.Vb 2
+\& \(aq>####\(aq
+\& \- All scales above and including the number given.
+.Ve
+.Sp
+.Vb 2
+\& \(aq<####\(aq
+\& \- All scales below and including the number given.
+.Ve
+.Sp
+.Vb 2
+\& \(aq####\-####\(aq
+\& \- All scales from first to last number given.
+.Ve
+.IP "\fB\-a, \-\-area <#\fR>" 8
+.IX Item "-a, --area <#>"
+Area to cover. # of 'units' size square around the centerpoint. You can use a single number
+for square area. Or you can use '#x#' to do a rectangle, where the first number is distance
+latitude and the second number is distance of longitude. 'units' is read from the configuration
+file (\-C) or as defined by (\-u).
+.IP "\fB\-p, \-\-polite\fR" 8
+.IX Item "-p, --polite"
+This causes the program to sleep one second between downloads to be polite to the mapserver.
+Takes an optional value of number of seconds to sleep.
+.IP "\fB\-\-mapserver <\s-1MAPSERVER\s0\fR>" 8
+.IX Item "--mapserver <MAPSERVER>"
+Mapserver to download from. Default: 'landsat'.
+Currently can use: landsat
+.Sp
+geoscience, gov_au, incrementp and eniro have download stubs,
+but they are !!!NOT!!!! in the right scale.
+.Sp
+geoscience
+.Sp
+landsat covers the whole world with satelite Photos
+.Sp
+gov_au is for Australia
+.Sp
+incrementp for japanese Maps
+.Sp
+eniro covers:
+ eniro_se Sweden
+ eniro_dk Denmark
+ eniro_no Norway
+ eniro_fi Finnland
+.Sp
+Overview of Area covered by eniro_fi:
+ http://maps.eniro.com/servlets/fi_MapImageLocator?profile=Main&center=26.;62.&zoomlevel=1&size=800x600
+.IP "\fB\-u, \-\-unit <\s-1UNIT\s0\fR>" 8
+.IX Item "-u, --unit <UNIT>"
+The measurement system to use. Default is read from configuration file <\-C>. Possibles are:
+miles, nautical, kilometers.
+.IP "\fB\-\-mapdir <\s-1DIR\s0\fR>" 8
+.IX Item "--mapdir <DIR>"
+Override the configfiles mapdir with this value.
+.IP "\fB\-W, \-\-WAYPOINT <\s-1FILE\s0\fR>" 8
+.IX Item "-W, --WAYPOINT <FILE>"
+File to read waypoints from. Default: '~/.gpsdrive/way.txt'.
+.IP "\fB\-t, \-\-track <\s-1FILE\s0\fR>" 8
+.IX Item "-t, --track <FILE>"
+Download maps that are along a saved track. File is a standard track filed saved from GpsDrive.
+.IP "\fB\-r, \-\-route\fR" 8
+.IX Item "-r, --route"
+Download maps that are along a route defined by waypoints. You must give a list of waypoints as parameters separated with space.
+.IP "\fB\-C, \-\-CONFIG\fR" 8
+.IX Item "-C, --CONFIG"
+File to read for GPSDrive configuration information. Default: '~/.gpsdrive/gpsdriverc'.
+.IP "\fB\-P, \-\-PREFIX <\s-1PREFIX\s0\fR>" 8
+.IX Item "-P, --PREFIX <PREFIX>"
+Takes a prefix string to be used as the start of all saved map files. Default: \*(L"map_\*(R".
+.IP "\fB\-F, \-\-FORCE\fR" 8
+.IX Item "-F, --FORCE"
+Force program to download maps without asking you to confirm the download.
+.IP "\fB\-n\fR" 8
+.IX Item "-n"
+Dont download anything only tell which maps are missing
+.IP "\fB\-U\fR" 8
+.IX Item "-U"
+read map_koord.txt file at Start. Then also check for not downloaded map_*.gif Files
+if they need to be appended to map_koords.txt.
+.IP "\fB\-\-check\-koordfile\fR" 8
+.IX Item "--check-koordfile"
+Update map_koord.txt: search map Tree if map_*.gif file exist, but cannot
+be found in map_koords.txt file. This option first reads the
+map_koord.txt file and checks every Map in the filesystem if it also is
+found in the map_koord.txt file.
+If not found it is appended into the map_koord.txt file.
+.Sp
+Check map_koord.txt File. This option checks, if every Map also exist
+If any Map-File is missing, a file map_koord.txt.new will be created.
+This file can be copied to the original file if checked.
+.IP "\fB\-\-check\-coverage\fR" 8
+.IX Item "--check-coverage"
+See which areas the maps cover.
+Output is simple \s-1ASCII\s0 Art
+.IP "\fB\-\-PROXY\fR" 8
+.IX Item "--PROXY"
+Set proxy for mirroring image Files
+.IP "\fB\-d, \-\-debug\fR" 8
+.IX Item "-d, --debug"
+Prints debugging information.
+.IP "\fB\-v, \-\-version\fR" 8
+.IX Item "-v, --version"
+Prints version information and exits.
+.IP "\fB\-\-help \-h \-x\fR" 8
+.IX Item "--help -h -x"
+Prints the usage page and exits.
+.IP "\fB\-\-MAN \-M\fR" 8
+.IX Item "--MAN -M"
+Prints the manual page and exits.
+.IP "\fBDownload\fR" 8
+.IX Item "Download"
+When downloading Maps the output reads as folows:
+.Sp
+.Vb 5
+\& _ Map already exists in Filesystem
+\& E Error while downloading Map
+\& + Map got downloaded
+\& u updated map_koords.txt File
+\& S Simulate only
+.Ve
diff --git a/debian/patches/00list b/debian/patches/00list
new file mode 100644
index 0000000..509e3d4
--- /dev/null
+++ b/debian/patches/00list
@@ -0,0 +1,24 @@
+01-make
+03-manpage
+10-mapnikdir
+20-homedir
+30-icons
+40-backported
+50-scripts
+60-sql
+70-perl
+80-dbus
+85-settings
+90-usage
+95-newapi
+96-mapnik-plugins-dir
+97-osmxml
+98-mapnik-exception
+99-autobestmap
+100-fix-insecure-tempfiles
+101-signalposreq
+102-unittest
+103-no-textquery
+104-fix-xcursor-check
+105-add-boost-links
+107-fix-disable-mapnik.dpatch
diff --git a/debian/patches/01-make.dpatch b/debian/patches/01-make.dpatch
new file mode 100644
index 0000000..a0bed42
--- /dev/null
+++ b/debian/patches/01-make.dpatch
@@ -0,0 +1,266 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 01-make.dpatch by Andreas Putzo <andreas@putzo.net>
+##
+## DP: Remove some SUBDIRS from Makefile.am
+## DP: Remove perl checks from configure.ac
+## DP: Remove map-icons from Makefile.am
+## DP: call pod2man on debian/scripts/gpsfetchmap.pl
+
+@DPATCH@
+diff -urNad gpsdrive-2.10~pre4~/Makefile.am gpsdrive-2.10~pre4/Makefile.am
+--- gpsdrive-2.10~pre4~/Makefile.am 2007-09-15 15:12:07.000000000 +0000
++++ gpsdrive-2.10~pre4/Makefile.am 2008-07-19 15:23:42.000000000 +0000
+@@ -1,7 +1,7 @@
+ # Makefile.am in main dir
+ #AUTOMAKE_OPTIONS=dist-bzip2
+
+-SUBDIRS = src man scripts data Documentation debian DSL gentoo po tests
++SUBDIRS = src man scripts data Documentation po
+ DIST_SUBDIRS = $(SUBDIRS)
+
+
+diff -urNad gpsdrive-2.10~pre4~/configure.ac gpsdrive-2.10~pre4/configure.ac
+--- gpsdrive-2.10~pre4~/configure.ac 2007-09-15 17:05:51.000000000 +0000
++++ gpsdrive-2.10~pre4/configure.ac 2008-07-19 15:23:42.000000000 +0000
+@@ -36,13 +36,13 @@
+
+ wLL_LINGUAS="da de de_AT es fr hu it ja nl ru sk sv tr"
+
+-AC_CONFIG_FILES([DSL/Makefile])
++dnl AC_CONFIG_FILES([DSL/Makefile])
+ AC_CONFIG_FILES([Documentation/Makefile])
+ AC_CONFIG_FILES([Makefile])
+ AC_CONFIG_FILES([data/Makefile])
+ AC_CONFIG_FILES([data/map-icons/Makefile])
+-AC_CONFIG_FILES([debian/Makefile])
+-AC_CONFIG_FILES([gentoo/Makefile])
++dnl AC_CONFIG_FILES([debian/Makefile])
++dnl AC_CONFIG_FILES([gentoo/Makefile])
+ AC_CONFIG_FILES([man/Makefile])
+ AC_CONFIG_FILES([man/de/Makefile])
+ AC_CONFIG_FILES([man/es/Makefile])
+@@ -54,7 +54,7 @@
+ AC_CONFIG_FILES([src/Makefile])
+ AC_CONFIG_FILES([src/lib_map/Makefile])
+ AC_CONFIG_FILES([src/util/Makefile])
+-AC_CONFIG_FILES([tests/Makefile])
++dnl AC_CONFIG_FILES([tests/Makefile])
+
+ AC_CHECK_FUNCS([bzero])
+ AC_CHECK_FUNCS([floor])
+@@ -667,17 +667,17 @@
+ PERL_PACKAGE_DIR=`echo ${PERL_VENDORLIB} | sed "s,/usr/share,${datadir},"`
+ AC_SUBST(PERL_PACKAGE_DIR)
+
+-AC_PROG_PERL_MODULES(File::Basename , , AC_MSG_ERROR(Need Perl module File::Basename))
+-AC_PROG_PERL_MODULES(File::Copy , , AC_MSG_ERROR(Need Perl module File::Copy))
+-AC_PROG_PERL_MODULES(File::Path , , AC_MSG_ERROR(Need Perl module File::Path))
+-AC_PROG_PERL_MODULES(File::Temp , , AC_MSG_ERROR(Need Perl module File::Temp))
+-AC_PROG_PERL_MODULES(Getopt::Long , , AC_MSG_ERROR(Need Perl module Getopt::Long))
+-AC_PROG_PERL_MODULES(HTTP::Request , , AC_MSG_ERROR(Need Perl module HTTP::Request))
+-AC_PROG_PERL_MODULES(HTTP::Request::Common , , AC_MSG_ERROR(Need Perl module HTTP::Request::Common))
+-AC_PROG_PERL_MODULES(IO::File , , AC_MSG_ERROR(Need Perl module IO::File))
+-AC_PROG_PERL_MODULES(LWP::Simple , , AC_MSG_ERROR(Need Perl module LWP::Simple))
+-AC_PROG_PERL_MODULES(LWP::UserAgent , , AC_MSG_ERROR(Need Perl module LWP::UserAgent))
+-AC_PROG_PERL_MODULES(Math::Trig , , AC_MSG_ERROR(Need Perl module Math::Trig))
++#AC_PROG_PERL_MODULES(File::Basename , , AC_MSG_ERROR(Need Perl module File::Basename))
++#AC_PROG_PERL_MODULES(File::Copy , , AC_MSG_ERROR(Need Perl module File::Copy))
++#AC_PROG_PERL_MODULES(File::Path , , AC_MSG_ERROR(Need Perl module File::Path))
++#AC_PROG_PERL_MODULES(File::Temp , , AC_MSG_ERROR(Need Perl module File::Temp))
++#AC_PROG_PERL_MODULES(Getopt::Long , , AC_MSG_ERROR(Need Perl module Getopt::Long))
++#AC_PROG_PERL_MODULES(HTTP::Request , , AC_MSG_ERROR(Need Perl module HTTP::Request))
++#AC_PROG_PERL_MODULES(HTTP::Request::Common , , AC_MSG_ERROR(Need Perl module HTTP::Request::Common))
++#AC_PROG_PERL_MODULES(IO::File , , AC_MSG_ERROR(Need Perl module IO::File))
++#AC_PROG_PERL_MODULES(LWP::Simple , , AC_MSG_ERROR(Need Perl module LWP::Simple))
++#AC_PROG_PERL_MODULES(LWP::UserAgent , , AC_MSG_ERROR(Need Perl module LWP::UserAgent))
++#AC_PROG_PERL_MODULES(Math::Trig , , AC_MSG_ERROR(Need Perl module Math::Trig))
+
+ # These will only be needed for Building GpsDrive Packages
+ #AC_PROG_PERL_MODULES(File::Slurp , , AC_MSG_ERROR(Need Perl module File::Slurp))
+diff -urNad gpsdrive-2.10~pre4~/data/map-icons/Makefile.am gpsdrive-2.10~pre4/data/map-icons/Makefile.am
+--- gpsdrive-2.10~pre4~/data/map-icons/Makefile.am 2007-09-15 18:50:48.000000000 +0000
++++ gpsdrive-2.10~pre4/data/map-icons/Makefile.am 2008-07-19 15:23:42.000000000 +0000
+@@ -474,92 +474,6 @@
+ svg_wlan_DATA = svg/wlan/closed.svg svg/wlan/open.svg svg/wlan/pay.svg svg/wlan/wep.svg
+ svg_wlandir = $(datadir)/map-icons/svg/wlan
+
+-
+-japan_DATA = japan/health.svg japan/wlan.svg
+-japandir = $(datadir)/map-icons/japan
+-
+-japan_accommodation_DATA =
+-japan_accommodationdir = $(datadir)/map-icons/japan/accommodation
+-
+-japan_accomodation_DATA =
+-japan_accomodationdir = $(datadir)/map-icons/japan/accomodation
+-
+-japan_education_DATA = japan/education/university.svg
+-japan_educationdir = $(datadir)/map-icons/japan/education
+-
+-japan_education_school_DATA = japan/education/school/junior_high.svg
+-japan_education_schooldir = $(datadir)/map-icons/japan/education/school
+-
+-japan_food_DATA =
+-japan_fooddir = $(datadir)/map-icons/japan/food
+-
+-japan_geocache_DATA =
+-japan_geocachedir = $(datadir)/map-icons/japan/geocache
+-
+-japan_health_DATA = japan/health/hospital.svg
+-japan_healthdir = $(datadir)/map-icons/japan/health
+-
+-japan_incomming_DATA = japan/incomming/Bamboo_grove.svg japan/incomming/Barren_land.svg japan/incomming/Broadleaf_trees.svg japan/incomming/Coniferous_trees.svg japan/incomming/Crater_or_Fumarole.svg japan/incomming/District_Forest_Office.svg japan/incomming/Electronic_Datum_point.svg japan/incomming/Factory.svg japan/incomming/Field.svg japan/incomming/Fishing_port.svg japan/incomming/Government_or_Municipal_office.svg japan/incomming/High_school.svg japan/incomming/High_Tower.svg japan/incomming/Historical_site.svg japan/incomming/Home_for_the_aged.svg japan/incomming/Important_port.svg japan/incomming/Junior_college.svg japan/incomming/Koban.svg japan/incomming/Local_port.svg japan/incomming/Meteorological_observatory.svg japan/incomming/Mine.svg japan/incomming/Mulberry_field.svg japan/incomming/Oil_or_Gas_well.svg japan/incomming/Orchard.svg japan/incomming/Other_Ferry.svg japan/incomming/Other_Tree_plantation.svg japan/incomming/Palm_trees.svg japan/incomming/Pithead.svg japan/incomming/Police_station.svg japan/incomming/Power_plant.svg japan/incomming/Quarry.svg japan/incomming/Rice_field.svg japan/incomming/Shrine.svg japan/incomming/Siberian_Dwarf_Pines.svg japan/incomming/Spa.svg japan/incomming/Standard_point.svg japan/incomming/Tea_plantation.svg japan/incomming/Technical_college.svg japan/incomming/Temple.svg japan/incomming/the_Self-Defense_Forces.svg japan/incomming/Town_or_Village_Office.svg japan/incomming/Triangulation_point.svg
+-japan_incommingdir = $(datadir)/map-icons/japan/incomming
+-
+-japan_misc_DATA =
+-japan_miscdir = $(datadir)/map-icons/japan/misc
+-
+-japan_misc_landmark_DATA = japan/misc/landmark/chimney.svg japan/misc/landmark/lighthouse.svg japan/misc/landmark/tower.svg japan/misc/landmark/windmill.svg
+-japan_misc_landmarkdir = $(datadir)/map-icons/japan/misc/landmark
+-
+-japan_money_DATA =
+-japan_moneydir = $(datadir)/map-icons/japan/money
+-
+-japan_nautical_DATA =
+-japan_nauticaldir = $(datadir)/map-icons/japan/nautical
+-
+-japan_people_DATA =
+-japan_peopledir = $(datadir)/map-icons/japan/people
+-
+-japan_places_DATA =
+-japan_placesdir = $(datadir)/map-icons/japan/places
+-
+-japan_public_DATA = japan/public/firebrigade.svg japan/public/post_office.svg
+-japan_publicdir = $(datadir)/map-icons/japan/public
+-
+-japan_public_administration_DATA = japan/public/administration/court_of_law.svg japan/public/administration/townhall.svg
+-japan_public_administrationdir = $(datadir)/map-icons/japan/public/administration
+-
+-japan_recreation_DATA =
+-japan_recreationdir = $(datadir)/map-icons/japan/recreation
+-
+-japan_religion_DATA = japan/religion/cemetery.svg
+-japan_religiondir = $(datadir)/map-icons/japan/religion
+-
+-japan_shopping_DATA =
+-japan_shoppingdir = $(datadir)/map-icons/japan/shopping
+-
+-japan_shopping_rental_DATA = japan/shopping/rental/library.svg
+-japan_shopping_rentaldir = $(datadir)/map-icons/japan/shopping/rental
+-
+-japan_sightseeing_DATA = japan/sightseeing/castle.svg japan/sightseeing/monument.svg japan/sightseeing/museum.svg
+-japan_sightseeingdir = $(datadir)/map-icons/japan/sightseeing
+-
+-japan_sports_DATA =
+-japan_sportsdir = $(datadir)/map-icons/japan/sports
+-
+-japan_transport_DATA =
+-japan_transportdir = $(datadir)/map-icons/japan/transport
+-
+-japan_transport_ferry_DATA = japan/transport/ferry/ferry-car.svg
+-japan_transport_ferrydir = $(datadir)/map-icons/japan/transport/ferry
+-
+-japan_vehicle_DATA =
+-japan_vehicledir = $(datadir)/map-icons/japan/vehicle
+-
+-japan_waypoint_DATA =
+-japan_waypointdir = $(datadir)/map-icons/japan/waypoint
+-
+-japan_wlan_DATA =
+-japan_wlandir = $(datadir)/map-icons/japan/wlan
+-
+-
+ classic.small_DATA = classic.small/accommodation.png classic.small/education.png classic.small/empty.png classic.small/food.png classic.small/geocache.png classic.small/health.png classic.small/misc.png classic.small/money.png classic.small/nautical.png classic.small/people.png classic.small/places.png classic.small/public.png classic.small/recreation.png classic.small/religion.png classic.small/shopping.png classic.small/sightseeing.png classic.small/sports.png classic.small/transport.png classic.small/unknown.png classic.small/vehicle.png classic.small/waypoint.png classic.small/wlan.png
+ classic.smalldir = $(datadir)/map-icons/classic.small
+
+@@ -852,11 +766,6 @@
+ classic.big_wlan_pay_DATA = classic.big/wlan/pay/fon.png
+ classic.big_wlan_paydir = $(datadir)/map-icons/classic.big/wlan/pay
+
+-
+-nickw_DATA = nickw/amenity.png nickw/barn.png nickw/bridge.png nickw/campsite.png nickw/carpark.png nickw/caution.png nickw/church.png nickw/crossing.png nickw/farm.png nickw/industry.png nickw/interest.png nickw/mast.png nickw/node.png nickw/park.png nickw/pbridleway.png nickw/peak.png nickw/peak_small.png nickw/place.png nickw/pub.png nickw/railway.png nickw/restaurant.png nickw/road.png nickw/stationnew.png nickw/station.png nickw/teashop.png nickw/trackpoint.png nickw/tunnel.png nickw/viewpoint.png nickw/waypoint.png
+-nickwdir = $(datadir)/map-icons/nickw
+-
+-
+ icons.xml_DATA = icons.xml
+ icons.xmldir = $(datadir)/map-icons/
+
+@@ -1016,34 +925,6 @@
+ $(svg_waypoint_flag_DATA) \
+ $(svg_waypoint_pin_DATA) \
+ $(svg_wlan_DATA) \
+- $(japan_DATA) \
+- $(japan_accommodation_DATA) \
+- $(japan_accomodation_DATA) \
+- $(japan_education_DATA) \
+- $(japan_education_school_DATA) \
+- $(japan_food_DATA) \
+- $(japan_geocache_DATA) \
+- $(japan_health_DATA) \
+- $(japan_incomming_DATA) \
+- $(japan_misc_DATA) \
+- $(japan_misc_landmark_DATA) \
+- $(japan_money_DATA) \
+- $(japan_nautical_DATA) \
+- $(japan_people_DATA) \
+- $(japan_places_DATA) \
+- $(japan_public_DATA) \
+- $(japan_public_administration_DATA) \
+- $(japan_recreation_DATA) \
+- $(japan_religion_DATA) \
+- $(japan_shopping_DATA) \
+- $(japan_shopping_rental_DATA) \
+- $(japan_sightseeing_DATA) \
+- $(japan_sports_DATA) \
+- $(japan_transport_DATA) \
+- $(japan_transport_ferry_DATA) \
+- $(japan_vehicle_DATA) \
+- $(japan_waypoint_DATA) \
+- $(japan_wlan_DATA) \
+ $(classic.small_DATA) \
+ $(classic.small_accommodation_DATA) \
+ $(classic.small_accommodation_camping_DATA) \
+@@ -1141,7 +1022,6 @@
+ $(classic.big_waypoint_wpttemp_DATA) \
+ $(classic.big_wlan_DATA) \
+ $(classic.big_wlan_pay_DATA) \
+- $(nickw_DATA) \
+ $(icons.xml_DATA) \
+ CMakeLists.txt \
+ overview.de.html \
+diff -urNad gpsdrive-2.10~pre4~/man/Makefile.am gpsdrive-2.10~pre4/man/Makefile.am
+--- gpsdrive-2.10~pre4~/man/Makefile.am 2007-09-15 15:12:06.000000000 +0000
++++ gpsdrive-2.10~pre4/man/Makefile.am 2008-07-19 15:23:42.000000000 +0000
+@@ -17,19 +17,13 @@
+ EXTRA_DIST = CMakeLists.txt
+
+ convert-waypoints.pl.1: $(srcdir)/../scripts/convert-waypoints.pl
+- pod2man $? >$@
+
+ gpsdrive-init-db.pl.1: $(srcdir)/../scripts/gpsdrive-init-db.pl
+- pod2man $? >$@
+
+-gpsfetchmap.pl.1: $(srcdir)/../scripts/gpsfetchmap.pl
+- pod2man $? >$@
++gpsfetchmap.pl.1: $(srcdir)/../debian/scripts/gpsfetchmap.pl
+
+ gpspoint2gpsdrive.pl.1: $(srcdir)/../scripts/gpspoint2gpsdrive.pl
+- pod2man $? >$@
+
+ poi-manager.pl.1: $(srcdir)/../scripts/poi-manager.pl
+- pod2man $? >$@
+
+ geoinfo.pl.1: $(srcdir)/../scripts/geoinfo.pl
+- pod2man $? >$@
+diff -urNad gpsdrive-2.10~pre4~/scripts/Makefile.am gpsdrive-2.10~pre4/scripts/Makefile.am
+--- gpsdrive-2.10~pre4~/scripts/Makefile.am 2007-09-15 15:11:59.000000000 +0000
++++ gpsdrive-2.10~pre4/scripts/Makefile.am 2008-07-19 15:23:43.000000000 +0000
+@@ -5,7 +5,7 @@
+ dist_bin_SCRIPTS= \
+ wpcvt wpget gpspoint2gpsdrive.pl geo-nearest geocache2way \
+ geo-code gpssql_backup.sh gpssql_restore.sh gpsreplay\
+- gpssmswatch gpsfetchmap.pl convert-waypoints.pl \
++ gpssmswatch convert-waypoints.pl \
+ geoinfo.pl gpsdrive-init-db.pl wp2sql gpsd_nmea.sh \
+ nasaconv.sh \
+ start_mysql_as_user.sh poi-manager.pl \
diff --git a/debian/patches/03-manpage.dpatch b/debian/patches/03-manpage.dpatch
new file mode 100644
index 0000000..0d1c1ec
--- /dev/null
+++ b/debian/patches/03-manpage.dpatch
@@ -0,0 +1,446 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 03-manpage.dpatch by Andreas Putzo <andreas@putzo.net>
+##
+## DP: Fix typos in gpsdrive.1 (#414240).
+## DP: Fixed in upstream svn.
+
+@DPATCH@
+diff -urNad gpsdrive-2.10~pre4~/man/convert-waypoints.pl.1 gpsdrive-2.10~pre4/man/convert-waypoints.pl.1
+--- gpsdrive-2.10~pre4~/man/convert-waypoints.pl.1 2007-09-15 17:13:54.000000000 +0000
++++ gpsdrive-2.10~pre4/man/convert-waypoints.pl.1 2008-01-08 20:47:21.000000000 +0000
+@@ -131,7 +131,7 @@
+ .IX Title "CONVERT-WAYPOINTS 1"
+ .TH CONVERT-WAYPOINTS 1 "2007-09-14" "perl v5.8.8" "User Contributed Perl Documentation"
+ .SH "NAME"
+-\&\fBconvert\-waypoints\fR
++\&\fBconvert\-waypoints\fR \- Convert old gpsdrive waypoints
+ .SH "DESCRIPTION"
+ .IX Header "DESCRIPTION"
+ \&\fBconvert-waypoints\fR is converting old waypoint info from the database table 'waypoints'
+diff -urNad gpsdrive-2.10~pre4~/man/friendsd2.1 gpsdrive-2.10~pre4/man/friendsd2.1
+--- gpsdrive-2.10~pre4~/man/friendsd2.1 2007-09-15 15:12:05.000000000 +0000
++++ gpsdrive-2.10~pre4/man/friendsd2.1 2008-01-08 20:47:21.000000000 +0000
+@@ -1,6 +1,6 @@
+ .TH FRIENDSD2 1
+ .SH NAME
+-friendsd2 v2.x - displays GPS position on a map
++friendsd2 \- displays GPS position on a map
+ .SH SYNOPSIS
+ .B friendsd2 [options]
+
+diff -urNad gpsdrive-2.10~pre4~/man/geo-code.1 gpsdrive-2.10~pre4/man/geo-code.1
+--- gpsdrive-2.10~pre4~/man/geo-code.1 2007-09-14 21:47:43.000000000 +0000
++++ gpsdrive-2.10~pre4/man/geo-code.1 2008-01-08 20:47:21.000000000 +0000
+@@ -1,7 +1,7 @@
+ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.33.
+ .TH GEO-CODE "1" "09.10.2003" "geo-code" "User Commands"
+ .SH NAME
+-geo-code
++geo-code \- Convert a street address into geo coordinates
+ .SH DESCRIPTION
+ .SS "Usage:"
+ .IP
+diff -urNad gpsdrive-2.10~pre4~/man/geoinfo.pl.1 gpsdrive-2.10~pre4/man/geoinfo.pl.1
+--- gpsdrive-2.10~pre4~/man/geoinfo.pl.1 2007-09-15 17:13:54.000000000 +0000
++++ gpsdrive-2.10~pre4/man/geoinfo.pl.1 2008-01-08 20:47:21.000000000 +0000
+@@ -131,7 +131,7 @@
+ .IX Title "GEOINFO 1"
+ .TH GEOINFO 1 "2007-09-15" "perl v5.8.8" "User Contributed Perl Documentation"
+ .SH "NAME"
+-\&\fBgeoinfo.pl\fR Version 0.9
++\&\fBgeoinfo.pl\fR \- Download and convert waypoints for use with gpsdrive
+ .SH "DESCRIPTION"
+ .IX Header "DESCRIPTION"
+ \&\fBgeoinfo.pl\fR is a program to download and convert waypoints
+diff -urNad gpsdrive-2.10~pre4~/man/gpsdrive.1 gpsdrive-2.10~pre4/man/gpsdrive.1
+--- gpsdrive-2.10~pre4~/man/gpsdrive.1 2007-09-14 21:47:43.000000000 +0000
++++ gpsdrive-2.10~pre4/man/gpsdrive.1 2008-01-08 20:54:10.000000000 +0000
+@@ -1,12 +1,12 @@
+ .TH GPSDRIVE 1
+ .SH NAME
+-gpsdrive v2.x - displays GPS position on a map
++gpsdrive \- displays GPS position on a map
+ .SH SYNOPSIS
+ .B gpsdrive [options]
+
+ .SH About this manual page
+
+-This manual page explain the basic functions of GpsDrive and some
++This manual page explains the basic functions of GpsDrive and some
+ additional info.
+
+ In GpsDrive you find tooltips for nearly all buttons, there is also a
+@@ -30,7 +30,7 @@
+
+ GpsDrive was tested with a GARMIN GPS III, a Crux II GPS PCMCIA
+ card and a Navilock USB receiver. All Garmin GPS reveivers with a serial output should be
+-usable. Other GPS reveivers that sends NMEA protocol over the
++usable. Other GPS receivers that sends NMEA protocol over the
+ serial output should also work with GpsDrive.
+
+ These GPS receivers are reported to work with gpsdrive:
+@@ -89,34 +89,32 @@
+ .B \-d
+ Shows some debugging information.
+ .TP
+-.B \-D
+-Shows a lot of debugging information. If you have problems or program
+-crashes, send this output to the author. You should also combine this
+-with -d. See also the section
+-.I BUGS
++.B \-D <level>
++Shows a lot of debugging information. You should also combine this with -d.
++.br
++See also the section
++.I BUGS.
++.TP
++.B \-T
++Do some internal unit tests (don't start gpsdrive).
++.TP
++.B \-e
++use festival-lite (flite) for speech output.
+ .TP
+ .B \-v
+-Shows program version together with the CVS version of the mainfile
+-gpsdrive.c. If you send a bug report, also include this output.
++Shows program version.
+ .TP
+ .B \-h
+ Displays a short help message.
+ .TP
+-.BI \-o "\| outputfile\^"
++.B \-o <outputfile>
+ With this option, you can
+ .IR write
+ the NMEA sentences to a PTY master, file or serial device. This is
+ useful if you use GpsDrive in simulation mode to provide other GPS
+ applications with test data.
+ .TP
+-.BI \-t "\| device\^"
+-Serial port device (e.g.
+-.IR /dev/ttyS0
+-). You can also set it in the
+-.IR setup
+-menu.
+-.TP
+-.BI \-l "\| language\^"
++.B \-l <language>
+ Sets the language for the speech output. You have to provide the voice
+ files in festival yourself (see below). At the moment
+ .IR german
+@@ -126,58 +124,66 @@
+ .IR english
+ are provided.
+ .TP
+-.B \-x
+-Creates own window for the menu buttons, status and map. This is
+-helpful on small displays like the Compaq iPaq or on Head Mounted
+-Displays, where the menu should be hidden.
+-.TP
+-.BI \-s "\| height\^"
+-Set the height of the screen, if autodetection don't satisfy you,
+-.IR height
+-is i.e. 768,600,480,200
+-.TP
+-.BI \-r "\| width\^"
+-Set the
+-.IR width
+-of the screen, if autodetection don't satisfy you. Works
+-only in combination with
+-.IR -s
++.B \-g <geometry>
++Set the geometry of the screen, if autodetection doesn't satisfy you,
++.IR geometry
++is i.e. 1024x768, 800x600, 640x480
+ .TP
+-.BI \-f "\| friendsserver\^"
+-Define a friendsserver to exchange position information with other
+-people. You can also set it in the Settings/Friends menu. You can start your own friendsserver with the program
+-.B friendsd
++.B \-f <friends server>
++Define a friends server to exchange position information with other
++people. You can also set it in the Settings/Friends menu. You can start your own friends server with the program
++.B friendsd2
+ , which is included. More details are in section
+ .I FRIENDSD server
+-
++.TP
++.B \-X
++Use DBUS for communication with gpsd. This disables socket communication.
++Try this option if gpsdrive fails to interpret output of the gps receiver correctly.
+ .TP
+ .B \-1
+ Set special mode if you only have 1 mouse button, i.e. on touchpads.
+ .TP
+ .B \-a
+-Disable display of battery status. Some implementations of the APM-BIOS
+-are broken, so use this option if gpsdrive crashes.
++Display APM stuff (battery status, temperature)
+ .TP
+-.BI \-b "\| servername\^"
++.B \-b <nmea server>
+ Use a remote NMEA server. You can start gpsd on another
+ .IR host
+ , which has the GPS receiver connected and display the position on
+ your local machine.
+ .TP
+-.BI \-c "\| waypointname\^"
++.B \-c <waypoint>
+ Initial position for simulation mode. Specify a
+ .IR "waypoint name"
+ from your currently used waypoint list.
+ .TP
++.B \-M <mode>
++Set GUI mode. <mode> may be 'desktop' (default), 'pda' or 'car'.
++.TP
++.B \-i
++Ignore NMEA checksum (risky, only for broken GPS receivers).
++.TP
+ .B \-q
+-Disables SQL support. Only useful if you have SQL support compiled in.
++Disables SQL support.
+ .TP
+-.B \-z
+-Don't show zoom and scaling on the map.
++.B \-F
++Force display of position even if it is invalid.
+ .TP
+-.BI \-n
+-Disables the direct serial connection. You have to use Garmin mode
+-or start gpsd
++.B \-S
++Don't show splash screen.
++.TP
++.B \-P
++Start in Position Mode
++.TP
++.B \-W <x>
++Set to 1 to switch WAAS/EGNOS on, set to 0 to switch it off.
++.TP
++.B \-H <altitude>
++Correct altitude.
++.TP
++.B \-C <file>
++Set config file to <file>.
++
+ .br
+
+
+@@ -247,7 +253,7 @@
+ from your shell, if you want another language see section
+ .I LOCALISATION
+
+-On some distribution you may find a "GpsDrive" entry in your Gnome or
++On some distributions you may find a "GpsDrive" entry in your Gnome or
+ KDE menu.
+
+ It is important that you have installed GpsDrive as root, so it can
+@@ -265,13 +271,13 @@
+
+ If you have connected a GPS-Receiver, you see in the
+ .I GPS Info
+-window how much satellites are in view. You can click on this image to switch to the
++window how many satellites are in view. You can click on this image to switch to the
+ .I Satellite position view.
+ .br
+ You must have at least 3 satellites in view. If you want to see your
+ altitude, you need at least 4 satellites. The antenna of your GPS
+ receiver must have free sight to the sky, so you cannot use it
+-indoor. More satellites gives you a better accuracy.
++indoors. More satellites gives you a better accuracy.
+
+ If your receiver has not enough satellites with usable signal, the
+ GPS Info window is red. If your signal is ok and gives a valid
+@@ -283,7 +289,7 @@
+
+ This mode is entered if you have a GPS receiver connected. The cursor is at the position your receiver sends.
+
+-The black and a red arrow shows your position on the map. The
++Black and a red arrows show your position on the map. The
+ .B black arrow
+ is pointing to your selected target, the
+ .B red arrow
+@@ -309,7 +315,7 @@
+ .B not your real position
+ and is marked as an rectangle.
+
+-You can set the position by simple left-mouse click on the map.
++You can set the position by a simple left-mouse click on the map.
+
+ You can leave the position mode by by clicking on the "Pos. mode"
+ button or middle-mouse click or right-mouse click (which also sets
+@@ -323,7 +329,7 @@
+
+ .SH MAP DOWNLOAD
+
+-You can easily download maps from internet with the
++You can easily download maps from the internet with the
+ .B Download
+ button. GpsDrive stores an index of your maps in the file
+ map_koord.txt in your ~/.gpsdrive directory. You can also use any
+@@ -357,7 +363,7 @@
+ Vienna.
+
+
+-There is also the programs
++There is also the program
+ .IR gpsfetchmap.pl
+ provided to download multiple maps for a bigger area.
+ .br
+@@ -365,7 +371,7 @@
+ www.expedia.com if you want to use their maps!
+ .br
+ .B Don't misuse this service by downloading more maps as you need!
+-You will risk being blocked by thier servers, and possibly cause
++You will risk being blocked by these servers, and possibly cause
+ trouble for the gpsdrive project.
+
+ File formats:
+@@ -391,12 +397,12 @@
+ prefix in subdirectories of $HOME/.gpsdrive/ which end in "_map" or
+ "_top".
+
+-There is an "import assistant" built in. Use this to import your maps.
++There is an "import assistant" built in. Use it to import your maps.
+
+ .SH Importing waypoints:
+
+
+-The easiest way is to use the script "wpget" which does all for you if
++The easiest way is to use the script "wpget" which does everything for you if
+ you use a GARMIN receiver.
+ You can use the program "garble" (included in the package) to read
+ out your waypoints from the Garmin GPS (Transfer mode must be set to
+@@ -405,7 +411,7 @@
+ Scripts: "wpget" is a script which calls "garble" in the proper way.
+
+ Be sure to have "wpget", "wpcvt" and "garble" in your path. This is
+-fullfilled, if you did install the program as root and /usr/local/bin
++fulfilled, if you did install the program as root and /usr/local/bin
+ is in your path.
+
+ The manual way:
+@@ -434,7 +440,7 @@
+
+ .SH PROXY SERVER
+ If you must access the internet via a proxy server, you have to set the
+-enviroment variable
++enviromental variable
+ .B HTTP_PROXY
+ or
+ .B http_proxy
+@@ -546,8 +552,8 @@
+ Gpsdrive supports
+ .IR kismet.
+ Kismet is a 802.11b wireless network (WLAN) sniffer. If you have
+-kismet running, gpsdrive will detect it and program start and shows
+-new WLAN accesspoints in realtime on the map. SQL mode is necessary to
++kismet running, gpsdrive will detect it and program starts and shows
++new WLAN access points in real time on the map. SQL mode is necessary to
+ use Gpsdrive with Kismet. WLAN accesspoints which are already
+ stored in the SQL database from prior wardrivings are ignored. If you
+ have voice output in gpsdrive, you hear information about the newly
+@@ -594,7 +600,7 @@
+
+ When you start GpsDrive it will detect the server on port 1314 and
+ puts out some status information as speech. You also have an
+-additonal button (Mute) to switch off sound output.
++additional button (Mute) to switch off sound output.
+
+ GpsDrive tries to select the correct language for your locale.
+ The -l option can force the languages for speech
+@@ -659,12 +665,10 @@
+
+ .SH MAILING LIST
+ The address for the mailing list is
+-.B gpsdrive@warbase.selwerd.nl
+-
+-Subscribing can be done by sending a mail containing
+-.B subscribe gpsdrive
+-
+-to majordomo@warbase.selwerd.nl
++.B gpsdrive@lists.gpsdrivers.org
++.br
++You can browse the archive or subscribe at
++http://lists.gpsdrivers.org/mailman/listinfo/gpsdrive
+
+ .SH BUGS
+ Please send bug reports to the author. Report version (gpsdrive -v),
+@@ -696,9 +700,15 @@
+
+ and send me this output.
+
+-.SH AUTHOR
+-Fritz Ganter
++.SH AUTHORS
++Fritz Ganter,
++.br
++Joerg Ostertag,
++.br
++Gpsdrive Development Team
+ .br
++and others.
++.PP
+ http://www.gpsdrive.de
+ .SH WARRANTY
+ This program is distributed in the hope that it will be useful,
+@@ -707,11 +717,21 @@
+ GNU General Public License for more details.
+
+ .SH COPYRIGHT
+-Copyright (c) 2001-2004 by Fritz Ganter
++Copyright (c) 2001-2006 by Fritz Ganter
++.br
++Copyright (c) 2006-2007 The GpsDrive Development Team
+ .br
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+-
++.SH SEE ALSO
++.PP
++.B gpsd(8),
++.B friendsd(1),
++.B gpsfetchmap(1),
++.B osm2pgsql(1),
++.B kismet(1),
++.B festival(1),
++.B flite(1)
+diff -urNad gpsdrive-2.10~pre4~/man/gpsfetchmap.pl.1 gpsdrive-2.10~pre4/man/gpsfetchmap.pl.1
+--- gpsdrive-2.10~pre4~/man/gpsfetchmap.pl.1 2007-09-15 17:13:54.000000000 +0000
++++ gpsdrive-2.10~pre4/man/gpsfetchmap.pl.1 2008-01-08 20:47:21.000000000 +0000
+@@ -131,7 +131,7 @@
+ .IX Title "GPSFETCHMAP 1"
+ .TH GPSFETCHMAP 1 "2007-09-15" "perl v5.8.8" "User Contributed Perl Documentation"
+ .SH "NAME"
+-\&\fBgpsfetchmap\fR Version 1.04
++\&\fBgpsfetchmap\fR \- Download maps from a mapserver
+ .SH "DESCRIPTION"
+ .IX Header "DESCRIPTION"
+ \&\fBgpsfetchmap\fR is a program to download maps from a mapserver for use with gpsdrive.
+diff -urNad gpsdrive-2.10~pre4~/man/gpspoint2gpsdrive.pl.1 gpsdrive-2.10~pre4/man/gpspoint2gpsdrive.pl.1
+--- gpsdrive-2.10~pre4~/man/gpspoint2gpsdrive.pl.1 2007-09-15 17:13:54.000000000 +0000
++++ gpsdrive-2.10~pre4/man/gpspoint2gpsdrive.pl.1 2008-01-08 20:47:21.000000000 +0000
+@@ -131,7 +131,7 @@
+ .IX Title "GPSPOINT2GPSDRIVE 1"
+ .TH GPSPOINT2GPSDRIVE 1 "2007-09-14" "perl v5.8.8" "User Contributed Perl Documentation"
+ .SH "NAME"
+-\&\fBgpspoint2gpsdrive.pl\fR
++\&\fBgpspoint2gpsdrive.pl\fR \- Extract gpsdrive-compatible tracks from a gpspoint file
+ .SH "DESCRIPTION"
+ .IX Header "DESCRIPTION"
+ \&\fBgpspoint2gpsdrive.pl\fR
+diff -urNad gpsdrive-2.10~pre4~/man/poi-manager.pl.1 gpsdrive-2.10~pre4/man/poi-manager.pl.1
+--- gpsdrive-2.10~pre4~/man/poi-manager.pl.1 2007-09-15 17:13:54.000000000 +0000
++++ gpsdrive-2.10~pre4/man/poi-manager.pl.1 2008-01-08 20:47:21.000000000 +0000
+@@ -130,6 +130,8 @@
+ .\"
+ .IX Title "POI-MANAGER 1"
+ .TH POI-MANAGER 1 "2007-09-14" "perl v5.8.8" "User Contributed Perl Documentation"
++.SH NAME
++poi\-manager \- Manage points of interest
+ .SH "SYNOPSIS"
+ .IX Header "SYNOPSIS"
+ poi\-manager.pl [\-h] [\-v] [\-b] [\-i] [\-e] [\-p] [\-s] [\-f \s-1GPX\-FILE\s0]
diff --git a/debian/patches/10-mapnikdir.dpatch b/debian/patches/10-mapnikdir.dpatch
new file mode 100644
index 0000000..91367cc
--- /dev/null
+++ b/debian/patches/10-mapnikdir.dpatch
@@ -0,0 +1,252 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 10-mapnikdir.dpatch by Andreas Putzo <andreas@putzo.net>
+##
+## DP: Put mapnik files into gpsdrive directory.
+
+@DPATCH@
+diff -urNad gpsdrive-2.10~pre4~/scripts/mapnik/Makefile.am gpsdrive-2.10~pre4/scripts/mapnik/Makefile.am
+--- gpsdrive-2.10~pre4~/scripts/mapnik/Makefile.am 2007-09-14 21:47:06.000000000 +0000
++++ gpsdrive-2.10~pre4/scripts/mapnik/Makefile.am 2007-10-16 08:22:45.000000000 +0000
+@@ -2,7 +2,7 @@
+
+ bin_SCRIPTS = gpsdrive_mapnik_gentiles.py
+
+-mapnikdir = $(datadir)/mapnik
++mapnikdir = $(datadir)/gpsdrive/mapnik
+ mapnik_DATA = osm.xml
+
+ EXTRA_DIST = setup_z_order.sql gpsdrive_mapnik_gentiles-in.py osm-in.xml
+@@ -13,7 +13,7 @@
+ dummy:
+
+ gpsdrive_mapnik_gentiles.py: gpsdrive_mapnik_gentiles-in.py
+- sed 's,@DATA_DIR@,${datadir},' < $< > $@
++ sed 's,@DATA_DIR@,${mapnikdir},' < $< > $@
+
+ osm.xml: osm-in.xml
+- sed 's,@DATA_DIR@,${datadir},' < $< > $@
++ sed 's,@DATA_DIR@,${mapnikdir},' < $< > $@
+diff -urNad gpsdrive-2.10~pre4~/scripts/mapnik/osm-in.xml gpsdrive-2.10~pre4/scripts/mapnik/osm-in.xml
+--- gpsdrive-2.10~pre4~/scripts/mapnik/osm-in.xml 2007-09-14 21:47:06.000000000 +0000
++++ gpsdrive-2.10~pre4/scripts/mapnik/osm-in.xml 2007-10-16 08:24:20.000000000 +0000
+@@ -93,24 +93,24 @@
+ <Rule>
+ <MaxScaleDenominator>5000</MaxScaleDenominator>
+ <Filter>[amenity]='post_box'</Filter>
+- <PointSymbolizer file="@DATA_DIR@/map-icons/classic.small/public/post_box.png" type="png" width="16" height="16" />
++ <PointSymbolizer file="/usr/share/icons/openstreetmap/classic.small/public/post_box.png" type="png" width="16" height="16" />
+ </Rule>
+ <Rule>
+ <MaxScaleDenominator>5000</MaxScaleDenominator>
+ <Filter>[amenity]='post_office'</Filter>
+- <PointSymbolizer file="@DATA_DIR@/map-icons/classic.small/public/post_office.png" type="png" width="16" height="16" />
++ <PointSymbolizer file="/usr/share/icons/openstreetmap/classic.small/public/post_office.png" type="png" width="16" height="16" />
+ </Rule>
+
+ <Rule>
+ <MaxScaleDenominator>250000</MaxScaleDenominator>
+ <MinScaleDenominator>25000</MinScaleDenominator>
+ <Filter>[railway]='station'</Filter>
+- <PointSymbolizer file="@DATA_DIR@/map-icons/classic.small/transport/railway_small.png" type="png" width="5" height="5" />
++ <PointSymbolizer file="/usr/share/icons/openstreetmap/classic.small/transport/railway_small.png" type="png" width="5" height="5" />
+ </Rule>
+ <Rule>
+ <MaxScaleDenominator>25000</MaxScaleDenominator>
+ <Filter>[railway]='station'</Filter>
+- <PointSymbolizer file="@DATA_DIR@/map-icons/classic.small/transport/railway.png" type="png" width="9" height="9" />
++ <PointSymbolizer file="/usr/share/icons/openstreetmap/classic.small/transport/railway.png" type="png" width="9" height="9" />
+ </Rule>
+ <Rule>
+ <MaxScaleDenominator>50000</MaxScaleDenominator>
+@@ -127,51 +127,51 @@
+ <Rule>
+ <MaxScaleDenominator>10000</MaxScaleDenominator>
+ <Filter>[amenity]='pub'</Filter>
+- <PointSymbolizer file="@DATA_DIR@/map-icons/classic.small/food/pub.png" type="png" width="16" height="16" />
++ <PointSymbolizer file="/usr/share/icons/openstreetmap/classic.small/food/pub.png" type="png" width="16" height="16" />
+ </Rule>
+ <Rule>
+ <MaxScaleDenominator>100000</MaxScaleDenominator>
+ <Filter>[natural]='peak'</Filter>
+- <PointSymbolizer file="@DATA_DIR@/map-icons/classic.small/misc/landmark/peak.png" type="png" width="8" height="8" />
++ <PointSymbolizer file="/usr/share/icons/openstreetmap/classic.small/misc/landmark/peak.png" type="png" width="8" height="8" />
+ </Rule>
+ <Rule>
+ <MaxScaleDenominator>5000</MaxScaleDenominator>
+ <Filter>[man_made]='mast'</Filter>
+- <PointSymbolizer file="@DATA_DIR@/map-icons/classic.small/misc/landmark/tower.png" type="png" width="32" height="32" />
++ <PointSymbolizer file="/usr/share/icons/openstreetmap/classic.small/misc/landmark/tower.png" type="png" width="32" height="32" />
+ </Rule>
+ <Rule>
+ <MaxScaleDenominator>10000</MaxScaleDenominator>
+ <Filter>[amenity]='recycling'</Filter>
+- <PointSymbolizer file="@DATA_DIR@/map-icons/classic.small/public/recycling.png" type="png" width="20" height="20" />
++ <PointSymbolizer file="/usr/share/icons/openstreetmap/classic.small/public/recycling.png" type="png" width="20" height="20" />
+ </Rule>
+
+ <Rule>
+ <MaxScaleDenominator>20000</MaxScaleDenominator>
+ <Filter>[amenity]='hospital'</Filter>
+- <PointSymbolizer file="@DATA_DIR@/map-icons/classic.small/health/hospital.png" type="png" width="20" height="20" />
++ <PointSymbolizer file="/usr/share/icons/openstreetmap/classic.small/health/hospital.png" type="png" width="20" height="20" />
+ </Rule>
+
+ <Rule>
+ <MaxScaleDenominator>5000</MaxScaleDenominator>
+ <Filter>[amenity]='bus_stop' or [highway]='bus_stop'</Filter>
+- <PointSymbolizer file="@DATA_DIR@/map-icons/classic.small/transport/bus.png" type="png" width="30" height="12" />
++ <PointSymbolizer file="/usr/share/icons/openstreetmap/classic.small/transport/bus.png" type="png" width="30" height="12" />
+ </Rule>
+
+ <Rule>
+ <MaxScaleDenominator>20000</MaxScaleDenominator>
+ <Filter>[amenity]='parking'</Filter>
+- <PointSymbolizer file="@DATA_DIR@/map-icons/classic.small/vehicle/parking.png" type="png" width="16" height="16" allow_overlap="false"/>
++ <PointSymbolizer file="/usr/share/icons/openstreetmap/classic.small/vehicle/parking.png" type="png" width="16" height="16" allow_overlap="false"/>
+ </Rule>
+
+ <Rule>
+ <MaxScaleDenominator>10000</MaxScaleDenominator>
+ <Filter>[amenity]='place_of_worship'</Filter>
+- <PointSymbolizer file="@DATA_DIR@/map-icons/classic.small/religion/church.png" type="png" width="16" height="16" allow_overlap="false"/>
++ <PointSymbolizer file="/usr/share/icons/openstreetmap/classic.small/religion/church.png" type="png" width="16" height="16" allow_overlap="false"/>
+ </Rule>
+ <Rule>
+ <MaxScaleDenominator>10000</MaxScaleDenominator>
+ <Filter>[amenity]='airport'</Filter>
+- <PointSymbolizer file="@DATA_DIR@/map-icons/classic.small/transport/airport.png" type="png" width="16" height="16" allow_overlap="false"/>
++ <PointSymbolizer file="/usr/share/icons/openstreetmap/classic.small/transport/airport.png" type="png" width="16" height="16" allow_overlap="false"/>
+ </Rule>
+ </Style>
+
+@@ -203,7 +203,7 @@
+ <Rule>
+ <MaxScaleDenominator>50000</MaxScaleDenominator>
+ <Filter>[landuse] = 'cemetery'</Filter>
+- <PolygonPatternSymbolizer file="@DATA_DIR@/map-icons/classic.small/religion/cemetery.png" type="png" width="16" height="16"/>
++ <PolygonPatternSymbolizer file="/usr/share/icons/openstreetmap/classic.small/religion/cemetery.png" type="png" width="16" height="16"/>
+ </Rule>
+
+ <Rule>
+@@ -1086,7 +1086,7 @@
+ <MaxScaleDenominator>100000</MaxScaleDenominator>
+ <MinScaleDenominator>1000</MinScaleDenominator>
+ <Filter>[railway] = 'rail'</Filter>
+- <LinePatternSymbolizer file="@DATA_DIR@/map-icons/classic.small/transport/track/rail.png" type="png" width="20" height="3" />
++ <LinePatternSymbolizer file="/usr/share/icons/openstreetmap/classic.small/transport/track/rail.png" type="png" width="20" height="3" />
+ </Rule>
+
+ <Rule>
+@@ -1567,7 +1567,7 @@
+ <MaxScaleDenominator>100000</MaxScaleDenominator>
+ <MinScaleDenominator>1000</MinScaleDenominator>
+ <Filter>[railway] = 'preserved'</Filter>
+- <LinePatternSymbolizer file="@DATA_DIR@/map-icons/classic.small/transport/rail_preserved.png" type="png" width="20" height="3" />
++ <LinePatternSymbolizer file="/usr/share/icons/openstreetmap/classic.small/transport/rail_preserved.png" type="png" width="20" height="3" />
+ </Rule>
+
+ </Style>
+@@ -1579,19 +1579,19 @@
+ <Filter>[highway] = 'motorway' and [length] = 2</Filter>
+ <MaxScaleDenominator>500000</MaxScaleDenominator>
+ <MinScaleDenominator>100</MinScaleDenominator>
+- <ShieldSymbolizer name="ref" face_name="DejaVu Sans Book" size="11" fill="#809bc0" placement="line" file="@DATA_DIR@/map-icons/classic.small/vehicle/shield/motorway_shield.png" type="png" width="24" height="17" min_distance="100"/>
++ <ShieldSymbolizer name="ref" face_name="DejaVu Sans Book" size="11" fill="#809bc0" placement="line" file="/usr/share/icons/openstreetmap/classic.small/vehicle/shield/motorway_shield.png" type="png" width="24" height="17" min_distance="100"/>
+ </Rule>
+ <Rule>
+ <Filter>[highway] = 'motorway' and [length] = 3</Filter>
+ <MaxScaleDenominator>500000</MaxScaleDenominator>
+ <MinScaleDenominator>100</MinScaleDenominator>
+- <ShieldSymbolizer name="ref" face_name="DejaVu Sans Book" size="11" fill="#809bc0" placement="line" file="@DATA_DIR@/map-icons/classic.small/vehicle/shield/motorway_shield2.png" type="png" width="31" height="17" min_distance="100"/>
++ <ShieldSymbolizer name="ref" face_name="DejaVu Sans Book" size="11" fill="#809bc0" placement="line" file="/usr/share/icons/openstreetmap/classic.small/vehicle/shield/motorway_shield2.png" type="png" width="31" height="17" min_distance="100"/>
+ </Rule>
+ <Rule>
+ <Filter>[highway] = 'motorway' and [length] = 4</Filter>
+ <MaxScaleDenominator>500000</MaxScaleDenominator>
+ <MinScaleDenominator>100</MinScaleDenominator>
+- <ShieldSymbolizer name="ref" face_name="DejaVu Sans Book" size="11" fill="#809bc0" placement="line" file="@DATA_DIR@/map-icons/classic.small/vehicle/shield/motorway_shield3.png" type="png" width="38" height="17" min_distance="100"/>
++ <ShieldSymbolizer name="ref" face_name="DejaVu Sans Book" size="11" fill="#809bc0" placement="line" file="/usr/share/icons/openstreetmap/classic.small/vehicle/shield/motorway_shield3.png" type="png" width="38" height="17" min_distance="100"/>
+ </Rule>
+ <Rule>
+ <Filter>[highway] = 'trunk' or [highway] = 'primary' or [highway] = 'secondary'</Filter>
+@@ -1628,12 +1628,12 @@
+ <Rule>
+ <Filter>[oneway] = 'yes' or [oneway] = 'true'</Filter>
+ <MaxScaleDenominator>25000</MaxScaleDenominator>
+- <LinePatternSymbolizer file="@DATA_DIR@/map-icons/classic.small/transport/track/arrow.png" type="png" width="80" height="8" />
++ <LinePatternSymbolizer file="/usr/share/icons/openstreetmap/classic.small/transport/track/arrow.png" type="png" width="80" height="8" />
+ </Rule>
+ <Rule>
+ <Filter>[oneway] = '-1'</Filter>
+ <MaxScaleDenominator>25000</MaxScaleDenominator>
+- <LinePatternSymbolizer file="@DATA_DIR@/map-icons/classic.small/transport/track/arrow_back.png" type="png" width="80" height="8" />
++ <LinePatternSymbolizer file="/usr/share/icons/openstreetmap/classic.small/transport/track/arrow_back.png" type="png" width="80" height="8" />
+ </Rule>
+ </Style>
+
+@@ -1641,7 +1641,7 @@
+ <StyleName>world-1</StyleName>
+ <Datasource>
+ <Parameter name="type">shape</Parameter>
+- <Parameter name="file">@DATA_DIR@/mapnik/world_boundaries/world_boundaries_m</Parameter>
++ <Parameter name="file">@DATA_DIR@/world_boundaries/world_boundaries_m</Parameter>
+ </Datasource>
+ </Layer>
+
+@@ -1649,7 +1649,7 @@
+ <StyleName>world</StyleName>
+ <Datasource>
+ <Parameter name="type">shape</Parameter>
+- <Parameter name="file">@DATA_DIR@/mapnik/world_boundaries/world_bnd_m</Parameter>
++ <Parameter name="file">@DATA_DIR@/world_boundaries/world_bnd_m</Parameter>
+ </Datasource>
+ </Layer>
+
+@@ -1657,7 +1657,7 @@
+ <StyleName>coast-poly</StyleName>
+ <Datasource>
+ <Parameter name="type">shape</Parameter>
+- <Parameter name="file">@DATA_DIR@/mapnik/world_boundaries/shoreline_a</Parameter>
++ <Parameter name="file">@DATA_DIR@/world_boundaries/shoreline_a</Parameter>
+ </Datasource>
+ </Layer>
+
+@@ -1665,7 +1665,7 @@
+ <StyleName>coast-line</StyleName>
+ <Datasource>
+ <Parameter name="type">shape</Parameter>
+- <Parameter name="file">@DATA_DIR@/mapnik/world_boundaries/shoreline_l</Parameter>
++ <Parameter name="file">@DATA_DIR@/world_boundaries/shoreline_l</Parameter>
+ </Datasource>
+ </Layer>
+
+@@ -1674,7 +1674,7 @@
+ <StyleName>builtup</StyleName>
+ <Datasource>
+ <Parameter name="type">shape</Parameter>
+- <Parameter name="file">@DATA_DIR@/mapnik/world_boundaries/builtup_area</Parameter>
++ <Parameter name="file">@DATA_DIR@/world_boundaries/builtup_area</Parameter>
+ </Datasource>
+ </Layer>
+
+@@ -1786,7 +1786,7 @@
+ <StyleName>places</StyleName>
+ <Datasource>
+ <Parameter name="type">shape</Parameter>
+- <Parameter name="file">@DATA_DIR@/mapnik/world_boundaries/places</Parameter>
++ <Parameter name="file">@DATA_DIR@/world_boundaries/places</Parameter>
+ </Datasource>
+ </Layer>
+ </Map>
+diff -urNad gpsdrive-2.10~pre4~/src/mapnik.cpp gpsdrive-2.10~pre4/src/mapnik.cpp
+--- gpsdrive-2.10~pre4~/src/mapnik.cpp 2007-09-14 21:47:13.000000000 +0000
++++ gpsdrive-2.10~pre4/src/mapnik.cpp 2007-10-16 08:22:45.000000000 +0000
+@@ -156,7 +156,7 @@
+ if ( ! boost:: filesystem::exists(mapnik_config_file) )
+ mapnik_config_file.assign("../scripts/mapnik/osm.xml");
+ if ( ! boost:: filesystem::exists(mapnik_config_file) )
+- mapnik_config_file.assign(DATADIR).append("/mapnik/osm.xml");
++ mapnik_config_file.assign(DATADIR).append("/gpsdrive/mapnik/osm.xml");
+ cout << "Using Mapnik config-file: " << mapnik_config_file << endl;
+
+ if ( ! boost:: filesystem::exists(mapnik_config_file) ) {
diff --git a/debian/patches/100-fix-insecure-tempfiles.dpatch b/debian/patches/100-fix-insecure-tempfiles.dpatch
new file mode 100644
index 0000000..7ad5af1
--- /dev/null
+++ b/debian/patches/100-fix-insecure-tempfiles.dpatch
@@ -0,0 +1,86 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 100-fix-insecure-tempfiles.dpatch by Andreas Putzo <andreas@putzo.net>
+##
+## DP: Fix insecure tempfile creation in geo-code.
+## DP: Thanks Moritz Muehlenhoff <jmm@inutil.org>.
+
+@DPATCH@
+diff -urNad gpsdrive-2.10~pre4-6.dfsg~/scripts/geo-code gpsdrive-2.10~pre4-6.dfsg/scripts/geo-code
+--- gpsdrive-2.10~pre4-6.dfsg~/scripts/geo-code 2007-09-14 21:47:07.000000000 +0000
++++ gpsdrive-2.10~pre4-6.dfsg/scripts/geo-code 2008-12-28 17:47:39.000000000 +0000
+@@ -83,6 +83,7 @@
+ #
+ error() {
+ echo "`basename $PROGNAME`: $1" >&2
++ remove_cruft
+ exit 1
+ }
+
+@@ -130,8 +131,9 @@
+ a) SQLMATCH=all;;
+ D) DEBUG="$OPTARG";;
+ U) echo "Getting latest version of this script..."
+- curl -o$UPDATEcodeFILE "$UPDATEcodeURL"
+- echo "Latest version is in $UPDATEcodeFILE"
++ destdir=`mktemp -d`
++ curl -o$destdir/$UPDATEcodeFILE "$UPDATEcodeURL"
++ echo "Latest version is in $destdir/$UPDATEcodeFILE"
+ exit
+ ;;
+ h|\?) usage;;
+@@ -239,7 +241,7 @@
+ # procedure to remove cruft files
+ #
+ remove_cruft() {
+- for i in $STYLE $COORDS $OUTWAY $MAP
++ for i in $STYLE $COORDS $OUTWAY $MAP $TMP
+ do
+ [ -f $i ] && rm -f $i
+ done
+@@ -248,11 +250,11 @@
+ #
+ # Main Program
+ #
+-TMP=/tmp/geo$$
+-STYLE=${TMP}.style
+-COORDS=${TMP}.coords
+-OUTWAY=${TMP}.way
+-MAP=${TMP}.gif
++TMP=`mktemp -d`
++STYLE=${TMP}/style
++COORDS=${TMP}/coords
++OUTWAY=${TMP}/way
++MAP=${TMP}/gif
+ UA="Mozilla/5.0"
+
+ if [ "$GURL" != "" ]; then
+@@ -269,7 +271,6 @@
+ | head -n1 \
+ `
+ if [ "$URL" = "" ]; then
+- cp $COORDS /tmp/geo.google
+ error "Unable to lookup telephone number or name with Google"
+ else
+ URL="http://maps.yahoo.com/$URL"
+@@ -295,7 +296,7 @@
+ fi
+
+ if [ $DEBUG -gt 0 ]; then
+- filter="tee /tmp/geo.yahoo"
++ filter="tee `mktemp`"
+ else
+ filter=cat
+ fi
+@@ -306,9 +307,9 @@
+ -e 's/.*slt=\([^%]*\).*sln=\([^%]*\).*Create.*/\1 \2/p' \
+ > $COORDS
+
+-if [ $DEBUG -gt 0 ]; then
+- cp $COORDS /tmp/geo.coords
+-fi
++#if [ $DEBUG -gt 0 ]; then
++# cp -d $COORDS /tmp/geo.coords
++#fi
+
+ #
+ # Convert the coords, address, and type to the desired
diff --git a/debian/patches/101-signalposreq.dpatch b/debian/patches/101-signalposreq.dpatch
new file mode 100644
index 0000000..f30b1bb
--- /dev/null
+++ b/debian/patches/101-signalposreq.dpatch
@@ -0,0 +1,70 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 101-signalposreq.dpatch by Andreas Putzo <andreas@putzo.net>
+##
+## DP: Remove signalposreq() from gpsdrive, vulnerable to symlink attacks.
+## DP: Remove weird deletion of temporary files.
+
+@DPATCH@
+diff -urNad gpsdrive-2.10~pre4-6.dfsg~/src/gpsdrive.c gpsdrive-2.10~pre4-6.dfsg/src/gpsdrive.c
+--- gpsdrive-2.10~pre4-6.dfsg~/src/gpsdrive.c 2008-12-28 18:10:54.000000000 +0000
++++ gpsdrive-2.10~pre4-6.dfsg/src/gpsdrive.c 2008-12-28 18:11:27.000000000 +0000
+@@ -3087,9 +3087,6 @@
+ /* all default values must be set BEFORE readconfig! */
+ g_strlcpy (setpositionname, "", sizeof (setpositionname));
+
+- /* setup signal handler */
+- signal (SIGUSR1, signalposreq);
+-
+ sql_load_lib();
+ /* I18l */
+
+@@ -3419,9 +3416,6 @@
+ gdk_pixbuf_unref (friendspixbuf);
+
+
+- unlink ("/tmp/cammain.pid");
+- unlink ("/tmp/gpsdrivetext.out");
+- unlink ("/tmp/gpsdrivepos");
+ if (local_config.savetrack)
+ savetrackfile (2);
+ sqlend ();
+diff -urNad gpsdrive-2.10~pre4-6.dfsg~/src/gpsproto.h gpsdrive-2.10~pre4-6.dfsg/src/gpsproto.h
+--- gpsdrive-2.10~pre4-6.dfsg~/src/gpsproto.h 2007-09-14 21:47:13.000000000 +0000
++++ gpsdrive-2.10~pre4-6.dfsg/src/gpsproto.h 2008-12-28 18:11:32.000000000 +0000
+@@ -75,7 +75,6 @@
+ gint settings_main_cb (GtkWidget *widget, guint datum);
+ gint sel_message_cb (GtkWidget * widget, guint datum);
+ gint setmessage_cb (GtkWidget * widget, guint datum);
+-void signalposreq ();
+ gint reinsertwp_cb (GtkWidget * widget, guint datum);
+ GdkPixbuf *create_pixbuf (const gchar * filename);
+ gint simulated_pos (GtkWidget * widget, guint * datum);
+diff -urNad gpsdrive-2.10~pre4-6.dfsg~/src/splash.c gpsdrive-2.10~pre4-6.dfsg/src/splash.c
+--- gpsdrive-2.10~pre4-6.dfsg~/src/splash.c 2007-09-14 21:47:13.000000000 +0000
++++ gpsdrive-2.10~pre4-6.dfsg/src/splash.c 2008-12-28 18:11:18.000000000 +0000
+@@ -630,25 +630,3 @@
+ (gtk_widget_destroy), NULL);
+ return TRUE;
+ }
+-
+-
+-/* writes time and position to /tmp/gpsdrivepos */
+-void
+-signalposreq ()
+-{
+- FILE *f;
+- time_t t;
+- struct tm *ts;
+-
+- f = fopen ("/tmp/gpsdrivepos", "w");
+- if (f == NULL)
+- {
+- perror ("/tmp/gpsdrivepos");
+- return;
+- }
+- time (&t);
+- ts = localtime (&t);
+- fprintf (f, asctime (ts));
+- fprintf (f, "POS %f %f\n", coords.current_lat, coords.current_lon);
+- fclose (f);
+-}
diff --git a/debian/patches/102-unittest.dpatch b/debian/patches/102-unittest.dpatch
new file mode 100644
index 0000000..c83d4ed
--- /dev/null
+++ b/debian/patches/102-unittest.dpatch
@@ -0,0 +1,26 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 102-unittest.dpatch by Andreas Putzo <andreas@putzo.net>
+##
+## DP: Use mkdtemp to avoid a potential symlink attack.
+
+@DPATCH@
+diff -urNad gpsdrive-2.10~pre4-6.dfsg~/src/unit_test.c gpsdrive-2.10~pre4-6.dfsg/src/unit_test.c
+--- gpsdrive-2.10~pre4-6.dfsg~/src/unit_test.c 2007-09-15 15:12:03.000000000 +0000
++++ gpsdrive-2.10~pre4-6.dfsg/src/unit_test.c 2008-12-29 15:33:26.000000000 +0000
+@@ -649,10 +649,12 @@
+ gchar fn[500];
+ gint response;
+
+-
+- g_snprintf (dir_proc, sizeof (dir_proc), "/tmp/gpsdrive-unit-test");
+- mkdir (dir_proc, 0777);
+- g_snprintf (dir_proc, sizeof (dir_proc), "/tmp/gpsdrive-unit-test/proc");
++ strncpy(dir_proc, "/tmp/gpsdrive-unit-test.XXXXXX", sizeof(dir_proc));
++ if (mkdtemp(dir_proc) == NULL) {
++ printf("Error: Faild to create temporary directory\n");
++ exit(1);
++ }
++ strncat(dir_proc, "/proc", sizeof(dir_proc));
+ mkdir (dir_proc, 0777);
+
+ if (mydebug > 0)
diff --git a/debian/patches/103-no-textquery.dpatch b/debian/patches/103-no-textquery.dpatch
new file mode 100644
index 0000000..7adf796
--- /dev/null
+++ b/debian/patches/103-no-textquery.dpatch
@@ -0,0 +1,18 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 103-no-textquery.dpatch by Francesco Paolo Lovergine <frankie@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+@DPATCH@
+diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gpsdrive-2.10pre7~/scripts/osm/perl_lib/Geo/Gpsdrive/getstreet.pm gpsdrive-2.10pre7/scripts/osm/perl_lib/Geo/Gpsdrive/getstreet.pm
+--- gpsdrive-2.10pre7~/scripts/osm/perl_lib/Geo/Gpsdrive/getstreet.pm 2009-06-14 15:57:25.000000000 +0200
++++ gpsdrive-2.10pre7/scripts/osm/perl_lib/Geo/Gpsdrive/getstreet.pm 2010-03-08 10:47:16.000000000 +0100
+@@ -2,7 +2,6 @@
+ #noch nicht alle variablen angepasst
+ use LWP::UserAgent;
+ use WWW::Mechanize;
+-use Text::Query;
+ use Getopt::Long; #maybe not needed any more
+ use Pod::Usage;
+ use DBI;
diff --git a/debian/patches/104-fix-xcursor-check.dpatch b/debian/patches/104-fix-xcursor-check.dpatch
new file mode 100644
index 0000000..97b71bd
--- /dev/null
+++ b/debian/patches/104-fix-xcursor-check.dpatch
@@ -0,0 +1,19 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## Description: XcursorImageCreate is defined in Xcursor
+## Origin/Author: Julian Taylor <jtaylor.debian@googlemail.com>
+## Bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=615653
+## fix-xcursor-check.dpatch by Julian Taylor <jtaylor.debian@googlemail.com>
+
+@DPATCH@
+diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gpsdrive~/configure.ac gpsdrive/configure.ac
+--- gpsdrive~/configure.ac 2011-07-05 13:43:55.000000000 +0200
++++ gpsdrive/configure.ac 2011-07-05 13:51:30.531707412 +0200
+@@ -471,7 +471,7 @@
+ if $PKG_CONFIG xcursor --atleast-version=1.1.2
+ then
+ AC_MSG_RESULT([yes])
+- AC_CHECK_LIB(fontconfig, XcursorImageCreate, [], [
++ AC_CHECK_LIB(Xcursor, XcursorImageCreate, [], [
+ echo "Error with test of xcursor library not found"
+ exit -1
+ ])
diff --git a/debian/patches/105-add-boost-links.dpatch b/debian/patches/105-add-boost-links.dpatch
new file mode 100644
index 0000000..d6231b8
--- /dev/null
+++ b/debian/patches/105-add-boost-links.dpatch
@@ -0,0 +1,19 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## Description: requires direct link against boost {file,}system
+## Origin/Author: Julian Taylor <jtaylor.debian@googlemail.com>
+## Bug: https://bugs.launchpad.net/ubuntu/+source/gpsdrive/+bug/749273
+## 105-add-boost-links.dpatch by Julian Taylor <jtaylor.debian@googlemail.com>
+
+@DPATCH@
+diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' gpsdrive~/src/Makefile.am gpsdrive/src/Makefile.am
+--- gpsdrive~/src/Makefile.am 2011-07-05 13:59:11.000000000 +0200
++++ gpsdrive/src/Makefile.am 2011-07-05 14:02:23.341707820 +0200
+@@ -42,7 +42,7 @@
+ INCLUDES = $(DBUS_CFLAGS) -DDBUS_API_SUBJECT_TO_CHANGE=1
+ endif
+
+-gpsdrive_LDADD=@LIBS@ $(LIBADD_DL)
++gpsdrive_LDADD=@LIBS@ $(LIBADD_DL) -lboost_filesystem -lboost_system
+
+ PRGS = gpsdrive.c splash.c splash.h gpsdrive_config.c gpsdrive_config.h \
+ navigation.c \
diff --git a/debian/patches/107-fix-disable-mapnik.dpatch b/debian/patches/107-fix-disable-mapnik.dpatch
new file mode 100644
index 0000000..545c7f4
--- /dev/null
+++ b/debian/patches/107-fix-disable-mapnik.dpatch
@@ -0,0 +1,24 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 107-disable-mapnik.dpatch by Allison Randal <allison@canonical.com>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Don't call into the mapnik library APIs when mapnik is disabled.
+
+@DPATCH@
+diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' ftbfs-precise~/src/map_handler.c ftbfs-precise/src/map_handler.c
+--- ftbfs-precise~/src/map_handler.c 2011-12-01 22:24:15.000000000 +0000
++++ ftbfs-precise/src/map_handler.c 2011-12-01 22:37:16.298094236 +0000
+@@ -660,9 +660,12 @@
+ if (maploaded)
+ gdk_pixbuf_unref (image);
+
++#ifdef MAPNIK
+ if ( !strcmp (filename,"mapnik") ) {
+ limage = gdk_pixbuf_new_from_data(get_mapnik_imagedata(), GDK_COLORSPACE_RGB, FALSE, 8, 1280, 1024, 1280 * 3, NULL, NULL);
+- } else {
++ } else
++#endif // MAPNIK
++ {
+ limage = gdk_pixbuf_new_from_file (filename, NULL);
+ if (limage == NULL)
+ {
diff --git a/debian/patches/20-homedir.dpatch b/debian/patches/20-homedir.dpatch
new file mode 100644
index 0000000..88b1ff7
--- /dev/null
+++ b/debian/patches/20-homedir.dpatch
@@ -0,0 +1,44 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 20-homedir.dpatch by Andreas Putzo <andreas@putzo.net>
+##
+## DP: Do not overwrite ~/.gpsdrive/osm.xml when gpsdrive is started.
+
+@DPATCH@
+diff -urNad gpsdrive-2.10~pre4~/src/mapnik.cpp gpsdrive-2.10~pre4/src/mapnik.cpp
+--- gpsdrive-2.10~pre4~/src/mapnik.cpp 2007-09-17 07:48:41.000000000 +0000
++++ gpsdrive-2.10~pre4/src/mapnik.cpp 2007-09-17 07:50:02.000000000 +0000
+@@ -165,20 +165,21 @@
+ }
+
+ // load files
+-
+- ifstream InputXML (mapnik_config_file.c_str());
+- ofstream DestXML (Dest);
++ if ( ! boost:: filesystem::exists(Dest) ) {
++ ifstream InputXML (mapnik_config_file.c_str());
++ ofstream DestXML (Dest);
+
+- if (InputXML && DestXML) {
+- if (InputXML.is_open()) {
+- string s ;
+- while (getline(InputXML, s)) {
+- DestXML << ReplaceString("@USER@", Username, s) << endl;
+- }
+- }
+- }
+- InputXML.close();
+- DestXML.close();
++ if (InputXML && DestXML) {
++ if (InputXML.is_open()) {
++ string s ;
++ while (getline(InputXML, s)) {
++ DestXML << ReplaceString("@USER@", Username, s) << endl;
++ }
++ }
++ }
++ InputXML.close();
++ DestXML.close();
++ }
+
+ return -1;
+ }
diff --git a/debian/patches/30-icons.dpatch b/debian/patches/30-icons.dpatch
new file mode 100644
index 0000000..6a92582
--- /dev/null
+++ b/debian/patches/30-icons.dpatch
@@ -0,0 +1,52 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 30-icons.dpatch by Andreas Putzo <andreas@putzo.net>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Add map-icon paths for debian.
+
+@DPATCH@
+diff -urNad gpsdrive-2.10~pre4~/scripts/osm/perl_lib/Geo/Gpsdrive/DB_Defaults.pm gpsdrive-2.10~pre4/scripts/osm/perl_lib/Geo/Gpsdrive/DB_Defaults.pm
+--- gpsdrive-2.10~pre4~/scripts/osm/perl_lib/Geo/Gpsdrive/DB_Defaults.pm 2007-09-15 15:12:11.000000000 +0000
++++ gpsdrive-2.10~pre4/scripts/osm/perl_lib/Geo/Gpsdrive/DB_Defaults.pm 2007-09-29 21:54:55.000000000 +0000
+@@ -52,6 +52,7 @@
+ $icon_file = '/usr/local/share/map-icons/icons.xml' unless -s $icon_file;
+ $icon_file = '/usr/share/map-icons/icons.xml' unless -s $icon_file;
+ $icon_file = '/opt/gpsdrive/icons.xml' unless -s $icon_file;
++ $icon_file = '/usr/share/gpsdrive/map-icons/icons.xml' unless -s $icon_file;
+ die "no Icon File found" unless -s $icon_file;
+
+ our $title = ''; our $title_en = '';
+diff -urNad gpsdrive-2.10~pre4~/scripts/osm/perl_lib/Geo/Gpsdrive/OSM.pm gpsdrive-2.10~pre4/scripts/osm/perl_lib/Geo/Gpsdrive/OSM.pm
+--- gpsdrive-2.10~pre4~/scripts/osm/perl_lib/Geo/Gpsdrive/OSM.pm 2007-09-15 18:04:02.000000000 +0000
++++ gpsdrive-2.10~pre4/scripts/osm/perl_lib/Geo/Gpsdrive/OSM.pm 2007-09-29 21:57:27.000000000 +0000
+@@ -574,6 +574,7 @@
+ "data/map-icons/icons.xml",
+ "/usr/local/map-icons/icons.xml",
+ "/usr/local/share/map-icons/icons.xml",
++ "/usr/share/gpsdrive/map-icons/icons.xml",
+ ) {
+ unless ( $icons_filename && -s $icons_filename ){
+ print STDERR "Checking icons-file: $fn\n"
+diff -urNad gpsdrive-2.10~pre4~/src/icons.c gpsdrive-2.10~pre4/src/icons.c
+--- gpsdrive-2.10~pre4~/src/icons.c 2007-09-29 21:32:42.000000000 +0000
++++ gpsdrive-2.10~pre4/src/icons.c 2007-09-29 21:53:08.000000000 +0000
+@@ -219,6 +219,7 @@
+ {"%s/gpsdrive/pixmaps/", (gchar *) DATADIR},
+ {"%s/map-icons/", "/usr/share"},
+ {"%s/gpsdrive/pixmaps/", "/usr/share"},
++ {"/usr/share/icons/openstreetmap/"},
+ {"END", NULL}
+ };
+
+diff -urNad gpsdrive-2.10~pre4~/src/poi.c gpsdrive-2.10~pre4/src/poi.c
+--- gpsdrive-2.10~pre4~/src/poi.c 2007-09-29 21:32:42.000000000 +0000
++++ gpsdrive-2.10~pre4/src/poi.c 2007-09-29 21:53:08.000000000 +0000
+@@ -713,7 +713,7 @@
+ if (xml_reader == NULL)
+ {
+ g_snprintf (iconsxml_file, sizeof (iconsxml_file),
+- "%s/map-icons/icons.xml", DATADIR);
++ "%s/gpsdrive/map-icons/icons.xml", DATADIR);
+ xml_reader = xmlNewTextReaderFilename(iconsxml_file);
+ }
+ if (xml_reader == NULL)
diff --git a/debian/patches/40-backported.dpatch b/debian/patches/40-backported.dpatch
new file mode 100644
index 0000000..79259e3
--- /dev/null
+++ b/debian/patches/40-backported.dpatch
@@ -0,0 +1,80 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 40-backported.dpatch by Andreas Putzo <andreas@putzo.net>
+##
+## DP: Bugfixes from gpsdrive VCS.
+## DP: r1713: use poi_type_name as title for POI when no title is available .
+## DP: r1716: gpsdrive sets textdomain too late.
+## DP: r1717: include src/main_gui.c into the series of files to extract
+## DP: translatable strings from, so that all of the GUI can get
+## DP: translated.
+## DP: r1733: Adapt font path to debian files.
+
+@DPATCH@
+diff -urNad gpsdrive-2.10~pre4~/po/POTFILES.in gpsdrive-2.10~pre4/po/POTFILES.in
+--- gpsdrive-2.10~pre4~/po/POTFILES.in 2007-09-14 21:47:47.000000000 +0000
++++ gpsdrive-2.10~pre4/po/POTFILES.in 2007-10-03 12:24:09.000000000 +0000
+@@ -21,6 +21,7 @@
+ src/lib_map/map_port.c
+ src/lib_map/map_render.c
+ src/lib_map/map_transform.c
++src/main_gui.c
+ src/map_handler.c
+ src/map_projection.c
+ src/navigation.c
+diff -urNad gpsdrive-2.10~pre4~/src/gpsdrive.c gpsdrive-2.10~pre4/src/gpsdrive.c
+--- gpsdrive-2.10~pre4~/src/gpsdrive.c 2007-09-15 01:24:15.000000000 +0000
++++ gpsdrive-2.10~pre4/src/gpsdrive.c 2007-10-03 12:23:00.000000000 +0000
+@@ -2985,6 +2985,10 @@
+ main (int argc, char *argv[])
+ {
+
++ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
++ bind_textdomain_codeset (PACKAGE, "utf8");
++ textdomain (GETTEXT_PACKAGE);
++
+ gchar buf[500];
+
+ current.needtosave = FALSE;
+@@ -3167,14 +3171,6 @@
+ */
+ loadmapconfig ();
+
+- /* PORTING */
+- {
+- gchar *p;
+- p = bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+- bind_textdomain_codeset (PACKAGE, "utf8");
+- p = textdomain (GETTEXT_PACKAGE);
+- p = textdomain (NULL);
+- }
+
+ /* Setting locale for correct Umlauts */
+ gtk_set_locale ();
+diff -urNad gpsdrive-2.10~pre4~/src/mapnik.cpp gpsdrive-2.10~pre4/src/mapnik.cpp
+--- gpsdrive-2.10~pre4~/src/mapnik.cpp 2007-09-14 21:47:13.000000000 +0000
++++ gpsdrive-2.10~pre4/src/mapnik.cpp 2007-10-03 12:28:29.000000000 +0000
+@@ -118,7 +118,9 @@
+ // Both datasorce_cache and font_engine are 'singletons'.
+
+ datasource_cache::instance()->register_datasources("/usr/lib/mapnik/input/");
+- freetype_engine::instance()->register_font("/usr/lib/mapnik/fonts/DejaVuSans.ttf");
++ // XXX We should make the fontname and path a config option
++ freetype_engine::instance()->register_font("/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf");
++
+
+ MapnikMap.WidthInt = 1280;
+ MapnikMap.HeightInt = 1024;
+diff -urNad gpsdrive-2.10~pre4~/src/poi.c gpsdrive-2.10~pre4/src/poi.c
+--- gpsdrive-2.10~pre4~/src/poi.c 2007-09-15 15:12:03.000000000 +0000
++++ gpsdrive-2.10~pre4/src/poi.c 2007-10-03 12:18:30.000000000 +0000
+@@ -907,6 +907,10 @@
+ g_strlcpy(t_description, t_desc_en, sizeof(t_description));
+ if (strcmp(t_title, "n/a")==0)
+ g_strlcpy(t_title, t_title_en, sizeof(t_title));
++ /* if also no english title is available,
++ * use the poi_type_name as title */
++ if (strcmp(t_title, "n/a")==0)
++ g_strlcpy(t_title, t_name, sizeof(t_title));
+
+
+ g_strlcpy (poi_type_list[index].description,
diff --git a/debian/patches/50-scripts.dpatch b/debian/patches/50-scripts.dpatch
new file mode 100644
index 0000000..fd02f85
--- /dev/null
+++ b/debian/patches/50-scripts.dpatch
@@ -0,0 +1,31 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 50-scripts.dpatch by Andreas Putzo <andreas@putzo.net>
+##
+## DP: Fix path to osm.xml (Thanks Giovanni Mascellani)
+## DP: Fix bashism in examples/wpget.
+
+@DPATCH@
+diff -urNad gpsdrive-2.10~pre4~/scripts/mapnik/gpsdrive_mapnik_gentiles-in.py gpsdrive-2.10~pre4/scripts/mapnik/gpsdrive_mapnik_gentiles-in.py
+--- gpsdrive-2.10~pre4~/scripts/mapnik/gpsdrive_mapnik_gentiles-in.py 2007-09-15 15:11:59.000000000 +0000
++++ gpsdrive-2.10~pre4/scripts/mapnik/gpsdrive_mapnik_gentiles-in.py 2008-07-15 17:37:07.000000000 +0000
+@@ -166,7 +166,7 @@
+
+ home = os.environ['HOME']
+ data = "@DATA_DIR@/mapnik"
+- mapfile = data + "/osm.xml"
++ mapfile = home + "/.gpsdrive/osm.xml"
+ tile_dir = home + "/.gpsdrive/maps/mapnik/"
+ mapkoordfile = home + "/.gpsdrive/maps/map_koord.txt"
+
+diff -urNad gpsdrive-2.10~pre4~/scripts/wpget gpsdrive-2.10~pre4/scripts/wpget
+--- gpsdrive-2.10~pre4~/scripts/wpget 2007-09-14 21:47:07.000000000 +0000
++++ gpsdrive-2.10~pre4/scripts/wpget 2008-07-15 17:38:12.000000000 +0000
+@@ -32,7 +32,7 @@
+ done
+
+ opt=${opt:= -w}
+-if [[ ${#opt} != "3" && ${#opt} != "12" ]]; then
++if [ ${#opt} -ne 3 -a ${#opt} -ne 12 ]; then
+ echo "Usage: $0 [-r|--get-routes]|[-w|--get-waypts]|[-t|--get-tracks] [-d device|--device device]" >&2 ;
+ echo "defaults are: --get-waypts and --device /dev/gps" >&2 ;
+ exit 1 ;
diff --git a/debian/patches/60-sql.dpatch b/debian/patches/60-sql.dpatch
new file mode 100644
index 0000000..914491d
--- /dev/null
+++ b/debian/patches/60-sql.dpatch
@@ -0,0 +1,31 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 60-sql.dpatch by Andreas Putzo <andreas@putzo.net>
+##
+## DP: Moved remaining patches from 01old.dpatch.
+## DP: Fixed in upstream svn.
+
+@DPATCH@
+diff -urNad gpsdrive-2.10~pre4~/Documentation/README.SQL gpsdrive-2.10~pre4/Documentation/README.SQL
+--- gpsdrive-2.10~pre4~/Documentation/README.SQL 2007-09-14 21:47:42.000000000 +0000
++++ gpsdrive-2.10~pre4/Documentation/README.SQL 2007-10-03 17:04:32.000000000 +0000
+@@ -8,7 +8,7 @@
+ ----------
+
+ There is no MySQL needed for compiling, the needed library
+-libmysqlclient.so.10 will be loaded at runtime, if found.
++libmysqlclient.so will be loaded at runtime, if found.
+
+ Running and first initialization:
+ ---------------------------------
+diff -urNad gpsdrive-2.10~pre4~/src/gpsdrive.h gpsdrive-2.10~pre4/src/gpsdrive.h
+--- gpsdrive-2.10~pre4~/src/gpsdrive.h 2007-09-14 21:47:13.000000000 +0000
++++ gpsdrive-2.10~pre4/src/gpsdrive.h 2007-10-03 17:04:05.000000000 +0000
+@@ -247,7 +247,7 @@
+ const char *db,
+ unsigned int port,
+ const char *unix_socket,
+- unsigned int clientflag);
++ unsigned long clientflag);
+ void (*dl_mysql_close)(MYSQL *sock);
+ int (*dl_mysql_query)(MYSQL *mysql, const char *q);
+ my_ulonglong (*dl_mysql_affected_rows)(MYSQL *mysql);
diff --git a/debian/patches/70-perl.dpatch b/debian/patches/70-perl.dpatch
new file mode 100644
index 0000000..2fd023c
--- /dev/null
+++ b/debian/patches/70-perl.dpatch
@@ -0,0 +1,362 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 70-perl.dpatch by Andreas Putzo <andreas@putzo.net>
+##
+## DP: Move perl modules to Geo::Gpsdrive for now.
+
+@DPATCH@
+diff -urNad gpsdrive-2.10~pre4~/scripts/geoinfo.pl gpsdrive-2.10~pre4/scripts/geoinfo.pl
+--- gpsdrive-2.10~pre4~/scripts/geoinfo.pl 2007-09-15 15:11:59.000000000 +0000
++++ gpsdrive-2.10~pre4/scripts/geoinfo.pl 2008-01-08 23:15:25.000000000 +0000
+@@ -45,7 +45,7 @@
+ use IO::File;
+ use Pod::Usage;
+
+-use Utils::Debug;
++use Geo::Gpsdrive::Utils::Debug;
+
+ use Geo::Gpsdrive::DBFuncs;
+ use Geo::Gpsdrive::Utils;
+@@ -193,7 +193,7 @@
+ }
+
+ if ( $do_list_areas ) {
+- print Geo::Filter::Area->list_areas()."\n";
++ print Geo::Gpsdrive::Filter::Area->list_areas()."\n";
+ }
+
+ pod2usage(1) if $help;
+diff -urNad gpsdrive-2.10~pre4~/scripts/osm/perl_lib/Geo/Filter/Area.pm gpsdrive-2.10~pre4/scripts/osm/perl_lib/Geo/Filter/Area.pm
+--- gpsdrive-2.10~pre4~/scripts/osm/perl_lib/Geo/Filter/Area.pm 2007-09-14 21:47:52.000000000 +0000
++++ gpsdrive-2.10~pre4/scripts/osm/perl_lib/Geo/Filter/Area.pm 2008-01-08 23:15:25.000000000 +0000
+@@ -1,5 +1,5 @@
+ ##################################################################
+-package Geo::Filter::Area;
++package Geo::Gpsdrive::Filter::Area;
+ ##################################################################
+
+ use strict;
+@@ -136,7 +136,7 @@
+
+ # ------------------------------------------------------------------
+
+-my $test_area = Geo::Filter::Area->new(area=>"uk");
++my $test_area = Geo::Gpsdrive::Filter::Area->new(area=>"uk");
+ if ( $test_area->inside({lat=>10,lon=>10})) {
+ Carp::confess("Area filters are not working\n");
+ };
+diff -urNad gpsdrive-2.10~pre4~/scripts/osm/perl_lib/Geo/GPX/File.pm gpsdrive-2.10~pre4/scripts/osm/perl_lib/Geo/GPX/File.pm
+--- gpsdrive-2.10~pre4~/scripts/osm/perl_lib/Geo/GPX/File.pm 2007-09-14 21:47:52.000000000 +0000
++++ gpsdrive-2.10~pre4/scripts/osm/perl_lib/Geo/GPX/File.pm 2008-01-08 23:15:25.000000000 +0000
+@@ -1,5 +1,5 @@
+ ##################################################################
+-package Geo::GPX::File;
++package Geo::Gpsdrive::GPX::File;
+ ##################################################################
+
+ use Exporter;
+@@ -18,10 +18,10 @@
+ use Date::Manip;
+ use POSIX qw(strftime);
+
+-use Geo::Geometry;
+-use Utils::File;
+-use Utils::Math;
+-use Utils::Debug;
++use Geo::Gpsdrive::Geometry;
++use Geo::Gpsdrive::Utils::File;
++use Geo::Gpsdrive::Utils::Math;
++use Geo::Gpsdrive::Utils::Debug;
+
+ # -----------------------------------------------------------------------------
+ # Read GPS Data from GPX - File
+diff -urNad gpsdrive-2.10~pre4~/scripts/osm/perl_lib/Geo/Geometry.pm gpsdrive-2.10~pre4/scripts/osm/perl_lib/Geo/Geometry.pm
+--- gpsdrive-2.10~pre4~/scripts/osm/perl_lib/Geo/Geometry.pm 2007-09-14 21:47:52.000000000 +0000
++++ gpsdrive-2.10~pre4/scripts/osm/perl_lib/Geo/Geometry.pm 2008-01-08 23:15:25.000000000 +0000
+@@ -1,5 +1,5 @@
+ ##################################################################
+-package Geo::Geometry;
++package Geo::Gpsdrive::Geometry;
+ ##################################################################
+
+ use strict;
+@@ -16,9 +16,9 @@
+
+ use Math::Trig;
+
+-use Utils::File;
+-use Utils::Math;
+-use Utils::Debug;
++use Geo::Gpsdrive::Utils::File;
++use Geo::Gpsdrive::Utils::Math;
++use Geo::Gpsdrive::Utils::Debug;
+
+ # ------------------------------------------------------------------
+ # Distance in Km between 2 geo points with lat/lon
+diff -urNad gpsdrive-2.10~pre4~/scripts/osm/perl_lib/Geo/Gpsdrive/OSM.pm gpsdrive-2.10~pre4/scripts/osm/perl_lib/Geo/Gpsdrive/OSM.pm
+--- gpsdrive-2.10~pre4~/scripts/osm/perl_lib/Geo/Gpsdrive/OSM.pm 2008-01-08 23:15:22.000000000 +0000
++++ gpsdrive-2.10~pre4/scripts/osm/perl_lib/Geo/Gpsdrive/OSM.pm 2008-01-08 23:16:55.000000000 +0000
+@@ -13,16 +13,15 @@
+ use File::Path;
+ use Geo::Gpsdrive::DBFuncs;
+ use Geo::Gpsdrive::Utils;
+-use Geo::OSM::Planet;
++use Geo::Gpsdrive::OSM::Planet;
+ use Data::Dumper;
+ use XML::Parser;
+ use XML::Simple;
+-use Geo::Filter::Area;
+-use Geo::OSM::Planet;
+-use Utils::Debug;
+-use Utils::File;
+-use Utils::LWP::Utils;
+-use Utils::Math;
++use Geo::Gpsdrive::Filter::Area;
++use Geo::Gpsdrive::Utils::Debug;
++use Geo::Gpsdrive::Utils::File;
++use Geo::Gpsdrive::Utils::LWP::Utils;
++use Geo::Gpsdrive::Utils::Math;
+
+ our $OSM_polite = 10; # Wait n times as long as the request lasted
+ our $AREA_FILTER;
+@@ -411,7 +410,7 @@
+
+ my $start_time=time();
+
+- $AREA_FILTER = Geo::Filter::Area->new( area => $area_name );
++ $AREA_FILTER = Geo::Gpsdrive::Filter::Area->new( area => $area_name );
+
+ print("\rReading $file_name for $area_name\n") if $VERBOSE || $debug;
+ print "$file_name: ".(-s $file_name)." Bytes\n" if $debug;
+diff -urNad gpsdrive-2.10~pre4~/scripts/osm/perl_lib/Geo/OSM/Planet.pm gpsdrive-2.10~pre4/scripts/osm/perl_lib/Geo/OSM/Planet.pm
+--- gpsdrive-2.10~pre4~/scripts/osm/perl_lib/Geo/OSM/Planet.pm 2007-09-15 01:24:19.000000000 +0000
++++ gpsdrive-2.10~pre4/scripts/osm/perl_lib/Geo/OSM/Planet.pm 2008-01-08 23:15:25.000000000 +0000
+@@ -1,5 +1,5 @@
+ ##################################################################
+-package Geo::OSM::Planet;
++package Geo::Gpsdrive::OSM::Planet;
+ ##################################################################
+
+ use Exporter;
+@@ -26,9 +26,9 @@
+ use Storable ();
+ use Data::Dumper;
+
+-use Utils::File;
+-use Utils::Debug;
+-use Utils::LWP::Utils;
++use Geo::Gpsdrive::Utils::File;
++use Geo::Gpsdrive::Utils::Debug;
++use Geo::Gpsdrive::Utils::LWP::Utils;
+
+
+ # As of planet-061220
+diff -urNad gpsdrive-2.10~pre4~/scripts/osm/perl_lib/Geo/Tracks/GpsBabel.pm gpsdrive-2.10~pre4/scripts/osm/perl_lib/Geo/Tracks/GpsBabel.pm
+--- gpsdrive-2.10~pre4~/scripts/osm/perl_lib/Geo/Tracks/GpsBabel.pm 2007-09-14 21:47:52.000000000 +0000
++++ gpsdrive-2.10~pre4/scripts/osm/perl_lib/Geo/Tracks/GpsBabel.pm 2008-01-08 23:15:25.000000000 +0000
+@@ -1,5 +1,5 @@
+ ##################################################################
+-package Geo::Tracks::GpsBabel;
++package Geo::Gpsdrive::Tracks::GpsBabel;
+ ##################################################################
+
+ use Exporter;
+@@ -11,11 +11,11 @@
+ use warnings;
+ use IO::File;
+
+-use Geo::Geometry;
+-use Utils::File;
+-use Utils::Math;
+-use Utils::Debug;
+-use Geo::GPX::File;
++use Geo::Gpsdrive::Geometry;
++use Geo::Gpsdrive::Utils::File;
++use Geo::Gpsdrive::Utils::Math;
++use Geo::Gpsdrive::Utils::Debug;
++use Geo::Gpsdrive::GPX::File;
+
+
+ # -----------------------------------------------------------------------------
+diff -urNad gpsdrive-2.10~pre4~/scripts/osm/perl_lib/Geo/Tracks/Kismet.pm gpsdrive-2.10~pre4/scripts/osm/perl_lib/Geo/Tracks/Kismet.pm
+--- gpsdrive-2.10~pre4~/scripts/osm/perl_lib/Geo/Tracks/Kismet.pm 2007-09-14 21:47:52.000000000 +0000
++++ gpsdrive-2.10~pre4/scripts/osm/perl_lib/Geo/Tracks/Kismet.pm 2008-01-08 23:15:25.000000000 +0000
+@@ -1,5 +1,5 @@
+ ##################################################################
+-package Geo::Tracks::Kismet;
++package Geo::Gpsdrive::Tracks::Kismet;
+ ##################################################################
+
+ use Exporter;
+@@ -15,10 +15,10 @@
+ use Data::Dumper;
+
+ use Data::Dumper;
+-use Geo::Geometry;
+-use Utils::Debug;
+-use Utils::File;
+-use Utils::Math;
++use Geo::Gpsdrive::Geometry;
++use Geo::Gpsdrive::Utils::Debug;
++use Geo::Gpsdrive::Utils::File;
++use Geo::Gpsdrive::Utils::Math;
+
+ # -----------------------------------------------------------------------------
+ # Read GPS Data from Kismet File
+@@ -61,7 +61,7 @@
+ }
+ my $track=[];
+ for my $elem ( @{$content->[0]->{Kids}} ) {
+- next unless ref($elem) eq "Geo::Tracks::Kismet::gps-point";
++ next unless ref($elem) eq "Geo::Gpsdrive::Tracks::Kismet::gps-point";
+ next unless $elem->{'bssid'} eq 'GP:SD:TR:AC:KL:OG';
+ delete $elem->{Kids};
+ if ( defined($elem->{"time-sec"}) && defined($elem->{"time-usec"}) ) {
+diff -urNad gpsdrive-2.10~pre4~/scripts/osm/perl_lib/Geo/Tracks/NMEA.pm gpsdrive-2.10~pre4/scripts/osm/perl_lib/Geo/Tracks/NMEA.pm
+--- gpsdrive-2.10~pre4~/scripts/osm/perl_lib/Geo/Tracks/NMEA.pm 2007-09-14 21:47:52.000000000 +0000
++++ gpsdrive-2.10~pre4/scripts/osm/perl_lib/Geo/Tracks/NMEA.pm 2008-01-08 23:15:25.000000000 +0000
+@@ -1,5 +1,5 @@
+ ##################################################################
+-package Geo::Tracks::NMEA;
++package Geo::Gpsdrive::Tracks::NMEA;
+ ##################################################################
+
+ use Exporter;
+@@ -16,10 +16,10 @@
+ use IO::File;
+ use Math::Trig;
+
+-use Geo::Geometry;
+-use Utils::Debug;
+-use Utils::File;
+-use Utils::Math;
++use Geo::Gpsdrive::Geometry;
++use Geo::Gpsdrive::Utils::Debug;
++use Geo::Gpsdrive::Utils::File;
++use Geo::Gpsdrive::Utils::Math;
+
+ # -----------------------------------------------------------------------------
+ # Read GPS Data from NMEA - File
+diff -urNad gpsdrive-2.10~pre4~/scripts/osm/perl_lib/Geo/Tracks/TRK.pm gpsdrive-2.10~pre4/scripts/osm/perl_lib/Geo/Tracks/TRK.pm
+--- gpsdrive-2.10~pre4~/scripts/osm/perl_lib/Geo/Tracks/TRK.pm 2007-09-14 21:47:52.000000000 +0000
++++ gpsdrive-2.10~pre4/scripts/osm/perl_lib/Geo/Tracks/TRK.pm 2008-01-08 23:15:25.000000000 +0000
+@@ -1,5 +1,5 @@
+ ##################################################################
+-package Geo::Tracks::TRK;
++package Geo::Gpsdrive::Tracks::TRK;
+ ##################################################################
+
+ use Exporter;
+@@ -12,9 +12,9 @@
+
+ use Data::Dumper;
+ use IO::File;
+-use Utils::Debug;
+-use Utils::File;
+-use Utils::Math;
++use Geo::Gpsdrive::Utils::Debug;
++use Geo::Gpsdrive::Utils::File;
++use Geo::Gpsdrive::Utils::Math;
+ use Date::Manip;
+ use Date::Parse;
+ use Time::Local;
+diff -urNad gpsdrive-2.10~pre4~/scripts/osm/perl_lib/Geo/Tracks/Tools.pm gpsdrive-2.10~pre4/scripts/osm/perl_lib/Geo/Tracks/Tools.pm
+--- gpsdrive-2.10~pre4~/scripts/osm/perl_lib/Geo/Tracks/Tools.pm 2007-09-14 21:47:52.000000000 +0000
++++ gpsdrive-2.10~pre4/scripts/osm/perl_lib/Geo/Tracks/Tools.pm 2008-01-08 23:15:25.000000000 +0000
+@@ -1,5 +1,5 @@
+ ##################################################################
+-package Geo::Tracks::Tools;
++package Geo::Gpsdrive::Tracks::Tools;
+ ##################################################################
+
+ use Exporter;
+@@ -23,10 +23,10 @@
+ use warnings;
+ use Carp;
+
+-use Geo::Geometry;
+-use Utils::File;
+-use Utils::Math;
+-use Utils::Debug;
++use Geo::Gpsdrive::Geometry;
++use Geo::Gpsdrive::Utils::File;
++use Geo::Gpsdrive::Utils::Math;
++use Geo::Gpsdrive::Utils::Debug;
+
+ # Copy the track structure
+ sub copy_track_structure($$){
+@@ -364,7 +364,7 @@
+
+ =head1 NAME
+
+-Geo::Tracks::Tools
++Geo::Gpsdrive::Tracks::Tools
+
+ =head1 COPYRIGHT
+
+diff -urNad gpsdrive-2.10~pre4~/scripts/osm/perl_lib/Utils/Debug.pm gpsdrive-2.10~pre4/scripts/osm/perl_lib/Utils/Debug.pm
+--- gpsdrive-2.10~pre4~/scripts/osm/perl_lib/Utils/Debug.pm 2007-09-14 21:47:52.000000000 +0000
++++ gpsdrive-2.10~pre4/scripts/osm/perl_lib/Utils/Debug.pm 2008-01-08 23:15:25.000000000 +0000
+@@ -1,5 +1,5 @@
+ ##################################################################
+-package Utils::Debug;
++package Geo::Gpsdrive::Utils::Debug;
+ ##################################################################
+
+ use Exporter;
+@@ -19,7 +19,7 @@
+ use warnings;
+
+ use IO::File;
+-use Utils::Math;
++use Geo::Gpsdrive::Utils::Math;
+
+
+ # print the time elapsed since starting
+diff -urNad gpsdrive-2.10~pre4~/scripts/osm/perl_lib/Utils/File.pm gpsdrive-2.10~pre4/scripts/osm/perl_lib/Utils/File.pm
+--- gpsdrive-2.10~pre4~/scripts/osm/perl_lib/Utils/File.pm 2007-09-14 21:47:52.000000000 +0000
++++ gpsdrive-2.10~pre4/scripts/osm/perl_lib/Utils/File.pm 2008-01-08 23:15:25.000000000 +0000
+@@ -1,5 +1,5 @@
+ ##################################################################
+-package Utils::File;
++package Geo::Gpsdrive::Utils::File;
+ ##################################################################
+
+ use Exporter;
+@@ -15,7 +15,7 @@
+ use warnings;
+
+ use IO::File;
+-use Utils::Debug;
++use Geo::Gpsdrive::Utils::Debug;
+
+ use File::Basename;
+ use File::Copy;
+diff -urNad gpsdrive-2.10~pre4~/scripts/osm/perl_lib/Utils/LWP/Utils.pm gpsdrive-2.10~pre4/scripts/osm/perl_lib/Utils/LWP/Utils.pm
+--- gpsdrive-2.10~pre4~/scripts/osm/perl_lib/Utils/LWP/Utils.pm 2007-09-14 21:47:52.000000000 +0000
++++ gpsdrive-2.10~pre4/scripts/osm/perl_lib/Utils/LWP/Utils.pm 2008-01-08 23:15:25.000000000 +0000
+@@ -1,5 +1,5 @@
+ ##################################################################
+-package Utils::LWP::Utils;
++package Geo::Gpsdrive::Utils::LWP::Utils;
+ ##################################################################
+
+ use Exporter;
+@@ -14,7 +14,7 @@
+
+ use LWP::UserAgent;
+
+-use Utils::Debug;
++use Geo::Gpsdrive::Utils::Debug;
+
+ our $PROXY='';
+
+diff -urNad gpsdrive-2.10~pre4~/scripts/osm/perl_lib/Utils/Math.pm gpsdrive-2.10~pre4/scripts/osm/perl_lib/Utils/Math.pm
+--- gpsdrive-2.10~pre4~/scripts/osm/perl_lib/Utils/Math.pm 2007-09-14 21:47:52.000000000 +0000
++++ gpsdrive-2.10~pre4/scripts/osm/perl_lib/Utils/Math.pm 2008-01-08 23:15:25.000000000 +0000
+@@ -1,5 +1,5 @@
+ ##################################################################
+-package Utils::Math;
++package Geo::Gpsdrive::Utils::Math;
+ ##################################################################
+
+ use strict;
diff --git a/debian/patches/80-dbus.dpatch b/debian/patches/80-dbus.dpatch
new file mode 100644
index 0000000..d24ae45
--- /dev/null
+++ b/debian/patches/80-dbus.dpatch
@@ -0,0 +1,109 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 80-dbus.dpatch by Andreas Putzo <andreas@putzo.net>
+##
+## DP: Fix DBUS support
+
+@DPATCH@
+diff -urNad gpsdrive-2.10~pre4~/src/gps_handler.c gpsdrive-2.10~pre4/src/gps_handler.c
+--- gpsdrive-2.10~pre4~/src/gps_handler.c 2007-09-14 21:47:13.000000000 +0000
++++ gpsdrive-2.10~pre4/src/gps_handler.c 2007-12-17 22:38:52.000000000 +0000
+@@ -371,6 +371,7 @@
+ {
+ struct tm time;
+ time_t ttime;
++ double direction;
+
+ if (!early && (dbus_current_fix.mode==-1)) {
+ /* We have handled this one, so clean the mode and bail out */
+@@ -416,10 +417,10 @@
+ coords.current_lon = dbus_current_fix.longitude;
+ /* Handle speed */
+ if (__finite(dbus_current_fix.speed))
+- groundspeed = dbus_current_fix.speed * 3.6; // Convert m/s to km/h
++ current.groundspeed = dbus_current_fix.speed * 3.6; // Convert m/s to km/h
+ else if (dbus_old_fix.mode>1) {
+ gdouble timediff = dbus_current_fix.time-dbus_old_fix.time;
+- groundspeed = (timediff>0)?(calcdist2(dbus_old_fix.longitude, dbus_old_fix.latitude) * 3600 / timediff) : 0.0;
++ current.groundspeed = (timediff>0)?(calcdist2(dbus_old_fix.longitude, dbus_old_fix.latitude) * 3600 / timediff) : 0.0;
+ }
+ /* Handle bearing */
+ if (__finite(dbus_current_fix.track))
+@@ -435,7 +436,7 @@
+ }
+ if ( mydebug + gps_handler_debug > 80 )
+ g_print("gps_handler: DBUS fix: %6.0f %10.6f/%10.6f sp:%5.2f(%5.2f) crs:%5.1f(%5.2f)\n", dbus_current_fix.time,
+- dbus_current_fix.latitude, dbus_current_fix.longitude, dbus_current_fix.speed, groundspeed,
++ dbus_current_fix.latitude, dbus_current_fix.longitude, dbus_current_fix.speed, current.groundspeed,
+ dbus_current_fix.track, direction * 180 / M_PI);
+ /* Handle altitude */
+ if (dbus_current_fix.mode>2) {
+@@ -453,46 +454,31 @@
+ }
+
+ static DBusHandlerResult dbus_handle_gps_fix (DBusMessage* message) {
+- DBusMessageIter iter;
+- //double temp_time;
+- //char b[100];
++
++ DBusError error;
++ double temp_time;
+ struct dbus_gps_fix fix;
+- //gint32 mode;
+- //gdouble dump;
+-
+- if (!dbus_message_iter_init (message, &iter)) {
+- /* we have a problem */
+- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+- }
+
+- /* Fill the fix struct */
+- fix.time = floor(dbus_message_iter_get_double (&iter));
+- dbus_message_iter_next (&iter);
+- fix.mode = dbus_message_iter_get_int32 (&iter);
+- dbus_message_iter_next (&iter);
+- fix.ept = dbus_message_iter_get_double (&iter);
+- dbus_message_iter_next (&iter);
+- fix.latitude = dbus_message_iter_get_double (&iter);
+- dbus_message_iter_next (&iter);
+- fix.longitude = dbus_message_iter_get_double (&iter);
+- dbus_message_iter_next (&iter);
+- fix.eph = dbus_message_iter_get_double (&iter);
+- dbus_message_iter_next (&iter);
+- fix.altitude = dbus_message_iter_get_double (&iter);
+- dbus_message_iter_next (&iter);
+- fix.epv = dbus_message_iter_get_double (&iter);
+- dbus_message_iter_next (&iter);
+- fix.track = dbus_message_iter_get_double (&iter);
+- dbus_message_iter_next (&iter);
+- fix.epd = dbus_message_iter_get_double (&iter);
+- dbus_message_iter_next (&iter);
+- fix.speed = dbus_message_iter_get_double (&iter);
+- dbus_message_iter_next (&iter);
+- fix.eps = dbus_message_iter_get_double (&iter);
+- dbus_message_iter_next (&iter);
+- fix.climb = dbus_message_iter_get_double (&iter);
+- dbus_message_iter_next (&iter);
+- fix.epc = dbus_message_iter_get_double (&iter);
++ dbus_error_init(&error);
++
++ dbus_message_get_args(message,
++ &error,
++ DBUS_TYPE_DOUBLE, &temp_time,
++ DBUS_TYPE_INT32, &fix.mode,
++ DBUS_TYPE_DOUBLE, &fix.ept,
++ DBUS_TYPE_DOUBLE, &fix.latitude,
++ DBUS_TYPE_DOUBLE, &fix.longitude,
++ DBUS_TYPE_DOUBLE, &fix.eph,
++ DBUS_TYPE_DOUBLE, &fix.altitude,
++ DBUS_TYPE_DOUBLE, &fix.epv,
++ DBUS_TYPE_DOUBLE, &fix.track,
++ DBUS_TYPE_DOUBLE, &fix.epd,
++ DBUS_TYPE_DOUBLE, &fix.speed,
++ DBUS_TYPE_DOUBLE, &fix.eps,
++ DBUS_TYPE_DOUBLE, &fix.climb,
++ DBUS_TYPE_DOUBLE, &fix.epc,
++ DBUS_TYPE_INVALID);
++ fix.time = floor(temp_time);
+
+ if ( mydebug + gps_handler_debug > 80 ) {
+ g_print("gps_handler: DBUS raw: ti:%6.0f mode:%d ept:%f %10.6f/%10.6f eph:%f\n", fix.time, fix.mode, fix.ept, fix.latitude, fix.longitude, fix.eph);
diff --git a/debian/patches/85-settings.dpatch b/debian/patches/85-settings.dpatch
new file mode 100644
index 0000000..5278d49
--- /dev/null
+++ b/debian/patches/85-settings.dpatch
@@ -0,0 +1,26 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 85-settings.dpatch by Andreas Putzo <andreas@putzo.net>
+##
+## DP: Use basename() for way.txt. Don't rely on a '/' in gpsdriverc
+
+@DPATCH@
+diff -urNad gpsdrive-2.10~pre4~/src/settings.c gpsdrive-2.10~pre4/src/settings.c
+--- gpsdrive-2.10~pre4~/src/settings.c 2007-09-15 15:12:03.000000000 +0000
++++ gpsdrive-2.10~pre4/src/settings.c 2008-01-14 23:18:38.000000000 +0000
+@@ -32,6 +32,7 @@
+ #include <stdio.h>
+ #include <signal.h>
+ #include <unistd.h>
++#include <dirent.h>
+ #include <sys/mman.h>
+ #include <math.h>
+ #include "poi.h"
+@@ -1763,7 +1764,7 @@
+ /* waypoints quick select */
+ {
+ g_strlcpy (path, local_config.dir_home, sizeof (path));
+- current_wpfile = g_strrstr (local_config.wp_file, "/") + 1;
++ current_wpfile = basename (local_config.wp_file);
+ names = g_new (namesstruct, 102);
+ d = opendir (path);
+ if (NULL != d)
diff --git a/debian/patches/90-usage.dpatch b/debian/patches/90-usage.dpatch
new file mode 100644
index 0000000..63c7245
--- /dev/null
+++ b/debian/patches/90-usage.dpatch
@@ -0,0 +1,48 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 90-usage.dpatch by Andreas Putzo <andreas@putzo.net>
+##
+## DP: Correct usage() output.
+
+@DPATCH@
+diff -urNad gpsdrive-2.10~pre4~/src/gpsdrive.c gpsdrive-2.10~pre4/src/gpsdrive.c
+--- gpsdrive-2.10~pre4~/src/gpsdrive.c 2007-12-18 22:08:34.000000000 +0000
++++ gpsdrive-2.10~pre4/src/gpsdrive.c 2007-12-18 22:09:55.000000000 +0000
+@@ -2738,30 +2738,27 @@
+ _("-D X set debug Level to X\n"),
+ _("-T do some internal unit Tests(don't start gpsdrive)\n"),
+ _("-e use Festival-Lite (flite) for speech output\n"),
+- _("-o serial device, pty master, or file for NMEA *output*\n"),
+- _("-f X Select friends server, X is i.e. friendsd.gpsdrive.de\n"),
++ _("-o thing serial device, pty master, or file for NMEA *output*\n"),
++ _("-f server Select friends server, X is i.e. friendsd.gpsdrive.de\n"),
+ #ifdef DBUS_ENABLE
+ _("-X Use DBUS for communication with gpsd. This disables serial and socket communication\n"),
+ #endif
+- _("-l LANG Select language of the voice,\n"
+- " LANG may be english, spanish or german\n"),
+- _("-s HEIGHT set height of the screen, if autodetection\n"
+- " don't satisfy you, X is i.e. 768,600,480,200\n"),
+- _("-r WIDTH set width of the screen, only with -s\n"),
++ _("-l lang. Select language of the voice,\n"
++ " language may be 'english', 'spanish' or 'german'\n"),
++ _("-g geom. set window geometry, e.g. 800x600\n"),
+ _("-1 have only 1 button mouse, for example using touchscreen\n"),
+ _("-a display APM Stuff ( battery status, Temperature)\n"),
+ _("-b Server Servername for NMEA server (if gpsd runs on another host)\n"),
+ _("-c WP set start position in simulation mode to waypoint name WP\n"),
+- _("-x create separate window for menu\n"),
+- _("-M mode set guimode to desktop, pda or car\n"),
++ _("-M mode set GUI mode; mode may be 'desktop' (default), 'pda' or 'car'\n"),
+ _("-i ignore NMEA checksum (risky, only for broken GPS receivers\n"),
+ _("-q disable SQL support\n"),
+ _("-F force display of position even it is invalid\n"),
+ _("-S don't show splash screen\n"),
+- _("-P start in Pos Mode\n"),
++ _("-P start in Position Mode\n"),
+ _("-W x set x to 1 to switch WAAS/EGNOS on, set to 0 to switch off\n"),
+ _("-H ALT correct altitude, adding this value (ALT) to altitude\n"),
+- _("-C file set config file (--config-file)\n"));
++ _("-C file set config file (--config-file)\n"));
+
+ }
+
diff --git a/debian/patches/95-newapi.dpatch b/debian/patches/95-newapi.dpatch
new file mode 100644
index 0000000..e500c06
--- /dev/null
+++ b/debian/patches/95-newapi.dpatch
@@ -0,0 +1,18 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 95-newapi.dpatch by Francesco Paolo Lovergine <frankie@debian.org>
+##
+## DP: Use new api method to register fonts.
+
+@DPATCH@
+diff -urNad gpsdrive-2.10~pre4~/src/mapnik.cpp gpsdrive-2.10~pre4/src/mapnik.cpp
+--- gpsdrive-2.10~pre4~/src/mapnik.cpp 2008-02-20 14:27:41.000000000 +0100
++++ gpsdrive-2.10~pre4/src/mapnik.cpp 2008-02-20 14:28:04.000000000 +0100
+@@ -119,7 +119,7 @@
+
+ datasource_cache::instance()->register_datasources("/usr/lib/mapnik/input/");
+ // XXX We should make the fontname and path a config option
+- freetype_engine::instance()->register_font("/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf");
++ freetype_engine::register_font("/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf");
+
+
+ MapnikMap.WidthInt = 1280;
diff --git a/debian/patches/96-mapnik-plugins-dir.dpatch b/debian/patches/96-mapnik-plugins-dir.dpatch
new file mode 100644
index 0000000..3abaf96
--- /dev/null
+++ b/debian/patches/96-mapnik-plugins-dir.dpatch
@@ -0,0 +1,29 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 96-mapnik-plugins-dir.dpatch by Francesco Paolo Lovergine <frankie@debian.org>
+##
+## DP: Use correct mapnik path on debian systems.
+
+@DPATCH@
+diff -urNad gpsdrive-2.10~pre4-6.dfsg~/src/mapnik.cpp gpsdrive-2.10~pre4-6.dfsg/src/mapnik.cpp
+--- gpsdrive-2.10~pre4-6.dfsg~/src/mapnik.cpp 2009-06-11 19:23:32.000000000 +0000
++++ gpsdrive-2.10~pre4-6.dfsg/src/mapnik.cpp 2009-06-11 19:23:32.000000000 +0000
+@@ -108,6 +108,10 @@
+ return StringToReplace;
+ }
+
++#if !defined(MAPNIK_PATH)
++#define MAPNIK_PATH "/usr/lib/mapnik/0.6"
++#endif
++
+ /*
+ * initialize mapnik
+ */
+@@ -117,7 +121,7 @@
+ // register datasources (plug-ins) and a font
+ // Both datasorce_cache and font_engine are 'singletons'.
+
+- datasource_cache::instance()->register_datasources("/usr/lib/mapnik/input/");
++ datasource_cache::instance()->register_datasources( MAPNIK_PATH "/input/");
+ // XXX We should make the fontname and path a config option
+ freetype_engine::register_font("/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf");
+
diff --git a/debian/patches/97-osmxml.dpatch b/debian/patches/97-osmxml.dpatch
new file mode 100644
index 0000000..0ca6228
--- /dev/null
+++ b/debian/patches/97-osmxml.dpatch
@@ -0,0 +1,82 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 97-osmxml.dpatch by Andreas Putzo <andreas@putzo.net>
+##
+## DP: Fix hexadecimal color.
+## DP: Comment world_boundaries by default.
+
+@DPATCH@
+diff -urNad gpsdrive-2.10~pre4~/scripts/mapnik/osm-in.xml gpsdrive-2.10~pre4/scripts/mapnik/osm-in.xml
+--- gpsdrive-2.10~pre4~/scripts/mapnik/osm-in.xml 2008-02-29 09:01:17.000000000 +0000
++++ gpsdrive-2.10~pre4/scripts/mapnik/osm-in.xml 2008-02-29 09:01:58.000000000 +0000
+@@ -1,5 +1,11 @@
+ <?xml version="1.0" encoding="utf-8"?>
+ <!DOCTYPE Map>
++
++<!-- world_boundaries are disabled by default.
++ See commented BLOCK below.
++-->
++
++
+ <Map bgcolor="#b5d0d0" srs="+proj=merc +datum=WGS84 +k=1.0 +units=m +over +no_defs">
+ <Style name="mapnik:selection">
+ <Rule>
+@@ -346,7 +352,7 @@
+ <Filter>[amenity] = 'parking'</Filter>
+ <MaxScaleDenominator>25000</MaxScaleDenominator>
+ <LineSymbolizer>
+- <CssParameter name="stroke">eeeed1</CssParameter>
++ <CssParameter name="stroke">#eeeed1</CssParameter>
+ <CssParameter name="stroke-width">0.3</CssParameter>
+ </LineSymbolizer>
+ </Rule>
+@@ -1637,6 +1643,9 @@
+ </Rule>
+ </Style>
+
++
++<!-- BEGIN WORLD_BOUNDARIES BLOCK Uncomment this part if you have world_boundaries installed
++
+ <Layer name="world-1" status="on" srs="+proj=merc +datum=WGS84 +over">
+ <StyleName>world-1</StyleName>
+ <Datasource>
+@@ -1677,7 +1686,18 @@
+ <Parameter name="file">@DATA_DIR@/world_boundaries/builtup_area</Parameter>
+ </Datasource>
+ </Layer>
+-
++
++ <Layer name="places" status="on">
++ <StyleName>places</StyleName>
++ <Datasource>
++ <Parameter name="type">shape</Parameter>
++ <Parameter name="file">@DATA_DIR@/world_boundaries/places</Parameter>
++ </Datasource>
++ </Layer>
++
++END WORLD BOUNDARIES BLOCK -->
++
++
+ <Layer name="leisure" status="on" srs="+proj=merc +datum=WGS84 +k=1.0 +units=m +over +no_defs">
+ <StyleName>leisure</StyleName>
+ <Datasource>
+@@ -1729,7 +1749,6 @@
+ </Layer>
+
+ <Layer name="roads" status="on" srs="+proj=merc +datum=WGS84 +k=1.0 +units=m +over +no_defs">
+- <!--StyleName>roads-casing</StyleName-->
+ <StyleName>roads</StyleName>
+ <Datasource>
+ <Parameter name="type">postgis</Parameter>
+@@ -1781,12 +1800,4 @@
+ <Parameter name="estimate_extent">true</Parameter>
+ </Datasource>
+ </Layer>
+-
+- <Layer name="places" status="on">
+- <StyleName>places</StyleName>
+- <Datasource>
+- <Parameter name="type">shape</Parameter>
+- <Parameter name="file">@DATA_DIR@/world_boundaries/places</Parameter>
+- </Datasource>
+- </Layer>
+ </Map>
diff --git a/debian/patches/98-mapnik-exception.dpatch b/debian/patches/98-mapnik-exception.dpatch
new file mode 100644
index 0000000..6dd5a1c
--- /dev/null
+++ b/debian/patches/98-mapnik-exception.dpatch
@@ -0,0 +1,51 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 98-mapnik-exception.dpatch by Andreas Putzo <andreas@putzo.net>
+##
+## DP: Add exception handling for mapnik config file loading.
+
+@DPATCH@
+diff -urNad gpsdrive-2.10~pre4~/src/mapnik.cpp gpsdrive-2.10~pre4/src/mapnik.cpp
+--- gpsdrive-2.10~pre4~/src/mapnik.cpp 2008-02-28 23:37:07.000000000 +0000
++++ gpsdrive-2.10~pre4/src/mapnik.cpp 2008-02-28 23:37:46.000000000 +0000
+@@ -23,6 +23,7 @@
+ #include <mapnik/memory_datasource.hpp>
+ #include <mapnik/datasource_cache.hpp>
+ #include <mapnik/font_engine_freetype.hpp>
++#include <mapnik/config_error.hpp>
+ #include <string>
+ #include <fstream>
+
+@@ -37,6 +38,7 @@
+ using mapnik::feature_ptr;
+ using mapnik::geometry_ptr;
+ using mapnik::CoordTransform;
++using mapnik::config_error;
+
+ extern int mydebug;
+ extern int borderlimit;
+@@ -131,11 +133,22 @@
+ MapnikMap.BorderlimitInt = borderlimit;
+ MapnikMap.ScaleInt = -1; // <-- force creation of map if a map is set
+ MapnikMap.MapPtr = new mapnik::Map(MapnikMap.WidthInt, MapnikMap.HeightInt);
++
+
+ //load map
+- std::string mapnik_config_file (ConfigXML);
+- mapnik::load_map(*MapnikMap.MapPtr, mapnik_config_file);
+- MapnikInitYsn = -1;
++ try {
++ std::string mapnik_config_file (ConfigXML);
++ mapnik::load_map(*MapnikMap.MapPtr, mapnik_config_file);
++ MapnikInitYsn = -1;
++ }
++ catch(const mapnik::config_error &ex) {
++ cerr << "Cannot init mapnik. Mapnik support DISABLED: " << ex.what() << "\n" << endl;
++ cerr << "Mapnik now raises exceptions on syntax errors in the map file,\n" <<
++ "failed db connections, missing files, etc.\n" <<
++ "Please fix or remove ~/.gpsdrive/osm.xml.\n" <<
++ "See also NEWS.Debian." << endl;
++ MapnikInitYsn = 0;
++ }
+ }
+
+ /*
diff --git a/debian/patches/99-autobestmap.dpatch b/debian/patches/99-autobestmap.dpatch
new file mode 100644
index 0000000..d0fc7db
--- /dev/null
+++ b/debian/patches/99-autobestmap.dpatch
@@ -0,0 +1,26 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 99-autobestmap.dpatch by Andreas Putzo <andreas@putzo.net>
+##
+## DP: The autobestmap config option is not updated when using the toggle button
+## DP: in gpsdrive. Patch backported from 2.10pre5.
+
+@DPATCH@
+diff -urNad gpsdrive-2.10~pre4~/src/main_gui.c gpsdrive-2.10~pre4/src/main_gui.c
+--- gpsdrive-2.10~pre4~/src/main_gui.c 2007-09-15 15:12:03.000000000 +0000
++++ gpsdrive-2.10~pre4/src/main_gui.c 2008-07-15 19:48:34.000000000 +0000
+@@ -229,6 +229,7 @@
+ gtk_label_set_text (GTK_LABEL (statusprefscale_lb), _("Auto"));
+ if (mapscaler_scaler)
+ gtk_widget_set_sensitive (mapscaler_scaler, FALSE);
++ local_config.autobestmap = TRUE;
+ }
+ else
+ {
+@@ -238,6 +239,7 @@
+ gtk_label_set_text (GTK_LABEL (statusprefscale_lb), sc);
+ if (mapscaler_scaler)
+ gtk_widget_set_sensitive (mapscaler_scaler, TRUE);
++ local_config.autobestmap = FALSE;
+ }
+
+ current.needtosave = TRUE;
diff --git a/debian/patches/gpsdrive2.10pre7_osm_proj.patch b/debian/patches/gpsdrive2.10pre7_osm_proj.patch
new file mode 100644
index 0000000..4d529cb
--- /dev/null
+++ b/debian/patches/gpsdrive2.10pre7_osm_proj.patch
@@ -0,0 +1,572 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## gpsdrive2.10pre7_osm_proj.patch by H. Bowman <hamish_b yahoo com>
+##
+## DP: Fix OpenStreetMap projection handling (backport from upstream)
+
+@DPATCH@
+Index: src/map_download.c
+===================================================================
+--- src/map_download.c (revision 2476)
++++ src/map_download.c (revision 2477)
+@@ -61,8 +61,8 @@
+ # endif
+
+
+-#include <gpsdrive.h>
+-#include <map_handler.h>
++#include "gpsdrive.h"
++#include "map_handler.h"
+ #include "gpsdrive_config.h"
+ #include "gui.h"
+ #include "map_download.h"
+@@ -133,24 +133,20 @@
+ MAPSOURCE_LANDSAT, "1 : 50 million", 0, 50000000,
+
+ MAPSOURCE_OSM_TAH, "OpenStreetMap Tiles@Home", -1, -1,
+- MAPSOURCE_OSM_TAH, "1 : 147 456 000", 1, 256*576000,
+- MAPSOURCE_OSM_TAH, "1 : 73 728 000", 2, 128*576000,
+- MAPSOURCE_OSM_TAH, "1 : 36 864 000", 3, 64*576000,
+- MAPSOURCE_OSM_TAH, "1 : 18 432 000", 4, 32*576000,
+- MAPSOURCE_OSM_TAH, "1 : 9 216 000", 5, 16*576000,
+- MAPSOURCE_OSM_TAH, "1 : 4 608 000", 6, 8*576000,
+- MAPSOURCE_OSM_TAH, "1 : 2 304 000", 7, 4*576000,
+- MAPSOURCE_OSM_TAH, "1 : 1 152 000", 8, 2*576000,
+-
+- MAPSOURCE_OSM_TAH, "1 : 576 000", 9, 576000,
+- MAPSOURCE_OSM_TAH, "1 : 288 000", 10, 288000,
+- MAPSOURCE_OSM_TAH, "1 : 144 000", 11, 144000,
+- MAPSOURCE_OSM_TAH, "1 : 72 000", 12, 72000,
+- MAPSOURCE_OSM_TAH, "1 : 36 000", 13, 36000,
+- MAPSOURCE_OSM_TAH, "1 : 18 000", 14, 18000,
+- MAPSOURCE_OSM_TAH, "1 : 9 000", 15, 9000,
+- MAPSOURCE_OSM_TAH, "1 : 4 500", 16, 4500,
+- MAPSOURCE_OSM_TAH, "1 : 2 250", 17, 2250,
++ /* scale varies with latitude, so this is just a rough guide
++ which will only be valid for mid-lats */
++ /* Octave code: for lat=0:5:75; disp( [lat (a * 2*pi *pixelfact * cos(lat * pi/180)) / (256*2^9)]); end */
++ MAPSOURCE_OSM_TAH, "1 : 2 500", 17, 2250,
++ MAPSOURCE_OSM_TAH, "1 : 5 000", 16, 4500,
++ MAPSOURCE_OSM_TAH, "1 : 10 000", 15, 9000,
++ MAPSOURCE_OSM_TAH, "1 : 20 000", 14, 18000,
++ MAPSOURCE_OSM_TAH, "1 : 40 000", 13, 36000,
++ MAPSOURCE_OSM_TAH, "1 : 75 000", 12, 72000,
++ MAPSOURCE_OSM_TAH, "1 : 150 000", 11, 144000,
++ MAPSOURCE_OSM_TAH, "1 : 300 000", 10, 288000,
++ MAPSOURCE_OSM_TAH, "1 : 600 000", 9, 576000,
++ /* the distortion gets too bad at scales wider than 1:500k
++ It would be more accurate to stop earlier, but we compromise */
+ MAPSOURCE_N_ITEMS, "", 0, 0
+ };
+
+@@ -165,7 +161,23 @@
+ gtk_entry_set_text (GTK_ENTRY (lon_entry), lon);
+ }
+
++/* *****************************************************************************
++ * calculate the local map scale based on Web Tile zoom level and latitude
++ */
++double
++calc_webtile_scale (double lat, int zoom)
++{
++ double scale;
++ double a = 6378137.0; /* major radius of WGS84 ellipsoid (meters) */
+
++ scale = (a * 2*M_PI * cos(DEG2RAD(lat)) * PIXELFACT) / (256 * pow(2,zoom));
++
++ if (mydebug > 3)
++ g_print ("Tile scale: %.2f\n", scale);
++
++ return scale;
++}
++
+ /* *****************************************************************************
+ * callback to set paramaters for map to download
+ */
+@@ -195,9 +207,13 @@
+ 3, &mapdl_scale, -1);
+ /* TODO: determine map_ or top_ proj at this point so drawdownloadrectangle()
+ * knows how big to draw the green preview box */
++ if (local_config.mapsource_type == MAPSOURCE_OSM_TAH)
++ mapdl_scale = (int)calc_webtile_scale(mapdl_lat, mapdl_zoom);
++
+ if (mydebug > 3)
+ g_print ("new map scale/zoom level: %d / %d\n",
+ mapdl_scale, mapdl_zoom);
++
+ local_config.mapsource_scale = gtk_combo_box_get_active (GTK_COMBO_BOX (scale_combobox));
+ current.needtosave = TRUE;
+ }
+@@ -439,6 +455,7 @@
+ gchar file_path[512];
+ gchar path[40];
+ gchar img_fmt[4];
++ gchar scale_str[40];
+
+ if (mapdl_active)
+ return TRUE;
+@@ -450,11 +467,14 @@
+ g_strlcpy (path, "landsat", sizeof (path));
+ g_strlcpy (img_fmt, "jpg", sizeof (img_fmt));
+ mapdl_geturl_landsat ();
++ g_snprintf (scale_str, sizeof (scale_str), "%d", mapdl_scale);
+ break;
+ case MAPSOURCE_OSM_TAH:
+ g_strlcpy (path, "openstreetmap_tah", sizeof (path));
+ g_strlcpy (img_fmt, "png", sizeof (img_fmt));
+ mapdl_geturl_osm_tah ();
++ mapdl_scale = (int)calc_webtile_scale(mapdl_lat, mapdl_zoom);
++ g_snprintf (scale_str, sizeof (scale_str), "%d", mapdl_zoom);
+ break;
+ default:
+ return TRUE;
+@@ -464,10 +484,11 @@
+ g_print (" download url:\n%s\n", mapdl_url);
+
+ /* set file path and create directory if necessary */
+-
+-
+- g_snprintf (file_path, sizeof (file_path), "%s%s/%d/%.0f/%.0f/",
+- local_config.dir_maps, path, mapdl_scale, mapdl_lat, mapdl_lon);
++
++ g_snprintf (file_path, sizeof (file_path), "%s%s/%s/%.0f/%.0f/",
++ local_config.dir_maps, path, scale_str, mapdl_lat, mapdl_lon);
++
++
+ if(!g_file_test (file_path, G_FILE_TEST_IS_DIR))
+ {
+ if (g_mkdir_with_parents (file_path, 0700))
+@@ -477,14 +498,15 @@
+ }
+
+ /* complete filename */
+- g_snprintf (mapdl_file_w_path, sizeof (mapdl_file_w_path), "%s%s_%d_%5.3f_%5.3f.%s",
+- file_path, mapdl_proj, mapdl_scale, mapdl_lat, mapdl_lon, img_fmt);
++ g_snprintf (mapdl_file_w_path, sizeof (mapdl_file_w_path), "%s%s_%s_%5.3f_%5.3f.%s",
++ file_path, mapdl_proj, scale_str, mapdl_lat, mapdl_lon, img_fmt);
+
+ if (mydebug > 10)
+ g_print (" filename: %s\n", mapdl_file_w_path);
+
+ gtk_progress_bar_set_text (GTK_PROGRESS_BAR (mapdl_progress),
+ _("Loading Map..."));
++
+ mapdl_abort = FALSE;
+ mapdl_download ();
+
+Index: src/map_download.h
+===================================================================
+--- src/map_download.h (revision 2476)
++++ src/map_download.h (revision 2477)
+@@ -1,10 +1,9 @@
+ /***********************************************************************
+
+ Copyright (c) 2008 Guenther Meyer <d.s.e (at) sordidmusic.com>
+-
+ Website: www.gpsdrive.de/
+
+-Disclaimer: Please do not use for navigation.
++Disclaimer: Please do not use as a primary means of navigation.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+@@ -36,5 +35,6 @@
+ void mapdl_set_coords (gchar *lat, gchar *lon);
+ gint mapdl_init (void);
+ gint mapdl_cleanup (void);
++double calc_webtile_scale (double, int);
+
+ #endif /* GPSDRIVE_MAP_DOWNLOAD_H */
+Index: scripts/gpsfetchmap.pl
+===================================================================
+--- scripts/gpsfetchmap.pl (revision 2479)
++++ scripts/gpsfetchmap.pl (revision 2480)
+@@ -47,6 +47,7 @@
+ modified (Jul 2007) by Maciek Kaliszewski <mkalkal\@interia.pl>
+ modified (Oct 2007) by Andreas Putzo <andreas\@putzo.net>
+ modified (Jan 2008) by Gernot Hillier <gernot\@hillier.de> (added Openstreetmap support)
++modified (Aug 2009) by Hamish Bowman <hamish_b yahoo com> (fix OSM+WMS map scales)
+ Version svn-$Version
+ ";
+
+@@ -151,24 +152,20 @@
+ 10000000 =>10000000,
+ 50000000 =>50000000,
+ },
++# Web Map Tiles scale varies with latitude by the formula
++# (a * 2*pi * PIXELFACT * cos(lat * pi/180)) / (256 * 2^zoom)
++# where a is major radius of the Earth according to the WGS84 ellipsoid definition.
++# zoom levels lower than 9 (~1:500k) badly distort the Mercator so are not offered.
+ openstreetmap_tah => {
+- 256*576000 => 1,
+- 128*576000 => 2,
+- 64*576000 => 3,
+- 32*576000 => 4,
+- 16*576000 => 5,
+- 8*576000 => 6,
+- 4*576000 => 7,
+- 2*576000 => 8,
+- 576000 => 9,
+- 288000 => 10,
+- 144000 => 11,
+- 72000 => 12,
+- 36000 => 13,
+- 18000 => 14,
+- 9000 => 15,
+- 4500 => 16,
+- 2250 => 17
++ 600000 => 9,
++ 300000 => 10,
++ 150000 => 11,
++ 75000 => 12,
++ 40000 => 13,
++ 20000 => 14,
++ 10000 => 15,
++ 5000 => 16,
++ 2500 => 17
+ }
+ };
+
+@@ -240,8 +237,6 @@
+ $polite=1;
+ }
+
+-
+-
+ if ( $mapserver eq 'geoscience' )
+ {
+ $scale ||= join(",",keys %{$Scale2Zoom->{'geoscience'}});
+@@ -269,22 +264,24 @@
+ pod2usage(-verbose=>2) if $man;
+
+ sub append_koords($$$$); # {}
++sub calc_webtile_scale ($$); # {}
+ sub check_coverage($); # {}
+ sub check_koord_file($); # {}
+ sub debug($); # {}
++sub file_count($); # {}
+ sub geoscience_url($$$); # {}
+-sub landsat_url($$$); # {}
+-sub resize($$); #{}
+-sub file_count($); # {}
+ sub get_coords_for_route; # {}
+ sub get_coords_for_track($); # {}
++sub get_gpsd_position(); # {}
+ sub get_waypoint($); # {}
+ sub is_map_file($); # {}
++sub landsat_url($$$); # {}
++sub openstreetmap_tah_url($$$); # {}
+ sub read_gpstool_map_file(); # {}
+ sub read_koord_file($); # {}
++sub resize($$); # {}
+ sub update_gpsdrive_map_koord_file(); # {}
+ sub wget_map($$$); # {}
+-sub get_gpsd_position(); # {}
+
+ STDERR->autoflush(1);
+ STDOUT->autoflush(1);
+@@ -407,7 +404,9 @@
+
+ my ($existing,$wanted) = file_count($desired_locations);
+ print "You are about to download $wanted (".($existing+$wanted).") file(s).\n";
+-
++if ($debug) {
++ print "Politeness delay set to $polite seconds,\n";
++}
+ if ( $mapserver eq 'geoscience' ){
+ print "+-----------------------------------------------------------+\n";
+ print "| Geoscience Maps are Copyright, Commonwealth of Australia |\n";
+@@ -419,6 +418,7 @@
+ print "+----------------------------------------------------------------+\n";
+ print "| Landsat maps are courtesy JPL/NASA's OnEarth WMS Global Mosaic |\n";
+ print "| Map prefix will be set automatically based on scale. |\n";
++ print "+----------------------------------------------------------------+\n";
+ # By law, US Government data is without copyright.
+ }elsif ( $mapserver eq 'openstreetmap_tah' ){
+ print "+-----------------------------------------------------------+\n";
+@@ -427,6 +427,8 @@
+ print "| They are free for use under the terms of the |\n";
+ print "| Creative Commons \"Attribution-Share Alike 2.0 Generic\" |\n";
+ print "| license. See http://www.openstreetmap.org for details. |\n";
++ print "+-----------------------------------------------------------+\n";
++
+ } elsif ( ! $force) {
+ print "You may violating the map servers terms of use!\n";
+ print "Please use their service responsible!\n";
+@@ -654,14 +656,32 @@
+ ######################################################################
+ sub map_filename($$$){
+ my ($scale,$lati,$long) = @_;
++
++ my $mscale = $scale;
++
++ if ( $mapserver eq 'openstreetmap_tah' ) {
++ my $zoom = undef;
++ for my $s ( sort keys %{$Scale2Zoom->{openstreetmap_tah}} ) {
++ next unless $s == $scale;
++ $zoom = $Scale2Zoom->{openstreetmap_tah}->{$s};
++ last;
++ }
++ unless ( $zoom ) {
++ print "Error calculating Zoomlevel for Scale: $scale\n";
++ return (undef);
++ }
++ $mscale = $zoom;
++ }
+
+- my $filename = "$mapserver/$scale"
++ my $filename = "$mapserver/$mscale"
+ ."/".int($lati)
+ # ."/".sprintf("%3.1f",$lati)
+ ."/".int($long)
+- ."/$FILEPREFIX$scale-$lati-$long.$fileext";
+- printf("Filename(%.0f,%.5f,%.5f): $filename\n",$scale,$lati,$long)
++ ."/$FILEPREFIX$mscale-$lati-$long.$fileext";
++
++ printf("Filename(%.0f,%.5f,%.5f): $filename\n",$mscale,$lati,$long)
+ if $debug;
++
+ return $filename;
+ }
+
+@@ -678,6 +698,9 @@
+ # mapblast/1000/047/047.0232/9/map_1000-047.0232-0009.8140.gif 47.02320 9.81400 1000
+ #my $filename = "$mapserver/$scale/".int($lati)."/".sprintf("%3.1f",$lati).
+ #"/".int($long)."/$FILEPREFIX$scale-$lati-$long.gif";
++ if ($debug) {
++ print "---------------\n";
++ }
+
+ # redundant??
+ if ($mapserver eq 'landsat')
+@@ -1082,7 +1105,7 @@
+ $lon2 += 360;
+ }
+
+- debug( "landsat_url(LAT=$lat,LON=$lon,SCALE=$scale,FACTOR=$factor)");
++ debug( "landsat_url(LAT=$lat,LON=$lon,SCALE=$scale)");
+
+ debug( "Calculated Lat1 $lat1");
+ debug( "Calculated Lat2 $lat2");
+@@ -1111,7 +1134,28 @@
+ return ($url,$scale);
+ }
+
++
+ #############################################################################
++# calculate the local map scale based on Web Tile zoom level and latitude
++# This same formula is used by OSM, Google Maps, Microsoft Maps, ...
++sub calc_webtile_scale ($$){
++ my $lat = shift;
++ my $zoom = shift;
++
++ # major radius of WGS84 ellipsoid (meters)
++ my $a = $RADIUS_KM * 1000;
++
++ my $zscale = (2*$a*$PI * cos($lat*$D2R) * $PIXELFACT) / (256 * 2**$zoom);
++
++ if ($debug) {
++ print "Tile scale: $zscale\n";
++ }
++
++ return ($zscale);
++}
++
++
++#############################################################################
+ sub openstreetmap_tah_url($$$){
+ my $lati = shift;
+ my $long = shift;
+@@ -1122,7 +1166,7 @@
+ for my $s ( sort keys %{$Scale2Zoom->{openstreetmap_tah}} ) {
+ next unless $s == $scale;
+ $zoom = $Scale2Zoom->{openstreetmap_tah}->{$s};
+- $mapscale = $s;
++ $mapscale = calc_webtile_scale($lati, $zoom);
+ last;
+ }
+
+@@ -1132,10 +1176,9 @@
+ }
+
+ if ($debug) {
+- print "\n";
+- print "Using openstreetmap_tah zoom ", $zoom, " for requested scale ", $scale, ":1 actual scale ", $mapscale, ":1\n";
+- print "lat: $lati\n";
+- print "lon: $long\n";
++ print "Using openstreetmap_tah zoom ", $zoom, " for requested scale 1:", $scale, ". Actual scale 1:", $mapscale, "\n";
++ print "cetner lat: $lati\n";
++ print "cetner lon: $long\n";
+ }
+
+ my $url = "http://tah.openstreetmap.org/MapOf/?lat=$lati&long=$long&z=$zoom&w=1280&h=1024&format=png";
+@@ -1903,7 +1946,7 @@
+
+ gpsfetchmap -w <WAYPOINT NAME> -sc <SCALE> -a <#> -p
+
+-gpsfetchmap -la <latitude DD.DDDD> -lo <latitude DD.DDDD> -sc <SCALE> -a <#> -p
++gpsfetchmap -la <latitude DD.DDDD> -lo <longitude DD.DDDD> -sc <SCALE> -a <#> -p
+
+ gpsfetchmap -sla <start latitude DD.DDDD> -endla <end latitude DD.DDDD> -slo <start longitude DD.DDDD> -endlo <end longitude DD.DDDD> -sc <SCALE> -a <#> -p
+
+@@ -1915,7 +1958,7 @@
+ [-la <latitude DD.DDDD>] [-lo <longitude DD.DDDD>]
+ [-sla <start latitude DD.DDDD>] [-endla <end latitude DD.DDDD>]
+ [-slo <start longitude DD.DDDD>] [-endlo <end longitude DD.DDDD>]
+- [-sc <SCALE>] [-a <#>] [-p] [-m <MAPSERVER>]
++ [-sc <SCALE>] [-a <#>] [-p <#>] [-m <MAPSERVER>]
+ [-u <UNIT>] [-md <DIR>] [-W <FILE>] [-t <FILE>] [-r]
+ [-C <FILE>] [-P <PREFIX>] [-F] [-d] [-v] [-h] [-M] [-n] [-U] [-c]
+
+@@ -2000,7 +2043,7 @@
+ of longitude. 'units' is read from the configuration file (-C) or as defined
+ by (-u).
+
+-=item B<-p, --polite>
++=item B<-p, --polite <#>>
+
+ This causes the program to sleep one second between downloads to be polite
+ to the mapserver. Takes an optional value of number of seconds to sleep.
+@@ -2117,6 +2160,13 @@
+
+ Prints the manual page and exits.
+
++=back
++
++
++=head1 OUTPUT
++
++=over 2
++
+ =item B<Download>
+
+ When downloading Maps the output reads as folows:
+@@ -2130,5 +2180,16 @@
+
+ =back
+
++
++=head1 EXAMPLE
++
++Download all 1:10000 OpenStreetMaps in a 5 km radius around the
++Sydney Convention Centre. Between tile downloads it will let
++the server rest for 3 seconds.
++
++gpsfetchmap --mapserver openstreetmap_tah --polite 3 \
++ --lat "-33.8753" --lon 151.2001 --scale 10000 \
++ --area 5 --unit kilometers
++
+ =cut
+
+Index: scripts/mapnik/gpsdrive_mapnik_gentiles-in.py
+===================================================================
+--- scripts/mapnik/gpsdrive_mapnik_gentiles-in.py (revision 2473)
++++ scripts/mapnik/gpsdrive_mapnik_gentiles-in.py (revision 2479)
+@@ -7,14 +7,20 @@
+
+ Options:
+ -h, --help show this help
+- -b, --bbox boundingbox (lon,lat,lon,lat) - Be carefull! Quote negative values!
+- -s, --scale scale single/range
+- 1 = 147456000
+- 2 = 73728000
+- ...
+- 15 = 9000
+- 16 = 4500
+- 17 = 2250
++ -b, --bbox boundingbox (minlon,minlat,maxlon,maxlat)
++ - Be carefull! "Quote" negative values!
++ -s, --scale scale single/range (zoom level or min-max)
++ (below "9" Mercator becomes distorted;
++ actual scale will vary with latitude)
++ 9 - 1:600,000
++ 10 - 1:300,000
++ 11 - 1:150,000
++ 12 - 1:75,000
++ 13 - 1:40,000
++ 14 - 1:20,000
++ 15 - 1:10,000
++ 16 - 1:5,000
++ 17 - 1:2,500
+ --test testrun = generates Munich example
+
+ Examples:
+@@ -22,7 +28,7 @@
+ Munich:
+ gpsdrive_mapnik_gentiles.py -b 11.4,48.07,11.7,48.2 -s 10-16
+
+- World:
++ World: (just to demonstrate lat/lon order; scale not recommended)
+ gpsdrive_mapnik_gentiles.py -b "-180.0,-90.0,180.0,90.0" -s 1-6
+ """
+
+@@ -32,12 +38,19 @@
+ import getopt
+ import string
+
+-zoom2scale = [728 * 576000,256 * 576000,128 * 576000,64 * 576000,32 * 576000,16 * 576000,8 * 576000,4 * 576000,2 * 576000,576000,288000,144000,72000,36000,18000,9000,4500,2250,1125]
+
+-
+ DEG_TO_RAD = pi/180
+ RAD_TO_DEG = 180/pi
+
++def calc_scale (lat, zoom):
++ # GpsDrive's hardcoded pixels per meter ratio
++ PixelFact = 2817.947378
++ # wgs84 major Earth axis
++ a = 6378137.0
++ dynscale = ( a * 2*pi * cos(lat * DEG_TO_RAD) * PixelFact ) / ( 256*pow(2,zoom) )
++ print dynscale
++ return dynscale
++
+ def minmax (a,b,c):
+ a = max(a,b)
+ a = min(a,c)
+@@ -90,17 +103,28 @@
+ os.mkdir(tile_dir)
+
+ gprj = GoogleProjection(maxZoom+1)
++
+ #m = Map(2 * 256,2 * 256)
+ m = Map(1280,1024)
+ load_map(m,mapfile)
+- prj = Projection("+proj=merc +datum=WGS84")
+-
++
++ #prj = Projection("+proj=merc +datum=WGS84")
++ # What follows is from /usr/share/proj/esri.extra, EPSG:900913
++ # "Chris' funny epsgish code for the google mercator"
++ prj = Projection("+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs")
++
+ ll0 = (bbox[0],bbox[3])
+ ll1 = (bbox[2],bbox[1])
+-
++
+ for z in range(minZoom,maxZoom + 1):
++ if z == 9:
++ print "CAUTION: Mercator projection begins to be noticeably distorted at this zoom level."
++ elif z < 9:
++ print "WARNING: Mercator projection is very distorted at this zoom level."
++
+ px0 = gprj.fromLLtoPixel(ll0,z)
+ px1 = gprj.fromLLtoPixel(ll1,z)
++
+ for x in range(int(px0[0]/640.0),int(px1[0]/640.0)+1):
+ for y in range(int(px0[1]/512.0),int(px1[1]/512.0)+1):
+ p0 = gprj.fromPixelToLL((x * 640.0, (y+1) * 512.0),z)
+@@ -145,7 +169,7 @@
+ fh_mapkoord.write(tile_path + " ")
+ fh_mapkoord.write(str((p0[1] + p1[1]) / 2) + " ")
+ fh_mapkoord.write(str((p0[0] + p1[0]) / 2) + " ")
+- fh_mapkoord.write(str(zoom2scale[z]))
++ fh_mapkoord.write(str( calc_scale( (p0[1] + p1[1])/2, z) ))
+ fh_mapkoord.write(" " + str(p0[1]) + " " + str(p0[0]))
+ fh_mapkoord.write(" " + str(p1[1]) + " " + str(p1[0]))
+ fh_mapkoord.write("\n")
+@@ -221,6 +245,7 @@
+
+ # check for correct values
+ if str(eval(bboxs[0])) != bboxs[0] or str(eval(bboxs[1])) != bboxs[1] or str(eval(bboxs[2])) != bboxs[2] or str(eval(bboxs[3])) != bboxs[3]:
++ # rounding problems... what exactly is this supposed to be checking ???
+ sys.exit("Boundingbox invalid!")
+
+ if minZoom < 1 or minZoom > 17 or maxZoom < 1 and maxZoom > 17 or minZoom > maxZoom or int(minZoom) <> minZoom or int(maxZoom) <> maxZoom:
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..39807c3
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,158 @@
+#!/usr/bin/make -f
+# debian/rules for gpsdrive
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+include /usr/share/dpatch/dpatch.make
+
+DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+DEB_VERSION := $(shell dpkg-parsechangelog |egrep '^Version:' | cut -f 2 -d ' ')
+DEB_NOEPOCH_VERSION := $(shell echo $(DEB_VERSION) | cut -d: -f2-)
+DEB_UPSTREAM_VERSION := 2.10~pre4-6.dfsg
+UPSTREAM_VERSION := 2.10pre4
+DESTDIR := ${CURDIR}/debian/tmp
+# MAPNIK_PATH = $(shell mapnik-plugin-base)
+
+CFLAGS = -Wall -g
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+ CFLAGS += -O0
+else
+ CFLAGS += -O2
+endif
+
+CFLAGS += -DMAPNIK_PATH=$(MAPNIK_PATH)
+
+get-orig-source:
+ dh_testdir
+ test -d ../tarballs/. || mkdir -p ../tarballs
+ @echo Downloading gpsdrive-${UPSTREAM_VERSION}
+ /usr/bin/wget -P ../tarballs/ -N http://gpsdrive.de/packages/gpsdrive-${UPSTREAM_VERSION}.tar.gz
+ tar xzf ../tarballs/gpsdrive-${UPSTREAM_VERSION}.tar.gz -C ../tarballs/
+ @echo Removing upstream debian/ dir
+ rm -rf ../tarballs/gpsdrive-${UPSTREAM_VERSION}/debian/
+ @echo Remove gpsfetchmap.pl script.
+ rm -f ../tarballs/gpsdrive-${UPSTREAM_VERSION}/scripts/gpsfetchmap.pl
+ @echo Removing icons.
+ rm -rf ../tarballs/gpsdrive-${UPSTREAM_VERSION}/data/map-icons/japan/
+ rm -rf ../tarballs/gpsdrive-${UPSTREAM_VERSION}/data/map-icons/nickw/
+ @echo Building tarball
+ tar czf ../tarballs/gpsdrive_${DEB_UPSTREAM_VERSION}.orig.tar.gz -C ../tarballs gpsdrive-${UPSTREAM_VERSION}
+ @echo Cleaning up
+ rm -rf ../tarballs/gpsdrive-${UPSTREAM_VERSION}
+ rm -f ../tarballs/gpsdrive-${UPSTREAM_VERSION}.tar.gz
+
+config.status: configure patch-stamp
+ dh_testdir
+ aclocal -I m4 --force
+ automake --add-missing
+ autoconf
+ libtoolize -i -f
+ ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
+ --prefix=/usr \
+ --disable-mapnik \
+ --enable-dbus \
+ CFLAGS="$(CFLAGS)"
+
+build: build-arch build-indep
+
+build-arch: config.status build-arch-stamp
+build-arch-stamp: config.status
+ dh_testdir
+ $(MAKE)
+ touch $@
+
+build-indep: config.status build-indep-stamp
+build-indep-stamp:
+ touch $@
+
+clean: clean-patched unpatch
+
+clean-patched:
+ dh_testdir
+ dh_testroot
+ rm -f build-arch-stamp build-indep-stamp
+ [ ! -f Makefile ] || $(MAKE) distclean
+ dh_clean
+
+install: install-arch install-indep
+ dh_prep
+
+install-arch: build-arch
+ dh_testdir
+ dh_testroot
+ dh_installdirs -a
+ $(MAKE) -C data/ \
+ install-appsDATA \
+ install-cfg_filesDATA \
+ install-pixmapDATA \
+ install-poiDATA \
+ install-mapsDATA \
+ DESTDIR=$(DESTDIR)
+ # install -d $(CURDIR)/debian/tmp/usr/share/gpsdrive/mapnik
+ # install -m 644 $(CURDIR)/scripts/mapnik/osm.xml $(CURDIR)/debian/tmp/usr/share/gpsdrive/mapnik/osm.xml
+ install -d $(CURDIR)/debian/tmp/usr/share/map-icons
+ install -m 644 $(CURDIR)/data/map-icons/icons.xml $(CURDIR)/debian/tmp/usr/share/map-icons/icons.xml
+ # $(MAKE) -C scripts/mapnik/ install DESTDIR=$(DESTDIR)
+ $(MAKE) -C src/ install DESTDIR=$(DESTDIR)
+
+install-indep: build-indep
+ dh_testdir
+ dh_testroot
+ dh_installdirs -i
+ $(MAKE) -C scripts/ install DESTDIR=$(DESTDIR)
+
+binary-indep: build-indep install-indep
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs -i ChangeLog
+ dh_installdocs -i -Xdebian/TODO
+ dh_installman -i --language=C
+ dh_install -i --sourcedir=$(DESTDIR)
+ dh_compress -i
+ dh_fixperms -i
+ dh_installdeb -i
+ # strip language extensions
+ mv -f $(CURDIR)/debian/gpsdrive-scripts/usr/bin/convert-waypoints.pl $(CURDIR)/debian/gpsdrive-scripts/usr/bin/convert-waypoints
+ mv -f $(CURDIR)/debian/gpsdrive-scripts/usr/bin/geoinfo.pl $(CURDIR)/debian/gpsdrive-scripts/usr/bin/geoinfo
+ # mv -f $(CURDIR)/debian/gpsdrive-scripts/usr/bin/gpsdrive_mapnik_gentiles.py $(CURDIR)/debian/gpsdrive-scripts/usr/bin/gpsdrive_mapnik_gentiles
+ mv -f $(CURDIR)/debian/gpsdrive-scripts/usr/bin/gpspoint2gpsdrive.pl $(CURDIR)/debian/gpsdrive-scripts/usr/bin/gpspoint2gpsdrive
+ mv -f $(CURDIR)/debian/gpsdrive-scripts/usr/bin/poi-manager.pl $(CURDIR)/debian/gpsdrive-scripts/usr/bin/poi-manager
+ mv -f $(CURDIR)/debian/gpsdrive-scripts/usr/share/man/man1/convert-waypoints.pl.1.gz \
+ $(CURDIR)/debian/gpsdrive-scripts/usr/share/man/man1/convert-waypoints.1.gz
+ mv -f $(CURDIR)/debian/gpsdrive-scripts/usr/share/man/man1/geoinfo.pl.1.gz \
+ $(CURDIR)/debian/gpsdrive-scripts/usr/share/man/man1/geoinfo.1.gz
+ mv -f $(CURDIR)/debian/gpsdrive-scripts/usr/share/man/man1/gpspoint2gpsdrive.pl.1.gz \
+ $(CURDIR)/debian/gpsdrive-scripts/usr/share/man/man1/gpspoint2gpsdrive.1.gz
+ mv -f $(CURDIR)/debian/gpsdrive-scripts/usr/share/man/man1/poi-manager.pl.1.gz \
+ $(CURDIR)/debian/gpsdrive-scripts/usr/share/man/man1/poi-manager.1.gz
+ # install gpsfetchmap from debian/scripts
+ install -m 755 $(CURDIR)/debian/scripts/gpsfetchmap.pl $(CURDIR)/debian/gpsdrive-scripts/usr/bin/gpsfetchmap
+ dh_perl -i
+ dh_gencontrol -i
+ dh_md5sums -i
+ dh_builddeb -i
+
+binary-arch: build-arch install-arch
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs -a ChangeLog
+ dh_installdocs -a -Xdebian/TODO
+ dh_installman -a --language=C
+ dh_installman -a --language=de -pgpsdrive man/de/gpsdrive.1
+ dh_installman -a --language=es -pgpsdrive man/es/gpsdrive.1
+ dh_installexamples -a
+ dh_install -a --sourcedir=$(DESTDIR)
+ dh_strip -a
+ dh_compress -a
+ dh_fixperms -a
+ dh_makeshlibs -a
+ dh_installdeb -a
+ dh_shlibdeps -a
+ dh_gencontrol -a
+ dh_md5sums -a
+ dh_builddeb -a
+
+binary: binary-arch binary-indep
+.PHONY: build clean binary-indep binary-arch binary install-arch install-indep install
diff --git a/debian/scripts/gpsfetchmap.pl b/debian/scripts/gpsfetchmap.pl
new file mode 100644
index 0000000..b2c8bf3
--- /dev/null
+++ b/debian/scripts/gpsfetchmap.pl
@@ -0,0 +1,1975 @@
+#!/usr/bin/perl
+#
+# gpsfetchmap
+# Copyright (C) 2002-2007 Gpsdrive Development Team <gpsdrive@gpsdrivers.org>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+BEGIN {
+ my $dir = $0;
+ $dir =~s,[^/]+/[^/]+$,,;
+ unshift(@INC,"$dir/perl_lib");
+
+ # For Debug Purpose in the build Directory
+ unshift(@INC,"./perl_lib");
+ unshift(@INC,"./scripts/perl_lib");
+ unshift(@INC,"../scripts/perl_lib");
+
+ # For DSL
+ unshift(@INC,"/opt/gpsdrive/share/perl5");
+ unshift(@INC,"/opt/gpsdrive"); # For DSL
+};
+
+my $Version = '$Revision: 1743 $';
+$Version =~ s/\$Revision:\s*(\d+)\s*\$/$1/;
+
+my $VERSION ="gpsfetchmap (c) 2002 Kevin Stephens <gps\@suburbialost.com>
+modified (Sep 2002) by Sven Fichtner <sven.fichtner\@flugfunk.de>
+modified (Nov 2002) by Magnus MÃ¥nsson <ganja\@0x63.nu>
+modified (Nov 2003) by camel <camel\@insecure.at>
+modified (Feb 2004) by Robin Cornelius <robin\@cornelius.demon.co.uk>
+modified (Jan 2005) by Joerg Ostertag <gpsdrive\@ostertag.name>
+modified (May 2005) by Olli Salonen <olli\@cabbala.net>
+modified (Jul 2005) by Jaroslaw Zachwieja <grok\@filippa.org.uk>
+modified (Dec 2005) by David Pollard <david dot pollard\@optusnet.com.au>
+modified (Jul 2007) by Maciek Kaliszewski <mkalkal\@interia.pl>
+modified (Oct 2007) by Andreas Putzo <andreas\@putzo.net>
+Version svn-$Version
+";
+
+sub redirect_ok { return 1; }
+
+
+use IO::Socket;
+use Data::Dumper;
+use strict;
+use warnings;
+use LWP::UserAgent;
+use LWP::Debug qw(- -conns -trace);
+#use LWP::Debug qw(+ +conns +trace);
+use HTTP::Request;
+use HTTP::Request::Common;
+use HTML::Parser;
+use Getopt::Long;
+use Pod::Usage;
+use File::Basename;
+use File::Path;
+use File::Copy;
+use IO::File;
+use Switch;
+use POSIX qw(ceil floor);
+use Image::Magick;
+
+my $long_sleep_time=600;
+
+my @SCALES = (1000,1500,2000,3000,5000,7500,10000,15000,20000,30000,50000,75000,
+ 100000,150000,200000,300000,500000,750000,1000000,1500000,2000000,3000000,
+ 5000000,7500000,10000000,15000000,20000000,30000000,50000000,75000000);
+
+
+# Translates Scale to zoom factor used by Mapserver
+# This Variable also is used to see if the required mapserver
+# is a valid Mapserver source
+my $Scale2Zoom = {
+ eniro => {
+ 18000000 => 1, # 480 Km
+ 3200000 => 2, # 80 Km
+ 400000 => 3, # 10 Km
+ 200000 => 4, # 4 Km
+ 100000 => 5, # 1.1 Km
+ 20000 => 6, # 400 m
+ 5000 => 7, # 160 m
+ },
+ gov_au => {
+ 10000000000 => 1, #
+ 5000000000 => 2, #
+ 1000000000 => 3, #
+ 500000000 => 4, #
+ 100000000 => 5, #
+ 50000000 => 6, #
+ 10000000 => 7, #
+ 5000000 => 8, #
+ 1000000 => 9, #
+ 500000 => 10, #
+ 100000 => 11, #
+ 50000 => 12, #
+ 10000 => 13, #
+ 5000 => 14, #
+ 1000 => 15, #
+ },
+
+ incrementp => {
+ 3200000 => 0, # 500 Km
+ 2400000 => 1, # 250 Km
+ 1600000 => 2, # 100 Km
+ 800000 => 3, # 50 Km
+ 400000 => 4, # 25 Km
+ 200000 => 5, # 10 Km
+ 100000 => 6, # 5 Km
+ 50000 => 7, # 2.5 Km
+ 25000 => 8, # 1.0 Km
+ 2500 => 9, # 500 m
+ 6250 => 10, # 250 m
+ 3125 => 11, # 100 m
+ 1562 => 12, # 50 m
+ },
+ geoscience => {
+ 383000*8 => 8, # DP Still not correct but closer
+ 383000*4 => 4,
+ 383000*2 => 2,
+ 383000*1 => 1,
+ },
+ landsat => {
+ 2000 => 2*6.4,
+ 5000 => 5*6.4,
+ 10000 => 10*6.4,
+ 50000 => 50*6.4,
+ 100000 => 100*6.4,
+ 500000 => 500*6.4,
+ 1000000 => 1000*6.4,
+ 5000000 => 5000*6.4,
+ 10000000 =>10000*6.4,
+ 50000000 =>50000*6.4,
+ }
+};
+
+$Scale2Zoom->{eniro_se} = $Scale2Zoom->{eniro};
+$Scale2Zoom->{eniro_dk} = $Scale2Zoom->{eniro};
+$Scale2Zoom->{eniro_no} = $Scale2Zoom->{eniro};
+$Scale2Zoom->{eniro_fi} = $Scale2Zoom->{eniro};
+
+
+# Set defaults and get options from command line
+Getopt::Long::Configure('no_ignore_case');
+my ($lat,$lon);
+my ($slat,$endlat,$slon,$endlon);
+my ($waypoint,$area,$unit,$mapdir);
+my ($debug,$force,$version,$man,$help);
+my $cover_route;
+my $failcount = 0;
+my $newcount = 0;
+my $existcount = 0;
+my $polite = 10;
+my $MIN_MAP_BYTES = 4000; # Minimum Bytes for a map to be accepted as downloaded
+my $scale;
+my $CONFIG_DIR = "$ENV{'HOME'}/.gpsdrive"; # Should we allow config of this?
+my $CONFIG_FILE = "$CONFIG_DIR/gpsdriverc";
+my $WAYPT_FILE = "$CONFIG_DIR/way.txt";
+my $GPSTOOL_MAP_FILE = "$ENV{'HOME'}/.gpsmap/maps.txt";
+my $FILEPREFIX = 'map_';
+my $mapserver = 'landsat';
+my $simulate_only = 0;
+my $check_koord_file = 0;
+my $update_koord = 0;
+my $check_coverage = 0;
+my $TRACK_FILE = "";
+our $MAP_KOORDS = {};
+our $MAP_FILES = {};
+our $GPSTOOL_MAP_KOORDS = {};
+our $GPSTOOL_MAP_FILES = {};
+my $PROXY=$ENV{'http_proxy'};
+
+GetOptions ( 'lat=f' => \$lat, 'lon=f' => \$lon,
+ 'start-lat=f' => \$slat, 'end-lat=f' => \$endlat,
+ 'start-lon=f' => \$slon, 'end-lon=f' => \$endlon,
+ 'sla=f' => \$slat, 'ela=f' => \$endlat,
+ 'slo=f' => \$slon, 'elo=f' => \$endlon,
+ 'scale=s' => \$scale, 'mapserver=s' => \$mapserver,
+ 'waypoint=s' => \$waypoint, 'area=s' => \$area,
+ 'unit=s' => \$unit, 'mapdir=s' => \$mapdir,
+ 'polite:i' => \$polite,
+ 'WAYPOINT=s' => \$WAYPT_FILE, 'CONFIG=s' => \$CONFIG_FILE,
+ 'PREFIX=s' => \$FILEPREFIX,
+ 'n' => \$simulate_only,
+ 'track=s' => \$TRACK_FILE,
+ 'route' => \$cover_route,
+ 'check-koordfile'=> \$check_koord_file,
+ 'check-coverage' => \$check_coverage,
+ 'U' => \$update_koord,
+ 'FORCE' => \$force,
+ 'PROXY=s' => \$PROXY,
+ 'debug+' => \$debug, 'MAN' => \$man,
+ 'help|x' => \$help, 'version' => \$version
+ )
+ or pod2usage(1);
+
+# don't allow polite smaller than one second
+if ( ($polite =~ /\d+/) && ($polite < 1) ) {
+ print "A polite value below one second is not supported.\n";
+ print "Setting polite to default (one second)!\n";
+ $polite=1;
+}
+
+
+
+if ( $mapserver eq 'geoscience' )
+{
+ $scale ||= join(",",keys %{$Scale2Zoom->{'geoscience'}});
+} else {
+ $scale ||= '100000-5000000';
+}
+
+if ( ! defined ( $Scale2Zoom->{$mapserver} ) ){
+ print "Invalid Mapserver: $mapserver\n";
+ print "Valid Mapserver: ".join(",",keys %{$Scale2Zoom} )."\n";
+ exit;
+}
+
+if ( $mapserver eq 'landsat') {
+ $FILEPREFIX = 'top_';
+ $FILEPREFIX = 'map_';
+}
+
+@SCALES = sort {$a <=> $b} keys %{$Scale2Zoom->{$mapserver}};
+
+pod2usage(1) if $help;
+pod2usage(-verbose=>2) if $man;
+
+sub append_koords($$$$); # {}
+sub check_coverage($); # {}
+sub check_koord_file($); # {}
+sub debug($); # {}
+sub geoscience_url($$$); # {}
+sub landsat_url($$$); # {}
+sub resize($$); #{}
+sub file_count($); # {}
+sub get_coords_for_route; # {}
+sub get_coords_for_track($); # {}
+sub get_waypoint($); # {}
+sub is_map_file($); # {}
+sub read_gpstool_map_file(); # {}
+sub read_koord_file($); # {}
+sub update_gpsdrive_map_koord_file(); # {}
+sub wget_map($$$); # {}
+sub get_gpsd_position(); # {}
+
+STDERR->autoflush(1);
+STDOUT->autoflush(1);
+
+# Setup up some constants
+my $DIFF = 0.0000028;
+my $RADIUS_KM = 6371.01;
+my $LAT_DIST_KM = 110.87;
+my $KM2NAUTICAL = 0.54;
+my $KM2MILES = 0.62137119;
+
+
+my $CFG = read_config();
+# Get unit from config file, unless they override with command line
+$unit ||= $CFG->{units};
+
+# Get mapdir from config file, unless they override with command line
+$mapdir ||= $CFG->{mapdir};
+$mapdir ||= "$CONFIG_DIR/maps";
+
+my $KOORD_FILE = "$mapdir/map_koord.txt";
+
+
+debug( $VERSION);
+#############################################################################
+# LPW::UserAgent initialisieren
+my $ua = LWP::UserAgent->new;
+if ( $PROXY ) {
+ $PROXY =~ s,^(http|ftp)://,,;
+ $PROXY =~ s,/$,,;
+ $PROXY = "http://$PROXY/";
+ debug("Using Proxy '$PROXY'");
+ $ua->proxy(['http','ftp'],$PROXY);
+}
+#$ua->level("+trace") if $debug;
+
+
+# Print version
+if ($version) {
+ print $VERSION, "\n";
+ exit();
+}
+
+
+# Verify that we have the options that we need
+pod2usage(1) if (&error_check);
+
+# Change into the gpsdrive maps directory
+chdir($mapdir);
+
+############################################
+if ( $check_koord_file ) {
+ check_koord_file($KOORD_FILE); # This also memoizes the filenames
+ update_gpsdrive_map_koord_file();
+ exit();
+}
+
+if ( $check_coverage ) {
+ check_coverage($KOORD_FILE);
+ exit();
+}
+
+#############################################################################
+# Get the list of scales we need
+my $SCALES_TO_GET_ref = get_scales(\$scale);
+debug( "Scale to download: ". join(",",sort {$a <=> $b} @{$SCALES_TO_GET_ref}));
+
+# Get the center waypoint if they want one
+if ( $waypoint ) {
+ if ( $waypoint eq "gpsd" ) {
+ ($lat,$lon) = get_gpsd_position();
+ } else {
+ ($lat,$lon) = get_waypoint($waypoint);
+ }
+ debug("Centerpoint: $lat,$lon");
+}
+
+
+my $desired_locations = {};
+
+if ($TRACK_FILE) { # download maps along a saved track
+ my ($number, $i);
+ print "Downloading maps along a saved track $TRACK_FILE.\n" if $debug;
+ my ($latsref, $lonsref) = get_coords_for_track($TRACK_FILE);
+ my ($sla, $slo, $ela, $elo);
+ $area ||= 1;
+ $number = @{$latsref};
+ print "Inserting $number points to the list.\n" if $debug;
+ for ($i = 0; $i < $number; $i++) {
+ ($sla,$slo,$ela,$elo) = get_coords($latsref->[$i],$lonsref->[$i],$area,$unit);
+ debug("");
+ desired_locations($desired_locations,$sla,$slo,$ela,$elo);
+ }
+} elsif ($cover_route) { # download maps between a set of waypoints
+ print "Downloading maps along the following route:\n" if $debug;
+ my ($latsref, $lonsref) = get_coords_for_route;
+ my ($sla, $slo, $ela, $elo, $number, $i);
+ $area ||= 1;
+ $number = @{$latsref};
+ print "Inserting $number points to the list.\n" if $debug;
+ for ($i = 0; $i < $number; $i++) {
+ ($sla,$slo,$ela,$elo) = get_coords($latsref->[$i],$lonsref->[$i],$area,$unit);
+ desired_locations($desired_locations,$sla,$slo,$ela,$elo);
+ }
+} else { # we are not downloading maps a saved track or between waypoints
+ # Now get the start and end coordinates
+ unless ($slat && $slon && $endlat && $endlon) {
+ ($slat,$slon,$endlat,$endlon) = get_coords($lat,$lon,$area,$unit);
+ }
+ print "Upper left: $slat, $slon\n" if $debug;
+ print "Lower right: $endlat, $endlon\n" if ($debug);
+
+ desired_locations($desired_locations,$slat,$slon,$endlat,$endlon);
+}
+
+my ($existing,$wanted) = file_count($desired_locations);
+print "You are about to download $wanted (".($existing+$wanted).") file(s).\n";
+
+if ( $mapserver eq 'geoscience' ){
+ print "+-----------------------------------------------------------+\n";
+ print "| Geoscience Maps are Copyright, Commonwealth of Australia |\n";
+ print "| They are free for non commercial use. |\n";
+ print "| Full Copyright information can be found at |\n";
+ print "| http://www.ga.gov.au/about/copyright.jsp |\n";
+ print "+-----------------------------------------------------------+\n";
+}elsif ( $mapserver eq 'landsat' ){
+ print "+-----------------------------------------------------------+\n";
+ print "| Landsat Maps are Copyright, ..... |\n";
+ print "| They are free for non commercial use. |\n";
+} elsif ( ! $force) {
+ print "You may violating the map servers terms of use!\n";
+ print "Please use their service responsible!\n";
+ print "Are you sure you want to continue? [y|n] ";
+ my $answer = <STDIN>;
+ exit if ($answer !~ /^[yY]/);
+}
+
+if ( $update_koord ) {
+ read_gpstool_map_file();
+ read_koord_file($KOORD_FILE);
+}
+
+print "\nDownloading files:\n";
+
+# Ok start getting the maps
+for my $scale ( sort {$b <=> $a} keys %{$desired_locations} ) {
+ print "Scale: $scale\n";
+ for my $lati ( sort {$a <=> $b} keys %{$desired_locations->{$scale}} ) {
+ printf " %5.2f: ",$lati;
+ my @longs = sort {$a <=> $b} keys %{$desired_locations->{$scale}->{$lati}};
+ print "(". scalar( @longs ) . ")\t";
+ #print ":". join(" ", @longs ) . "\t";
+ for my $long ( @longs ) {
+ print wget_map($scale,$lati,$long);
+ }
+ print "\n";
+ }
+#print "\n";
+}
+
+
+print "\n";
+
+print "Fail: $failcount\n";
+print "Exist: $existcount\n";
+print "New: $newcount\n";
+
+################################################################################
+#
+# Subroutines
+#
+################################################################################
+
+#############################################################################
+sub slurp($){
+ my $fh=IO::File->new(shift);
+ return "" unless $fh;
+ return join("",$fh->getlines());
+}
+
+#############################################################################
+sub get_gpsd_position(){
+ # Connect to local gpsd
+ my $GPSD = "localhost:2947";
+ my $gpsd = IO::Socket::INET->new($GPSD);
+ my ($lat,$lon) =(0,0);
+ if ( !$gpsd ) {
+ warn "No local gpsd found at $GPSD: $!\n";
+ } else {
+ # Tell gpsd we want position, altitude, date, and status.
+ $gpsd->print("pads\n");
+ $gpsd->print("p\n");
+ while ( my $line = <$gpsd> ) {
+ debug("GPSD Line: $line");
+ if ( $line =~ m/P=(-?\d+\.\d+)\s+(-?\d+\.\d+)/){
+ ($lat,$lon) =($1,$2);
+ debug("gpsd reports: lat/lon ($lat,$lon)");
+ return ($lat,$lon);
+ } else {
+ print "GPSD Line: $line";
+ $gpsd->print("pads\n");
+ sleep 1;
+ }
+ }
+ }
+ $gpsd->close();
+}
+
+#############################################################################
+# get File with lwp-mirror
+#############################################################################
+sub mirror_file($$){
+ my $url = shift;
+ my $local_filename = shift;
+
+ my $file_existed = -s $local_filename;
+
+ my $exist_string = $file_existed?"exists":"getting";
+ debug("mirror_file($url --> $local_filename) $exist_string");
+
+ my $ok=1;
+
+ my $dir = dirname($local_filename);
+ unless ( -s $dir || -l $dir ) {
+ debug("Create Directory '$dir'");
+ mkpath($dir)
+ or warn "Could not create '$dir':$!\n";;
+ }
+
+ my $response = $ua->mirror($url,$local_filename);
+# debug(sprintf("success = %d <%s>",$response->is_success,$response->status_line));
+
+ if ( ! $response->is_success ) {
+ if ( $response->status_line =~ /^304/ ) {
+ print "$url --> $local_filename\tNOT MOD" if $debug ;
+ } else {
+ print sprintf("ERROR: %s\n",$response->message)
+ if $debug;
+ print sprintf("STATUS LINE: %s\n",$response->status_line)
+ if $debug;
+ print "COULD NOT GET\t$url\n\t\tfor --> $local_filename\n";
+ unlink $local_filename unless $file_existed;
+ $ok=0;
+ }
+ }
+ debug("mirror_file($url --> $local_filename) error ")
+ unless $ok;
+ return $ok;
+}
+
+######################################################################
+# Check if $filename is a valid map image
+# for now we only check the size and existance
+######################################################################
+sub is_map_file($){
+ my $filename = shift;
+ my $full_filename = $filename;
+ $full_filename = "$mapdir/$filename" unless $filename =~ m,^/,;
+ if ( $debug ) {
+# printf "is_map_file($full_filename) -> %d Bytes\n",-s $full_filename;
+ }
+
+ return 1 if ( -s $full_filename || 0 ) > $MIN_MAP_BYTES ;
+
+ return 0 if -s $full_filename;
+
+ # Search in System
+ $full_filename = "/usr/local/share/gpsdrive/maps/$filename" unless $filename =~ m,^/,;
+ return 1 if ( -s $full_filename || 0 ) > $MIN_MAP_BYTES ;
+
+ $full_filename = "/usr/share/gpsdrive/maps/$filename" unless $filename =~ m,^/,;
+ return 1 if ( -s $full_filename || 0 ) > $MIN_MAP_BYTES ;
+
+ return 0;
+}
+
+
+######################################################################
+# get a single map
+# Args:
+# $url
+# $local_filename
+# Returns:
+# 1 : Success
+# 0 : Failure
+######################################################################
+sub mirror_map($$){
+ my $url = shift;
+ my $filename = shift;
+
+ my $content = slurp($filename);
+ if ( $content =~ m,<title>403 Forbidden</title>,){
+ unlink "$filename";
+ sleep 10; # Yes this is on purpose. SInce you cannot download for the next hours anyway
+ debug($content);
+ die ("Access to the Site $url is denied\n");
+ };
+ my $ok = mirror_file($url,$filename);
+ if ( ! is_map_file($filename) ) {
+ # unlink($filename) if -s $filename;
+ #warn "no map downloaded ($filename)\n";
+ $ok=0;
+ }
+
+ $content = slurp($filename);
+ if ( $content =~ m,<title>(403 .*)</title>,){
+ my $message = $1;
+ $content =~ s,.*<blockquote>,,s;
+ $content =~ s,</blockquote>.*,,s;
+ warn "Found $filename $message Message\n";
+ warn $content;
+ warn "Sleeping very long $long_sleep_time seconds\n";
+ sleep $long_sleep_time;
+ $long_sleep_time*=2;
+ };
+
+ # sleep if polite is turned on to be nice to the webserver of the mapserver
+ sleep($polite) if ($polite =~ /\d+/);
+
+ return $ok;
+}
+
+######################################################################
+# get a single map (Old Version with wget)
+# Args:
+# $url
+# $local_filename
+# Returns:
+# 1 : Success
+# 0 : Failure
+######################################################################
+sub mirror2_map($$){
+ my $url = shift;
+ my $filename = shift;
+
+ # sleep if polite is turned on to be nice to the webserver of the mapserver
+ sleep($polite) if ($polite =~ /\d+/);
+ sleep(1) if (!$polite);
+
+ unlink('tmpmap.gif') if -f 'tmpmap.gif';
+ `wget -nd -q -O tmpmap.gif "$url"`;
+ if ( is_map_file('tmpmap.gif') ) {
+ rename('tmpmap.gif',$filename);
+ return 1;
+ }
+ return 0;
+}
+
+
+######################################################################
+# returns the map filename for given $scale,$lati,$long
+######################################################################
+sub map_filename($$$){
+ my ($scale,$lati,$long) = @_;
+
+ my $filename = "$mapserver/$scale"
+ ."/".int($lati)
+# ."/".sprintf("%3.1f",$lati)
+ ."/".int($long)
+ ."/$FILEPREFIX$scale-$lati-$long.gif";
+ printf("Filename(%.0f,%.5f,%.5f): $filename\n",$scale,$lati,$long)
+ if $debug;
+ return $filename;
+}
+
+######################################################################
+# get a single map at defined position
+######################################################################
+sub wget_map($$$){
+ my ($scale,$lati,$long) = @_;
+
+ my ($url,$mapscale);
+ my $result="?";
+
+# my $plain_filename = "$FILEPREFIX$scale-$lati-$long.gif";
+ # mapblast/1000/047/047.0232/9/map_1000-047.0232-0009.8140.gif 47.02320 9.81400 1000
+ #my $filename = "$mapserver/$scale/".int($lati)."/".sprintf("%3.1f",$lati).
+ #"/".int($long)."/$FILEPREFIX$scale-$lati-$long.gif";
+ my $filename = map_filename($scale,$lati,$long);
+
+ if ( $mapserver =~ m/^eniro_(se|dk|no|fi)$/)
+ {
+ ($url,$mapscale)=eniro_url($lati,$long,$scale);
+ }
+ elsif ( $mapserver eq 'incrementp')
+ {
+ ($url,$mapscale)=incrementp_url($lati,$long,$scale);
+ }
+ elsif ( $mapserver eq 'gov_au')
+ {
+ ($url,$mapscale)=gov_au_url($lati,$long,$scale);
+ }
+ elsif ( $mapserver eq 'geoscience')
+ {
+ ($url,$mapscale)=geoscience_url($lati,$long,$scale);
+ }
+ elsif ( $mapserver eq 'landsat')
+ {
+ ($url,$mapscale)=landsat_url($lati,$long,$scale);
+ }
+ else
+ {
+ print "Unknown map server :", $mapserver, "\n";
+ return "E";
+ }
+
+ return "E" unless $url;
+
+ my $mirror_filename=$filename;
+ if ( $mapserver eq 'geoscience'){
+ $mirror_filename="MIRROR/$filename";
+ debug("mirror_filename=$mirror_filename");
+ };
+
+ # create directories if not existent
+ for my $file ( ($filename , $mirror_filename ) ) {
+ my $dir = dirname("$mapdir$file");
+ unless ( -s $dir || -l $dir ) {
+ debug("Create Directory '$dir'");
+ mkpath($dir)
+ or warn "Could not create $dir:$!\n";;
+ }
+ }
+
+
+ if ( is_map_file( $filename ) ) {
+ $result= "_";
+ if ( $update_koord
+ && !defined $MAP_FILES->{$filename} ) {
+ append_koords($filename, $lati, $long, $mapscale);
+ $result= "u";
+ };
+ $existcount++;
+ } else {
+ if ( $simulate_only ) {
+ $result="S";
+ $newcount++;
+ } else {
+ debug("mirror $url");
+ if ( $mapserver eq 'gov_au') {
+ if ( mirror_map($url,$filename) ) {
+ $result = gov_au_resize($lati,$long,$scale,5,4,"$mapdir$filename");
+ append_koords($filename, $lati, $long, $mapscale);
+ $result= "+";
+ print "\nWrote $filename\n" if $debug;
+ $newcount++;
+ }
+ } elsif ( mirror_map($url,$mirror_filename) ) {
+ if ( $mapserver eq 'geoscience'){
+ $result = resize($mapdir.$mirror_filename,$mapdir.$filename);
+ }
+ append_koords($filename, $lati, $long, $mapscale);
+ $result= "+";
+ print "\nWrote $filename\n" if $debug;
+ $newcount++;
+ }
+ else
+ {
+ $failcount++;
+ $result= "E";
+ }
+ }
+ }
+
+ return $result;
+}
+
+######################################################################
+sub error_check {
+ my $status;
+
+ return 0 if $check_koord_file;
+ return 0 if $check_coverage;
+ return 0 if $TRACK_FILE;
+ if ($cover_route) {
+ my $num = @ARGV;
+ if ($num < 2) {
+ print "ERROR: You must supply at least two waypoints\n\n";
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+
+ # Check for a centerpoint
+ unless (($waypoint) || ($lat && $lon) || ($slat && $endlat && $slon && $endlon)) {
+ print "ERROR: You must supply a waypoint, latitude and longitude coordinates or starting and ending coordinates for both latitude and longitude\n\n";
+ $status++;
+ }
+
+ # Check for area
+ unless ($area || ($slat && $endlat && $slon && $endlon)) {
+ print "ERROR: You must define an area to cover or starting and ending coordinates for both latitude and longitude\n\n";
+ $status++;
+ }
+
+ return $status;
+}
+
+######################################################################
+sub get_scales {
+ my ($scale_ref) = @_;
+ # OK lets figure out what scales they want
+ #
+ # '####' - just that scale
+ # '>####' - scales above and including the number given
+ # '<####' - scales below and including the number given
+ # '####,####,####' - a list of scales to download
+ # '####-####' - scales from first to last
+ #
+ my @scales_to_get;
+ for my $temp_scale (split /,/, $$scale_ref) {
+ if ($temp_scale =~ /^\d+$/) {
+ unless (grep (/$temp_scale/, @SCALES)){
+ print STDERR "\n";
+ print STDERR "Wrong scale $temp_scale\n";
+ print STDERR "Allowed scales: ".join(", ",@SCALES)."\n";
+ print STDERR "\n";
+ pod2usage(1);
+ }
+ push(@scales_to_get,$temp_scale);
+ } elsif ($temp_scale =~ /^>\d+$/) {
+ $temp_scale =~ s/>//;
+ push(@scales_to_get, grep ($_ >= $temp_scale, @SCALES));
+ } elsif ($temp_scale =~ /^<\d+$/) {
+ $temp_scale =~ s/<//;
+ push(@scales_to_get, grep ($_ <= $temp_scale, @SCALES));
+ } elsif ($temp_scale =~ /-/) {
+ my(@NUMS) = split(/-/,$temp_scale);
+ @NUMS = sort {$a <=> $b} @NUMS;
+ push(@scales_to_get, grep (($_ >= $NUMS[0]) && ($_ <= $NUMS[1]), @SCALES));
+ } else {
+ pod2usage(1);
+ }
+ }
+ return \@scales_to_get;
+} #End get_scales
+
+#############################################################################
+sub eniro_url($$$){
+ my $lati = shift;
+ my $long = shift;
+ my $scale = shift;
+
+ my $mapscale = $scale;
+
+
+ my $zoom = undef;
+ my $url='';
+
+ my %factor = ( 1 => 18000000, # 480 Km
+ 2 => 3200000, # 80 Km
+ 3 => 400000, # 10 Km
+ 4 => 200000, # 4 Km
+ 5 => 100000, # 1.1 Km
+ 6 => 20000, # 400 m
+ 7 => 5000, # 160 m
+ );
+ for my $f ( sort keys %factor ) {
+ my $test_scale = $factor{$f};
+ if ( $debug) {
+# print "testing $f: against $test_scale\n";
+ }
+ if ( $test_scale <= $scale ) {
+ $zoom = $f;
+ $mapscale = $test_scale;
+ last;
+ }
+ }
+ unless ( $zoom ) {
+ print "Error calculating Zommlevel for Scale: $scale\n";
+ return (undef,undef);
+ }
+
+ if ($debug) {
+ printf "Eniro : lat: %.4f lon: %.4f\t",$lati,$long;
+ print "using zoom ", $zoom, " for requested scale ", $scale, ":1 actual scale ", $mapscale, ":1\n";
+ }
+
+ my ( $eniro_country ) = ($mapserver =~ m/^eniro_(se|dk|no|fi)$/);
+
+
+ if ( $eniro_country eq "dk"
+ || # Add real restriction for Denmark
+ ( $lati > 54.67694 ) && ( $lati < 56.71874 ) &&
+ ( $long > 7.77864 ) && ( $long < 13.40111 )
+ ) {
+ print "Daenmark ($lati,$long)\n" if $debug;
+ $url = "http://maps.eniro.$eniro_country/servlets/${eniro_country}_MapImageLocator?profile=Main";
+ $url .= sprintf("&center=%10.4f;%10.4f",($lati*10000),($long*10000));
+ $url .= "&zoomlevel=$zoom";
+ $url .= "&size=1280x1024";
+ $url .= "&symbols=";
+ } else { # Add here restriction for Norway
+ print "Norway ($lati,$long)\n" if $debug;
+ $url = "http://maps.eniro.$eniro_country/servlets/${eniro_country}_MapImageLocator?profile=Main";
+ $url .= sprintf("&center=%.4f;%.4f",$long,$lati);
+ $url .= "&zoomlevel=$zoom";
+ $url .= "&size=1280x1024";
+ $url .= "&symbols";
+ }
+
+ return ($url,$mapscale);
+}
+
+#############################################################################
+sub incrementp_url($$$){
+ my $lati = shift;
+ my $long = shift;
+ my $scale = shift;
+
+ my $mapscale = $scale;
+
+ my $zoom = undef;
+ my $url='';
+ for my $s ( sort keys %{$Scale2Zoom->{incrementp}} ) {
+ next unless $s > $scale;
+ $zoom = $Scale2Zoom->{incrementp}->{$s};
+ $mapscale = $s;
+ last;
+ }
+
+ unless ( $zoom ) {
+ print "Error calculating Zoomlevel for Scale: $scale\n";
+ return (undef,undef);
+ }
+
+ if ($debug) {
+ printf "Incrementp : lat: %.4f lon: %.4f\t",$lati,$long;
+ print "using zoom ", $zoom, " for requested scale ", $scale, ":1 actual scale ", $mapscale, ":1\n";
+ }
+
+ $url = "http://mapserv.incrementp.co.jp/cgi-bin/map/mapserv.cgi?";
+
+{
+ my $lat1 = ($lati>0 ? "E" :"W" );
+ $lat1 .= int($lati);
+ $lat1 .= sprintf(".%.0f",($lati-int($lati))/60);
+
+ my $lon1 = ($lati>0 ? "N" :"S" );
+ $lon1 .= int($long);
+ $lon1 .= sprintf(".%.0f",($long-int($long))/60);
+ # MAP=E127.48.26.8N26.19.49.3
+ $url .= sprintf("MAP=%s%s",$lat1,$lon1);
+}
+
+$url .= "&OPT=e0000011";
+$url .= "&ZM=$zoom";
+$url .= "&SZ=1200,1200";
+$url .= "&COL=1";
+
+return ($url,$mapscale);
+}
+
+#############################################################################
+sub gov_au_url($$$){
+ my $lati = shift;
+ my $long = shift;
+ my $scale = shift;
+
+ my $mapscale = $scale;
+ my $zoom = undef;
+ my $url = '';
+ for my $s ( sort keys %{$Scale2Zoom->{incrementp}} ) {
+ next unless $s > $scale;
+ $zoom = $Scale2Zoom->{incrementp}->{$s};
+ $mapscale = $s;
+ last;
+ }
+ unless ( $zoom ) {
+ print "Error calculating Zommlevel for Scale: $scale\n";
+ return (undef,undef);
+ }
+
+ $url = "http://www.ga.gov.au/bin/mapserv36?".
+ "map=/public/http/www/docs/map/globalmap/global_36.map".
+ "\&mode=map".
+ "\&layer=outline".
+ "\&layer=waterbodies".
+ "\&layer=capitals".
+ "\&layer=permanentriverslargescale".
+ "\&layer=fluctuatingrivers".
+ "\&layer=dualcarriage".
+ "\&layer=PrimaryPavedRoad".
+ "\&layer=roadsecpav".
+ "\&layer=roadotherpav".
+ "\&mapsize=1000+800";
+
+ # OK I'm too lazy to calculate the real start and end
+ my $fac = 1000000000;
+ my $scale_fac = ($scale/$fac);
+ my $lat1= $lati - $scale_fac;
+ my $lat2= $lati + $scale_fac;
+ my $lon1= $long - $scale_fac;
+ my $lon2= $long + $scale_fac;
+ $url .= "\&mapext=$lon1+$lat2+$lon2+$lat1";
+
+ if ($debug) {
+ printf "Gov_Au : lat: %.4f lon: %.4f\t",$lati,$long;
+ print "using zoom $zoom for requested scale $scale\n";
+ print "actual scale $mapscale with scalefac: $scale_fac\n";
+ print "URL: \n$url\n";
+ };
+
+ return ($url,$mapscale);
+}
+
+#############################################################################
+sub landsat_url($$$){
+ my $lat = shift;
+ my $lon = shift;
+ my $scale = shift;
+
+ my $factor = $Scale2Zoom->{'landsat'}->{$scale};
+
+ my $deltalat = 0.0005;
+ my $deltalon = 0.001; # Gives ratio 1.2 in meter
+
+ my $lon1 = $lon-$deltalon*$factor/2;
+ my $lat1 = $lat-$deltalat*$factor/2;
+ my $lon2 = $lon+$deltalon*$factor/2;
+ my $lat2 = $lat+$deltalat*$factor/2;
+
+ debug( "landsat_url(LAT=$lat,LON=$lon,SCALE=$scale,FACTOR=$factor)");
+
+ debug( "Calculated Lat1 $lat1");
+ debug( "Calculated Lat2 $lat2");
+ debug( "Calculated Lon1 $lon1");
+ debug( "Calculated Lon2 $lon2");
+
+ # Build the URL
+ my $url='';
+ $url .= "http://onearth.jpl.nasa.gov/wms.cgi";
+ $url .= '?request=GetMap';
+ $url .= '&width=1280';
+ $url .= '&height=1024';
+ $url .= '&layers=global_mosaic';
+ $url .= '&styles=';
+ $url .= '&srs=EPSG:4326';
+# $url .= '&format=image/gif';
+ $url .= '&format=image/jpeg';
+
+ # Add the 4 Coordinates.
+ $url .= '&bbox='; # '15.3,58.35,15.5,58.45';
+ $url .= "$lon1,$lat1,$lon2,$lat2";
+# $url .= sprintf("%.5f",$lon1).",";
+# $url .= sprintf("%.5f",$lat1).",";
+# $url .= sprintf("%.5f",$lon2).",";
+# $url .= sprintf("%.5f",$lat2);
+
+ return ($url,$scale);
+}
+
+
+#############################################################################
+sub geoscience_url($$$){
+ my $gs_lati = shift;
+ my $gs_long = shift;
+ my $gs_scale = shift;
+
+ debug( "geoscience_url(LATI=$gs_lati,LONG=$gs_long,SCALE=$gs_scale)");
+
+ my $url='';
+ my $factor = $Scale2Zoom->{'geoscience'}->{$gs_scale};
+ my $latioffset = 0.6*$factor;
+ my $longoffset = 0.8*$factor;
+ my $lati1 = $gs_lati + $latioffset;
+ my $lati2 = $gs_lati - $latioffset;
+ my $long1 = $gs_long - $longoffset;
+ my $long2 = $gs_long + $longoffset;
+ debug( "Calculated Lat1 $lati1");
+ debug( "Calculated Lat2 $lati2");
+ debug( "Calculated Long1 $long1");
+ debug( "Calculated Long2 $long2");
+
+ # Build the URL
+ $url = "http://www.ga.gov.au/bin/mapserv36"
+ ."?map=/public/http/www/docs/map/globalmap/global_36.map";
+ $url .= '&mode=map';
+ # Add the 4 Coordinates.
+ $url .= '&mapext=';
+ $url .= sprintf("%.5f",$long1)."+";
+ $url .= sprintf("%.5f",$lati1)."+";
+ $url .= sprintf("%.5f",$long2)."+";
+ $url .= sprintf("%.5f",$lati2);
+
+ # Add all the different layers
+ $url .= '&layer=outline';
+ $url .= '&layer=waterbodies';
+ $url .= '&layer=capitals';
+ $url .= '&layer=statenames';
+ $url .= '&layer=permanentriverslargescale';
+ $url .= '&layer=fluctuatingrivers';
+ $url .= '&layer=streams';
+ $url .= '&layer=builtup';
+ $url .= '&layer=dualcarriage';
+ $url .= '&layer=PrimaryPavedRoad';
+ $url .= '&layer=PrimaryUnpavedRoad' unless $scale >665924;
+ $url .= '&layer=roadsecpav' unless $scale >665924;
+ $url .= '&layer=roadsecnotpav' unless $scale >665924;
+ $url .= '&layer=roadotherpav' unless $scale >665924;
+ $url .= '&layer=roadothernotpav' unless $scale >665924;
+ $url .= '&layer=bridge' unless $scale >665924;
+ $url .= '&layer=railways';
+ $url .= '&layer=railyard' unless $scale >665924;
+ $url .= '&layer=airports';
+ $url .= '&layer=localities';
+ $url .= '&layer=index250k' if $debug; # 250K MapSheet Outlines
+ # Add the map size
+ $url .= "\&mapsize=1000+800";
+# $url .= "\&mapsize=1024+820";
+
+ return ($url,$gs_scale);
+}
+#############################################################################
+# Note: The resize will only work if the image you want to resize has
+# the same aspect ratio as 1280x1024
+# i.e. 1280/1024=1.25
+# 1000/800=1.25
+#############################################################################
+sub resize($$){
+ my $src_filename = shift;
+ my $dst_filename = shift;
+
+ my $x='';
+ my $image='';
+
+ debug( "resize( $src_filename --> $dst_filename)" );
+
+ $image = Image::Magick->new;
+ $x = $image->Read($src_filename);
+ if( $x ) {
+ undef $image;
+ warn "\npic_resize($src_filename,$dst_filename) open: $x\n" ;
+ return 0;
+ }
+ $x = $image->Sample(geometry => "1280x1024+10+10");
+ if( $x ) {
+ undef $image;
+ warn "\npic_resize($src_filename,$dst_filename) _resize: $x\n" ;
+ return 0;
+ }
+ $x = $image->Write($dst_filename);
+ if( $x ) {
+ undef $image;
+ warn "\npic_resize($src_filename,$dst_filename)_write: $x\n" ;
+ return 0;
+ }
+ undef $image;
+}
+
+#############################################################################
+# This function only once calculates
+# which lat/lon/scale Combinations are desired to download
+# Args:
+# $slat,$slon : Start latitude /longitude
+# $elat,$elon : End latitude /longitude
+# Returns:
+# $desired_locations->{$scale}->{$lati}->{$long}='?';
+#############################################################################
+sub desired_locations {
+ my $desired_locations = shift;
+ my ($slat,$slon,$elat,$elon) = @_;
+ my $count;
+
+ my $local_debug = 0 && $debug;
+
+ my $min_lat=-90;
+ my $max_lat= 90;
+ my $min_lon=-180;
+ my $max_lon= 180;
+ if ( $slat < $min_lat ) { warn ("Starting Latitude ($slat) set to $min_lat\n"); $slat=$min_lat; };
+ if ( $elat > $max_lat ) { warn ("End Latitude ($elat) set to $max_lat\n"); $elat=$max_lat; };
+ if ( $slon < $min_lon ) { warn ("Starting Longitude ($slon) set to $min_lon\n"); $slon=$min_lon; };
+ if ( $elon > $max_lon ) { warn ("End Longitude ($elon) set to $max_lon\n"); $elon=$max_lon; };
+
+ foreach my $scale ( sort {$b <=> $a} @{$SCALES_TO_GET_ref} ) {
+ # Setup k
+ my $k = $DIFF * $scale;
+ my $delta_lat = $k - ($k / 2); ### FIX BY CAMEL
+ my $delta_lon = $k - ($k / 6); ### FIX BY CAMEL
+ #TODO: $delta_lon sollte von lat abhaengen
+
+ # make the starting points for the loop $slat and $slon
+ # snap into a grid with a Size depending on the scale.
+ # The result is $snapped_start_lat and $snapped_start_lon
+ # The grid allows maps in each direction to
+ # overlapp by 1/$overlap of the size of one map
+ # With snap to grid we would have to download the exact same maps
+ # for slightly different starting points. This way we can
+ # circumvent downloads of almost completely overlaping maps
+ my $overlap = 1;
+ my $flat = $delta_lat / $overlap;
+ my $snapped_start_lat = int ( $slat / $flat ) * $flat;
+ my $flon = $delta_lon / $overlap;
+ my $snapped_start_lon = int ( $slon / $flon ) * $flon;
+
+ print "Scale: $scale\t";
+ printf " lati: %6.5f(%6.5f) +=%5.5f ... %6.5f\n",
+ $snapped_start_lat,$slat,$delta_lat,$elat;
+
+ my $lati = $snapped_start_lat;
+
+ while (($lati <= $elat) || (!$count)) {
+ my $long = $snapped_start_lon;
+ if ( $local_debug ) {
+ printf " %5.5f:",$lati;
+ printf "\tlong: %6.4f(%6.4f) +=%5.4f ... %6.4f"
+ ,$snapped_start_lon,$slon,$delta_lon,$elon;
+ printf "\t\t";
+ }
+ while (($long <= $elon) || (!$count)) {
+ $desired_locations->{$scale}->{$lati}->{$long} ||='?';
+
+ if ( $local_debug ) {
+ my $filename = map_filename($scale,$lati,$long);
+ my $exist = ( is_map_file($filename) ) ? " ":"+";
+
+ printf " %6.3f %1s",$long,$exist;
+ }
+ $long += $delta_lon; ### FIX BY CAMEL
+ $count++;
+ }
+ print "\n" if $local_debug;
+ $lati += $delta_lat; ### FIX BY CAMEL
+ $long = $slon; ### FIX BY CAMEL
+ }
+ }
+}
+
+######################################################################
+# Count the Number of Files to be retrieved
+# Returns: ($existing,$wanted)
+# $existing : Number of existing maps
+# $wanted : Number of maps to be retrieved
+######################################################################
+sub file_count($){
+ my $desired_locations = shift;
+ my $existing=0;
+ my $wanted=0;
+ for my $scale ( keys %{$desired_locations} ) {
+ for my $lat ( keys %{$desired_locations->{$scale}} ) {
+ for my $lon ( keys %{$desired_locations->{$scale}->{$lat}} ) {
+ my $filename = map_filename($scale,$lat,$lon);
+ if ( is_map_file($filename) ) {
+ $existing++;
+ } else{
+ $wanted++;
+ }
+ }
+ }
+ }
+ return($existing,$wanted);
+} #end file_count
+
+######################################################################
+sub get_waypoint($) {
+ my $waypoint = shift;
+
+ # If they give just a filename, we should assume they meant the CONFIG_DIR
+ $WAYPT_FILE = "$CONFIG_DIR/$WAYPT_FILE" unless ($WAYPT_FILE =~ /\//);
+
+ open(WAYPT,"$WAYPT_FILE") || die "ERROR: get_waypoint Can't open: $WAYPT_FILE: $!\n";
+ my ($name,$lat,$lon);
+ while (<WAYPT>) {
+ chomp;
+ next unless (/$waypoint/);
+ ($name,$lat,$lon) = split(/\s+/);
+ }
+ close(WAYPT);
+ unless (($lat) && ($lon)) {
+ print "Unable to find waypoint '$waypoint' in '$WAYPT_FILE'\n";
+ exit;
+ }
+ return($lat,$lon);
+} #End get_waypoint
+
+
+######################################################################
+# Read the config File (~/.gpsdrive/gpsdriverc)
+# and return all Config Keys as a Hash reference
+sub read_config {
+ # If they give just a filename, we should assume they meant the CONFIG_DIR
+ $CONFIG_FILE = "$CONFIG_DIR/$CONFIG_FILE" unless ($CONFIG_FILE =~ /\//);
+
+ # If not specified on the command line, we read from the config file
+ open(CONFIG,"$CONFIG_FILE") || die "ERROR: get_unit Can't open $CONFIG_FILE: $!\n";
+
+ my $cfg = {};
+ while (my $line = <CONFIG>) {
+ chomp $line;
+ my ($key,$val) = split(/\s*=\s*/,$line);
+ $cfg->{lc($key)} = $val
+ if $key;
+ }
+ close(CONFIG);
+ return $cfg;
+} #End read_config
+
+######################################################################
+sub get_coords {
+ my ($lat,$lon,$area,$unit) = @_;
+
+ # Figure out if we are doing square area or a rectangle
+ my ($lat_dist,$lon_dist);
+ if ($area =~ /x/i) {
+ ($lat_dist,$lon_dist) = split(/x/i,$area);
+ } else {
+ $lat_dist = $area;
+ $lon_dist = $area;
+ }
+ print "Latitude distance: $lat_dist, Longitude distance: $lon_dist\n" if ($debug);
+
+ my $lon_dist_km = calc_lon_dist($lat);
+ my $lat_offset = calc_offset($unit,$lat_dist,\$LAT_DIST_KM);
+ my $lon_offset = calc_offset($unit,$lon_dist,\$lon_dist_km);
+
+# print "LAT_OFFSET = $$lat_offset LON_OFFSET = $$lon_offset \n" if ($debug);
+
+ # Ok subtract the offset for the start point
+ my $slat = $lat - $lat_offset;
+ my $slon = $lon - $lon_offset;
+
+ # Ok add the offset for the start point
+ my $elat = $lat + $lat_offset;
+ my $elon = $lon + $lon_offset;
+
+ return ($slat,$slon,$elat,$elon);
+} #End get_coords
+
+######################################################################
+sub calc_offset {
+ my($unit,$area,$dist_per_degree) = @_;
+ # Adjust the dist_per_degree for the unit chosen by the user
+ if ($unit =~ /miles/) {
+ $$dist_per_degree *= $KM2MILES;
+ } elsif ($unit =~ /nautic/) {
+ $$dist_per_degree *= $KM2NAUTICAL;
+ }
+
+ # The offset for the coordinate is the distance to travel divided by
+ # the dist per degree
+ my $offset = sprintf("%.7f", ($area / 2) / $$dist_per_degree);
+
+ #print "-\n".Dumper($area,\$dist_per_degree,$offset);
+ return($offset);
+} #End calc_offset
+
+######################################################################
+# Opens a track file and returns two identically sized arrays,
+# one that contains the latitudes and other that contains the
+# longitudes.
+######################################################################
+sub get_coords_for_track($) {
+ my $filename = shift;
+
+ my @lats;
+ my @lons;
+ print "Opening Track file: $filename\n" if $debug;
+ my $fh = IO::File->new("<$filename");
+ $fh or die("Error: $!");
+
+ my ($la, $lo, $oldla, $oldlo, $line, $delta_la, $delta_lo, $rest);
+ my ($step_la, $step_lo, $ste_la, $ste_lo);
+
+ my $max_lat= 180;
+ my $max_lon= 90;
+
+ $oldla = 0;
+ $oldlo = 0;
+ $step_la = ($DIFF * $scale) - ($DIFF * $scale) / 2;
+ $step_lo = ($DIFF * $scale) - ($DIFF * $scale) / 1.5;
+
+ # loop through each line of the track file
+ while ($line = $fh->getline()) {
+ $line =~ s/^\s+//;
+ chomp $line;
+ ($la,$lo,$rest) = split(/\s+/, $line, 3);
+
+ # Disallow blank lines, as gpsreplay uses them. Also disallow
+ # blank (undefined) fields in case of other possible
+ # wierdnesses.
+
+ next if (!defined($lo));
+ next if (!defined($la));
+
+ debug("pre-regex: ($la|$lo|$rest)");
+ # Now a regex (applied to both lat & long) to drop cruft like
+ # leading text or trailing commas. Skip over anything that is
+ # not a digit, minus sign or decimal point. Then extract
+ # either an optional minus sign, one or more digits, a decimal
+ # point, 0 or more digits, or an optional minus sign, a
+ # decimal point and one or more digits. Ignore the rest.
+ $la =~ s/([^\d\-\.]*)(\-?\d+\.?\d*|-?\.\d+)(.*)/$2/o;
+ $lo =~ s/([^\d\-\.]*)(\-?\d+\.?\d*|-?\.\d+)(.*)/$2/o;
+ debug("post-regex: ($la|$lo|$rest)");
+ next if ( $la == 1001 ) && ( $lo == 1001) ;
+ if ((($la != $oldla) || ($lo != $oldlo)) && ($la < $max_lat) && ($lo < $max_lon)) {
+ $delta_la = abs($la - $oldla);
+ $delta_lo = abs($lo - $oldlo);
+ if (($delta_la > $step_la) || ($delta_lo > $step_lo)) {
+ push(@lats, $la);
+ push(@lons, $lo);
+ $oldla = $la;
+ $oldlo = $lo;
+ }
+ }
+ }
+
+ # Close the file and release lock or die.
+ $fh->close() or die("Error: $!");
+ return (\@lats, \@lons);
+} # end get_coords_for_track
+
+######################################################################
+# Creates a track between given waypoints. Returns two identically
+# sized arrays, one that contains the latitudes and other that
+# contains the longitudes.
+######################################################################
+sub get_coords_for_route {
+ my @lats;
+ my @lons;
+ my @waypoints = @ARGV;
+ foreach $waypoint (@waypoints) {
+ # check if all given waypoints exist
+ &get_waypoint($waypoint);
+ }
+
+ my (@start, @end, @delta, @steps);
+ my ($la, $lo, $i, $j);
+
+ my $step_la = ($DIFF * $scale) - ($DIFF * $scale) / 2;
+ my $step_lo = ($DIFF * $scale) - ($DIFF * $scale) / 1.5;
+
+ while (@waypoints > 1) {
+ # download maps for each etap
+ print("$waypoints[0] - $waypoints[1]\n");
+ @start = &get_waypoint($waypoints[0]);
+ @end = &get_waypoint($waypoints[1]);
+ shift(@waypoints);
+
+ $delta[0] = $start[0] - $end[0];
+ $delta[1] = $start[1] - $end[1];
+ $steps[0] = $delta[0] / $step_la;
+ $steps[1] = $delta[1] / $step_lo;
+ if ($steps[0] > $steps[1]) {
+ $i = abs(ceil($steps[0]));
+ } else {
+ $i = abs(ceil($steps[1]));
+ }
+ for ($j=1; $j<=$i; $j++) {
+ $la = $start[0] - ($delta[0] / $i)*$j;
+ $lo = $start[1] - ($delta[1] / $i)*$j;
+ push(@lats, $la);
+ push(@lons, $lo);
+ }
+ }
+ return (\@lats, \@lons);
+} #End get_coords_for_track
+
+
+######################################################################
+# Return KM/degree for this latitude
+######################################################################
+sub calc_lon_dist {
+ my $lat = shift;
+
+ my $PI = 3.141592654;
+ my $dr = $PI / 180;
+
+ # calculate the circumference of the small circle at latitude
+ my $cos = cos($lat * $dr); # convert degrees to radians
+ my $circ_km = sprintf("%.2f",($PI * 2 * $RADIUS_KM * $cos));
+
+ # divide that by 360 and you have kilometers per degree
+ my $km_deg = sprintf("%.2f",($circ_km / 360));
+
+ return ($km_deg);
+} #End calc_longitude_dist
+
+######################################################################
+# Check if Map-image is valid and append one Entry to the map_koord File
+# Returns:
+# A for Appended
+# E for Error
+######################################################################
+sub append_koords($$$$) {
+ my $filename = shift;
+ my $lati = shift;
+ my $long = shift;
+ my $mapscale = shift;
+
+ # eliminate map_Directory prefix
+ $filename =~ s,^$mapdir,,;
+
+ die "Missing Params to append_koords($filename,$lati,$long,$mapscale)\n"
+ unless $filename && defined($lati) && defined($long) && $mapscale;
+
+
+ if ( is_map_file($filename) ) {
+ # print "$filename $lati $long $mapscale\n";
+ } elsif ( ! -s "$mapdir/$filename" ) {
+ print "Fehler $filename leer/existiert nicht\n";
+ return 'E';
+ } else {
+ print "Fehler $filename ist kein mapfile\n";
+ return 'E';
+ }
+
+ if ( ! defined $MAP_FILES->{$filename} ) {
+ debug("Appending $filename,$lati, $long, $mapscale to $KOORD_FILE");
+ open(KOORD,">>$KOORD_FILE") || die "ERROR: append_koords can't open: $KOORD_FILE: $!\n";
+ printf KOORD "$filename %17.13f %17.13f %17d\n",$lati, $long, $mapscale;
+ close KOORD;
+ $MAP_FILES->{$filename} = "$lati, $long, $mapscale";
+ $MAP_KOORDS->{$mapscale}->{$lati}->{$long} = 1;
+ }
+
+ if ( -s $GPSTOOL_MAP_FILE ) {
+ if ( ! defined $GPSTOOL_MAP_FILES->{$filename} ) {
+ open(KOORD,">>$GPSTOOL_MAP_FILE") ||
+ die "ERROR: append_koords can't open: $GPSTOOL_MAP_FILE: $!\n";
+ printf KOORD "$mapdir/$filename %17.13f %17.13f %4d 1280 1024\n",$lati, $long, $mapscale;
+ close KOORD;
+ $GPSTOOL_MAP_FILES->{$filename} = "$lati, $long, $mapscale";
+ $GPSTOOL_MAP_KOORDS->{$mapscale}->{$lati}->{$long} = 1;
+ }
+ }
+
+ return 'A';
+} # End append_koords
+
+
+#############################################################################
+# Read actual Koordinate File and memorize in $MAP_KOORDS and $MAP_FILES
+sub read_koord_file($) {
+ my $koord_file = shift;
+
+ $MAP_FILES={};
+
+ my $s_time=time();
+ unless ( -s $koord_file ) {
+ warn "ERROR: read_koord_file sees empty file '$koord_file'\n";
+ return;
+ };
+ print "reading $koord_file\n";
+ open(KOORD,"<$koord_file") || die "ERROR: read_kooord_file can't open: $koord_file: $!\n";
+ my $anz_files = 0;
+ while ( my $line = <KOORD> ) {
+ my ($filename ,$lati, $long, $mapscale);
+ ($filename ,$lati, $long, $mapscale) = split( /\s+/ , $line );
+ if ( is_map_file( $filename ) ) {
+ $MAP_KOORDS->{$mapscale}->{$lati}->{$long} = 1;
+ $MAP_FILES->{$filename} = "$lati, $long, $mapscale";
+ $anz_files ++;
+ } else {
+ warn "ERROR: read_koord_file is missing File $filename\n";
+ };
+ }
+ close KOORD;
+ my $r_time = time()-$s_time;
+ print "$koord_file read $anz_files in $r_time sec.\n";
+
+}
+
+#############################################################################
+# Read actual Koordinate File and memorize in $GPSTOOL_MAP_KOORDS and $GPSTOOL_MAP_FILES
+sub read_gpstool_map_file() {
+ my $koord_file = $GPSTOOL_MAP_FILE;
+ my $s_time=time();
+ return unless -s $koord_file;
+ print "reading $koord_file\n";
+ open(KOORD,"<$koord_file") || die "ERROR: read_gpstool_map_file can't open: $koord_file: $!\n";
+ my $anz_files = 0;
+ while ( my $line = <KOORD> ) {
+ my ($filename ,$lati, $long, $mapscale);
+ ($filename ,$lati, $long, $mapscale) = split( /\s+/ , $line );
+ if ( is_map_file( $filename) ) {
+ $GPSTOOL_MAP_KOORDS->{$mapscale}->{$lati}->{$long} = 1;
+ $GPSTOOL_MAP_FILES->{$filename} = "$lati, $long, $mapscale";
+ $anz_files ++;
+ }
+ }
+ close KOORD;
+ my $r_time = time()-$s_time;
+ print "$koord_file read $anz_files in $r_time sec.\n";
+
+}
+
+#############################################################################
+# Read actual Koordinate File (gpstool)
+# and check if all Files it references are existing
+sub check_koord_file($) {
+ my $koord_file = shift;
+ # Change into the gpsdrive maps directory
+
+ print "Checking all entries in $koord_file\n" if $debug;
+ $MAP_FILES={};
+ my $anz_files = 0;
+ my $missing_files =0;
+ if ( -s $koord_file ) {
+ open(KOORD,"<$koord_file") || die "ERROR: check_koord_file can't open: $koord_file: $!\n";
+ while ( my $line = <KOORD> ) {
+ my ($filename ,$lati, $long, $mapscale);
+ ($filename ,$lati, $long, $mapscale) = split( /\s+/ , $line );
+ my $full_filename = "$CONFIG_DIR/maps/$filename";
+
+# debug("Checking ($filename ,$lati, $long, $mapscale)");
+
+ if ( !is_map_file( $full_filename ) ) {
+ print "ERROR: File $full_filename not found\n";
+ $missing_files ++;
+ } else {
+ debug("OK: File $full_filename found");
+ $MAP_KOORDS->{$mapscale}->{$lati}->{$long} = 1;
+ if ( $MAP_FILES->{$filename} ) {
+ print "ERROR: Duplicate File $full_filename found\n";
+ };
+ $MAP_FILES->{$filename} = "$lati, $long, $mapscale";
+ $anz_files ++;
+ }
+ }
+ close KOORD;
+ print "Good files: $anz_files\n";
+ }
+ if ( $missing_files ) {
+ print "Missing Files: $missing_files\n";
+ open(KOORD,">$koord_file.new") || die "Can't open: $koord_file.new: $!\n";
+ foreach my $map_filename ( keys %$MAP_FILES ) {
+ printf KOORD "$map_filename %s\n", $MAP_FILES->{$map_filename};
+ }
+ close KOORD;
+ print "wrote $koord_file.new\n";
+ }
+}
+
+
+###########################################################################
+# Update Maps found in Filesystem which cannot be found in map_koords.txt
+###########################################################################
+use File::Find;
+sub update_file_in_map_koords(); # {}
+sub update_gpsdrive_map_koord_file(){
+ print "\n";
+ print "\n";
+ print "Check, if Files in Filesystem can be added to map_koord.txt\n";
+
+ debug("Searching for Files in '$mapdir'");
+ find(
+ { wanted => \&update_file_in_map_koords,
+ follow_skip => 2,
+ follow => 1
+ },
+ $mapdir, );
+}
+
+sub update_file_in_map_koords(){
+ my $filename = $File::Find::name;
+ return if -d $filename;
+ return unless $filename =~ m/\.gif$/;
+ my $short_filename = $filename;
+ $short_filename =~ s,$mapdir,,;
+# debug("Check File: $short_filename");
+ if ( $MAP_FILES->{$filename} ||
+ $MAP_FILES->{$short_filename} ) {
+# print "OK $filename\n";
+ }
+ else {
+ #mapblast/1000/047/047.0232/9/map_1000-047.0232-0009.8140.gif 47.02320 9.81400 1000
+ if ( $filename =~ m/map_(\d+)-(\d+\.\d+)-(\d+\.\d+)\.gif/ ) {
+ my $scale=$1;
+ my $lati=$2;
+ my $long=$3;
+# my ($url,$mapscale)=expedia_url($lati,$long,$scale);
+ for my $s (sort keys %{$Scale2Zoom->{$mapserver}} ) {
+ next unless $s == $scale;
+ $scale = $s;
+ last;
+ }
+# print "Appending File: $filename\n";
+ append_koords($short_filename, $lati, $long, $scale);
+ debug("File:$filename lat:$lati lon:$long");
+ }
+
+ }
+}
+
+
+######################################################################
+# See which area the maps cover
+######################################################################
+sub check_coverage($){
+ my $koord_file = shift;
+ read_koord_file($koord_file);
+ my @scales= sort {$b <=> $a} keys %{$MAP_KOORDS};
+
+ for my $scale ( @scales ) {
+ print "$scale:\n";;
+
+ my @all_lons;
+ my %all_lons;
+ my @lats = sort {$a <=> $b} keys %{$MAP_KOORDS->{$scale}};
+ for my $lat ( @lats ) {
+ my @lons = keys %{$MAP_KOORDS->{$scale}->{$lat}};
+ for my $lon ( @lons ) {
+ push (@all_lons, $lon)
+ unless $all_lons{$lon}++;
+ }
+ }
+
+ my $first_lon = $all_lons[0];
+ my $last_lon = $all_lons[-1];
+
+ print "lon: ($first_lon - $last_lon))\n";
+ print "lat: (desiredDistance, minDistance - maxDistance) Km\n";
+
+ for my $lat ( @lats ) {
+ printf " %7.4f: ", $lat;
+ my @lons = sort {$a <=> $b} keys %{$MAP_KOORDS->{$scale}->{$lat}};
+ my %lons;
+ map { $lons{$_}++ } @lons;
+
+
+ # Find out which is the desired Distance
+ my $lon_dist_km = calc_lon_dist($lat);
+ my $k = $DIFF * $scale;
+ my $delta_lat = $k - ($k / 2); my $dlat = $delta_lat * $LAT_DIST_KM;
+ my $delta_lon = $k - ($k / 6); my $dlon = $delta_lon * $lon_dist_km;
+
+ # Find Min and Max Distance between 2 Maps
+ my $min_dist= $RADIUS_KM;
+ my $max_dist=0;
+ my $count_overlaps=0;
+ my $prev_lon;
+ my %gap;
+ my %overlap;
+ for my $lon ( sort {$a <=> $b} @all_lons ) {
+ if ( defined $prev_lon ) {
+ my $dist = abs($lon - $prev_lon) * $lon_dist_km;
+ if( $dist < ($dlon * 0.9)) {
+ $overlap{$lon}++;
+ $count_overlaps++;
+ }
+
+ $gap{$lon}=$dist /$dlon if $dist > ($dlon * 1.2);
+ $min_dist = $dist if $dist < $min_dist;
+ $max_dist = $dist if $dist > $max_dist;
+ }
+ #print "Dist: ( $min_dist - $max_dist) Km ($prev_lon => $lon = ".($prev_lon -$lon).")\n";
+ $prev_lon = $lon;
+ };
+
+ printf " (%.2f,%.2f - %.2f) Km\t",$dlon,$min_dist,$max_dist;
+ printf " %d Overlaps\t",$count_overlaps if $count_overlaps;
+ #*= $LAT_DIST_KM;
+
+
+
+ # Print +/- for existing/non-existing Map
+ for my $lon ( @all_lons ) {
+# printf "%7.4f ", $lon;
+ # Print Number of Tiles missing(gap) between last(left) map and this one
+ printf " -%.0f ",$gap{$lon} if $gap{$lon};
+
+ if ( $lons{$lon} ) {
+ if ( $overlap{$lon} ) {
+ print "o";
+ } else {
+ print "+";
+ }
+ } else {
+ print "-";
+ }
+ }
+ print "\n";
+ }
+ print "\n";
+ }
+ print "\n";
+}
+
+#############################################################################
+# Debug
+#############################################################################
+sub debug($){
+ my $msg = shift;
+ return unless $debug;
+ print STDERR "DEBUG: $msg\n";
+}
+
+#################################################################################
+
+__END__
+
+=head1 NAME
+
+B<gpsfetchmap> Version 1.04
+
+=head1 DESCRIPTION
+
+B<gpsfetchmap> is a program to download maps from a mapserver for use with gpsdrive.
+
+=head1 SYNOPSIS
+
+B<Common usages:>
+
+gpsfetchmap -w <WAYPOINT NAME> -sc <SCALE> -a <#> -p
+
+gpsfetchmap -la <latitude MM.DDDD> -lo <latitude MM.DDDD> -sc <SCALE> -a <#> -p
+
+gpsfetchmap -sla <start latitude MM.DDDD> -endla <end latitude MM.DDDD> -slo <start longitude MM.DDDD> -endlo <end longitude MM.DDDD> -sc <SCALE> -a <#> -p
+
+gpsfetchmap -sc <SCALE> -a <#> -r <WAYPOINT 1> <WAYPOINT 2> ... <WAYPOINT n> -p
+
+B<All options:>
+
+gpsfetchmap [-w <WAYPOINT NAME>]
+ [-la <latitude DD.MMMM>] [-lo <longitude DD.MMMM>]
+ [-sla <start latitude DD.MMMM>] [-endla <end latitude DD.MMMM>]
+ [-slo <start longitude DD.MMMM>] [-endlo <end longitude DD.MMMM>]
+ [-sc <SCALE>] [-a <#>] [-p] [-m <MAPSERVER>]
+ [-u <UNIT>] [-md <DIR>] [-W <FILE>] [-t <FILE>] [-r]
+ [-C <FILE>] [-P <PREFIX>] [-F] [-d] [-v] [-h] [-M] [-n] [-U] [-c]
+
+=head1 OPTIONS
+
+=over 8
+
+=item B<-w, --waypoint <WAYPOINT NAME>>
+
+Takes a waypoint name and uses the latitude and longitude for that waypoint as
+the centerpoint of the area to be covered. Waypoints are read from 'way.txt',
+or file defined by '-W'.
+the special name gpsd asks your local gpsd where your gps thinks you are and uses
+this point as center.
+This, '-la' and '-lo', '-sla', '-ela', '-slo' and '-elo' or '-a' is required.
+A special name is gpsd this waypoint asks your gps where you currently are.
+
+=item B<-la, --lat <latitude DD.MMMM>>
+
+Takes a latitude in format DD.MMMM and uses that as the latitude for the centerpoint of the area
+to be covered. Will be overriden by the latitude of waypoint if '-w' is used. This and '-lo', '-w' or '-sla', '-ela', '-slo', '-elo' is required.
+
+=item B<-lo, --lon <longitude DD.MMMM>>
+
+Takes a longitude in format DD.MMMM and uses that as the longitude for the centerpoint of the area
+to be covered. Will be overriden by the longitude of waypoint if '-w' is used. This and '-la', '-w' or '-sla', '-ela', '-slo', '-elo' is required.
+
+=item B<-sla --start-lat <start latitude DD.MMMM>>
+
+Takes a latitude in format DD.MMMM and uses that as the start latitude for the area to be covered. Will override '-la' and '-lo' but will be overriden by '-w'. This, '-ela', '-slo' and '-elo' or '-w' or '-la' and '-lo' is required.
+
+=item B<-ela --end-lat <end latitude DD.MMMM>>
+
+Takes a latitude in format DD.MMMM and uses that as the end latitude for the area to be covered. Will override '-la' and '-lo' but will be overriden by '-w'.
+This, '-sla', '-slo' and '-elo' or '-w' or '-la' and '-lo' is required.
+
+=item B<-slo --start-lon <start longitude DD.MMMM>>
+
+Takes a longitude in format DD.MMMM and uses that as the start longitude for the area to be covered. Will override '-la' and '-lo' but will be overriden by '-w'. This, '-sla', '-ela' and '-elo' or '-w' or '-la' and '-lo' is required.
+
+=item B<-elo --end-lon <end longitude DD.MMMM>>
+
+Takes a longitude in format DD.MMMM and uses that as the end longitude for the area to be covered. Will override '-la' and '-lo' but will be overriden by '-w'. This, '-sla', '-ela' and '-slo' or '-w' or '-la' and '-lo' is required.
+
+=item B<-sc, --scale <SCALE>>
+
+Scales of map(s) to download. Default: 50000.
+
+Formats:
+
+ '####'
+ - Just this scale.
+
+ '####,####,####'
+ - All scales in the list. May be combined with other formats.
+
+ '>####'
+ - All scales above and including the number given.
+
+ '<####'
+ - All scales below and including the number given.
+
+ '####-####'
+ - All scales from first to last number given.
+
+=item B<-a, --area <#>>
+
+Area to cover. # of 'units' size square around the centerpoint. You can use a single number
+for square area. Or you can use '#x#' to do a rectangle, where the first number is distance
+latitude and the second number is distance of longitude. 'units' is read from the configuration
+file (-C) or as defined by (-u).
+
+=item B<-p, --polite>
+
+This causes the program to sleep one second between downloads to be polite to the mapserver.
+Takes an optional value of number of seconds to sleep.
+
+=item B<--mapserver <MAPSERVER>>
+
+Mapserver to download from. Default: 'landsat'.
+Currently can use: landsat
+
+geoscience, gov_au, incrementp and eniro have download stubs,
+but they are !!!NOT!!!! in the right scale.
+
+
+geoscience
+
+landsat covers the whole world with satelite Photos
+
+gov_au is for Australia
+
+incrementp for japanese Maps
+
+eniro covers:
+ eniro_se Sweden
+ eniro_dk Denmark
+ eniro_no Norway
+ eniro_fi Finnland
+
+Overview of Area covered by eniro_fi:
+ http://maps.eniro.com/servlets/fi_MapImageLocator?profile=Main&center=26.;62.&zoomlevel=1&size=800x600
+
+
+=item B<-u, --unit <UNIT>>
+
+The measurement system to use. Default is read from configuration file <-C>. Possibles are:
+miles, nautical, kilometers.
+
+=item B<--mapdir <DIR>>
+
+Override the configfiles mapdir with this value.
+
+=item B<-W, --WAYPOINT <FILE>>
+
+File to read waypoints from. Default: '~/.gpsdrive/way.txt'.
+
+=item B<-t, --track <FILE>>
+
+Download maps that are along a saved track. File is a standard track filed saved from GpsDrive.
+
+=item B<-r, --route>
+
+Download maps that are along a route defined by waypoints. You must give a list of waypoints as parameters separated with space.
+
+=item B<-C, --CONFIG>
+
+File to read for GPSDrive configuration information. Default: '~/.gpsdrive/gpsdriverc'.
+
+=item B<-P, --PREFIX <PREFIX>>
+
+Takes a prefix string to be used as the start of all saved map files. Default: "map_".
+
+=item B<-F, --FORCE>
+
+Force program to download maps without asking you to confirm the download.
+
+=item B<-n>
+
+Dont download anything only tell which maps are missing
+
+=item B<-U>
+
+read map_koord.txt file at Start. Then also check for not downloaded map_*.gif Files
+if they need to be appended to map_koords.txt.
+
+=item B<--check-koordfile>
+
+Update map_koord.txt: search map Tree if map_*.gif file exist, but cannot
+be found in map_koords.txt file. This option first reads the
+map_koord.txt file and checks every Map in the filesystem if it also is
+found in the map_koord.txt file.
+If not found it is appended into the map_koord.txt file.
+
+Check map_koord.txt File. This option checks, if every Map also exist
+If any Map-File is missing, a file map_koord.txt.new will be created.
+This file can be copied to the original file if checked.
+
+=item B<--check-coverage>
+
+See which areas the maps cover.
+Output is simple ASCII Art
+
+=item B<--PROXY>
+
+Set proxy for mirroring image Files
+
+=item B<-d, --debug>
+
+Prints debugging information.
+
+=item B<-v, --version>
+
+Prints version information and exits.
+
+=item B<--help -h -x>
+
+Prints the usage page and exits.
+
+=item B<--MAN -M>
+
+Prints the manual page and exits.
+
+=item B<Download>
+
+When downloading Maps the output reads as folows:
+
+
+ _ Map already exists in Filesystem
+ E Error while downloading Map
+ + Map got downloaded
+ u updated map_koords.txt File
+ S Simulate only
+
+=back
+
+=cut
+