Open PixelMap

From OpenTom

Jump to: navigation, search
TomTom Open PixelMap (TTOPM)
Use your own bitmaps as map, for example from Openstreetmap
Properties
Developer: Ronald Woelfel < rw at netzoffice dot de >
Version: 0.11  (09.04.2008)
Architecture: ARM
Language: C
Comment:
Dependencies
Requires: libgd with: libpng, libjpeg, libfreetype, libz
See also: Software

With TTOPM you can use your own bitmaps as map. One kind of using it is to download tiles (small images) from the Openstreetmap.org project. These 256 color tiles could be loaded more or less directly. On the other hand you can scan your own maps and cut the jpeg image into small png-tiles. A small shellscript which is running under Linux does this for you.

TTOPM is free software, it depends on a couple of libraries. But you dont have to worry about, because the libraries are included in the zipfile as binaries.

The origin name was ttpixelmap, Ive changed it to Open PixelMap (TTOPM). This is more handy and refers not only to Openstreetmap but also to the GPL-license of TTOPM.

Contents

Install

Default map of TTOPM

The zipfiles contains exactly the folder "ttopm-0.11" with the subfolder "SDKRegistry" and "ttopm" in it. Put these subfolders to your TomTom SD-Card and (re)start your TomTom. After starting TTOPM in the menue, you should see a grey area with the writing "This map is intensionally left blank". Congratulation, you managed the first step.

Before turning away from TTOPM: The slowness, particularly when scrolling, is not inevitable. It is slow because the TomTom navigation software also runs in the background. You can change this. Just have a look at the configuration file config.txt.

Configuring

Configuring takes place at config.txt. But at first we need real map data to replace the "intentionally left blank"-map.

Choosing a map

Place Charles de Gaulle

The following example took place at Place Charles de Gaulle at Paris. We use Openstreetmaps: http://www.openstreetmap.org/ as tile source. This link shows the place in Openstreetmap, which is in former times called Place de l'Étoile. Nowadays 1280x1024 is a widely used monitor resolution. So we see roughly 5 tiles horizontally and 4 tiles vertically in the browser window.

Downloading tiles (Linux)

Properties of topleft tile

To download these tiles with Linux use osm-dl.sh. The shellscript is included in the zipfile.

For configuring osm-dl.sh and (later) TTOPM we need the the url of the topleft corner in the browser window. Right clicking in the topleft corner produces a context menue with a properties entry. The output of the image properties should look like this:

http://c.tile.openstreetmap.org/17/66370/45082.png

Hint: Right clicking in Openstreetmap (OSM) or Google Maps (GM) only works, when it is not prevented by JavaScript. If it doesnt work, you have to check your javascript settings.

We find nearly all data osm-dl.sh wants to know in this url. So, lets look at the different parts of it:

  • http://c.tile.openstreetmap.org: This is the download server, there are several of it.
  • 17: the zoomlevel. In OSM a high zoomlevel means high magnification. In Googlemaps its the opposite way around.
  • 66370: the column number (x) of that tile
  • 45082.png: 45082 is the row-number (y)

The script requires five parameters. The first one is the zoomlevel. The remaining four (x1, x2, y1, y2) represents the map area.

./osm-dl.sh 17 66370 66374 45082 45085

We see that x2 (66374) is x1 plus the number of horizontal tiles. This is analogical for y2.

TTOPM needs the Openstreetmap directory structure, which is even the same with Google Maps. This is because many hundred tiles in one single directory would slow down everything. So it is possible to use TTOPM with tiles from Google Maps too, but this is certainly illegal.

osm-dl.sh creates these needed directories and saves the png-files in it. Afterwards it will look like in this figure:

---------------------------------------------------
|    ./17/|    ./17/|    ./17/|    ./17/|    ./17/|
|   66370/|   66371/|   66372/|   66373/|   66374/|
|45082.png|45082.png|45082.png|45082.png|45082.png|
---------------------------------------------------
|    ./17/|    ./17/|    ./17/|    ./17/|    ./17/|
|   66370/|   66371/|   66372/|   66373/|   66374/|
|45083.png|45083.png|45083.png|45083.png|45083.png|
---------------------------------------------------
|    ./17/|    ./17/|    ./17/|    ./17/|    ./17/|
|   66370/|   66371/|   66372/|   66373/|   66374/|
|45084.png|45084.png|45084.png|45084.png|45084.png|
---------------------------------------------------
|    ./17/|    ./17/|    ./17/|    ./17/|    ./17/|
|   66370/|   66371/|   66372/|   66373/|   66374/|
|45085.png|45085.png|45085.png|45085.png|45085.png|
---------------------------------------------------

The directory names are: 66370,66371,66372,66373 and 66374. Each directory contains 4 tiles.

Download tiles (MS)

Karl Meyer wrote a really convenient MS-Windows tool with GUI for downloading OSM tiles for his OSM2Palm project.

Maybe its difficult to exactly load the wanted tiles. Maybe someone could write down own experiences with OSM2Palm.

Using own bitmaps

It is possible to use your scanned bitmaps. But the big imagefile has to be cut up in small slices (the tiles). You have of course follow the above mentioned directory structure. All this is done more or less automatically with a shellscript (tile-bitmaps.sh) which is included in the TTOPM zipfile. You can find the documention for this script in the file tile-bitmaps.readme

config.txt

After copying the directory with the downloaded tiles to the ttopm-directory, we had to configure TTOPM. The default configfile is config.txt. You can find two sample configfiles in the zipfile:

  • config.txt.tomtom510 and
  • config.txt.tomtomone

If your model support the resolution of 480x272 take the first one. Otherwise take config.txt.tomtomone as point of origin.

The following lines describe only the changes to the default config.txt for our example. Lets beginn with some hardware adjustments.

The resolution is configured with "screenwidth" and "screenheight", for example

screenwidth=480
screenheight=272

for the more expensive models. Cheaper models uses 320x240:

screenwidth=320
screenheight=240

The menue button "GPS-Pos" uses gps-information to display the appropiate part of the map. For this TTOPM needs to know the name of a file (a so called named pipe) which provides NMEA-records. The path of this file depends on the TomTom model. For TomTom One 3rd edition:

gpsfifo=/var/run/gpspipe

For TomTom 510 (and older ones?):

gpsfifo=/dev/gpspipe

If GPS-Pos doesnt work, you probably have to change this variable. Let me know if you have problems with your TomTom and "GPS-Pos".

The number of columns and rows of tiles has to be changed.

xtiles = 5
ytiles = 4

Also the zoomlevel has to be adjusted.

zoomlevel=17

The next step is to define the x- and y-coordinates of the topleft tile as before.

toplefttile_x = 66370
toplefttile_y = 45082


Place Charles de Gaulle with x/y offset

With xvpstart and yvpstart you could define virtual coordinates which specify which screen arperture is shown at startup.

Virtual coordinates means that all tiles are taken as combined. So the first X-Pixel of the second tile is 256, the second pixel 257 and so on.

To get the place in the topleft area of the display when starting ttopm you have to set:

xvpstart=320
yvpstart=160

We want to see the tile boundaries and also the characteristics of each tile:

debug=1

And it is assumed that the native TomTom software is no longer needed and therefore killed at startup. This will tremendously increase the speed of TTOPM.

killttn=1

This is just enough for a working configuration. After starting TTOPM everything should work except the GPS stuff.

The last and optional part is to calibrate the map data to geographical coordinates.

Two geographical known locations are needed. The easiest way is to lookup the latitude and longitude of crossroads, but its up to you. The first point should be located in the top left, the second point in the downright area of the map.

First point: crossroads Rue de Saigon / Rue Rude.

cali_lat1=48.8741149
cali_long1=2.29123950
Calibrating the map (1st point)

The streetname of that region are not yet available in Openstreetmap. So you have to to use Google Maps. Just use the menue button "calibrate" to find out the virtual coordinates of that point.

cali_x1=63
cali_y1=209
Calibrating the map (2nd point)

The second location is crossroads Rue de Berri / Avenue des Camps-Elysees. Again you have to use Google Maps to find out the street names and again use the calibrate menue button. You get approximately the following values:

cali_lat2=48.8714
cali_long2=2.3025
cali_x2=1112
cali_y2=593

That´s it. We have to add the eight cali_* lines to config.txt and the map is calibrated.

Questions

Q: How to find out latitude and longitude of a certain point?

  1. With OSM-permalink you get a page refresh with a new latitude and longitude containing URL in it. The values refer to the center of the screen. So you only have to make your browser window smaller, center the map and press "permalink" again.
  2. But its much more exactly with GM. You can enter lat/long- coordinates directly in the GM searchfield, eg. "48.8714, 2.3025". An arrow is pointing at the specified location.
  3. Use this online tool, which is based on Google Maps: http://www.giswiki.org/hjl_get_CoorM.htm

Q: How do I download tiles without Linux and osm-dl.sh?

Karl Meyer wrote a really convenient MS-Windows tool with GUI for downloading OSM tiles for his OSM2Palm Project.

Q: Why does TomTom reboot right after starting TTOPM?

This happens only when starting TTOPM immediately after switching on TomTom. I didnt found the original cause, so after switching on your TomTom you have to wait around two minutes, before starting TTOPM

Q: Could I use several maps at the same time?

Yes, since Version 0.10 several maps are supported. Each map needs its own config file (for example config-10.txt, config-20.txt). This feature is intented for zoom in and out, but you can switch also to arbitrary maps with the "zoom in" and "zoom out" buttons. For more see release notes for 0.10.

Release notes

These are the changes from version to version.

version 0.01 (7th Feb 2008)

  • more or less it´s just a proof of concept

version 0.02 (14 Feb 2008)

  • NEW: The menue button "calibration" displays the virtual coordinates for a certain pixel. So, its not longer necessary to calculate cali_x and cali_y by oneself.
  • NEW: config-variable: killttn ( killttn=0|1 ). Depending on this value, the native TomTom navigation software is killed. This will lead to a much higher execution speed of ttopm. If its not killed you can go back to the native TomTom navigation software with the menue (see Exit TTOPM)
  • NEW: annotations in config.txt describe the meaning of each config variables
  • NEW: config-variable: screenrecord (for experts only) ( screenrecord=0|1 ). If activated a screenshot will taken at every screenupdate with FbRender_Flush().
  • Todo this, ./screenshot.sh is started with system: screenshot.sh took a raw and uncompressed copy of /dev/fb0 and stores it in the current directory with a unix timestamp in it, eg.: shot-1202913551.raw
  • NEW: menue item "Exit TTOPM". This will do a reboot if killttn is set to 1, else it leads back to the native TomTom software.
  • CHANGED: exchanged the watchdog binary with a watchdog-shellscript
  • CHANGED: still found german (my native language) words to translate in the sourcecode

version 0.10 (22 Feb 2008)

  • FIXED: memory leak in calibrate();
  • FIXED: memory leak in geocoords();
  • FIXED: memory leak in loadconfigline();
  • CHANGED: all calibration variables (cali_x1, cali_ ...) are global defined variables now.
  • CHANGED: debug is no longer limited to 0 and 1. "debug=2" writes some of the debugging infos (for instance memory consumption) also directly to display.
  • CHANGED: more precise GPS coordinates, when GPS reception is bad (function avggps)
  • CHANGED: "reread config" is removed because its no longer needed. Reread the configfile(s) could also be reached with zoom in and out.
  • CHANGED: Toggle between showing and not showing the smallzoom window is no longer supported.
  • NEW: config-variable: mapname. For example: mapname=London_OSM_Zoom_9
  • NEW: Display most important config variables at startup
  • NEW: TTOPM memorizes the last location (latitude and longitude) in the file geopos.txt. This is necessary for zoom in and zoom out.
  • CHANGED: ttopm.sh now supports several configfiles. This is intended for different zoomlevels, but you could also provide configfiles for different maps.
  • NEW: zoom in and zoom out. It is now possible to switch to other configfiles which points to other map data. The name config.txt is still supported. But ttopm.sh looks at first for configfiles with a two-digit number in it: config-xx.txt. If such a file is found ttopm.sh starts the ttopm binary with the configfile as argument. The configfile with the smallest value is taken at startup. If no config-xx.txt is found config.txt is used. If you zoom in, ttopm is stoped and restartet with the nearest larger number in config.txt, for example config-03.txt. Hence it is possible to name the configfiles according to the zoomlevel. When pressing the button "zoom in" ttopm stops with an exitcode of 2 otherwise it stops with an exitcode of 3. Before exiting the latitude and longitude is written to geopos.txt. Everything else, for instance finding the next configfile, is handled by ttopm.sh

version 0.11 (9th Apr 2008)

TTOPM now runs also on other TomToms, thanks to Joerg Ostertag for providing me a TomTom One 3rd edition

  • NEW: config-variables: screenwidth and screenheight. The screen resolution has to be set manually, e.g., screenwidth=320, screenheight=240
  • CHANGED: config-variables, xvpsize and yvpsize are no longer needed
  • NEW: config-variables: gpsfifo: gpsfifo is the name of the named pipe which provides the gps information. Try something like gpsfifo=/dev/gpspipe (= TomTom 510) or gpsfifo=/var/run/gpspipe (= TomTom One 3rd edition)
  • CHANGED: ttopm.sh, the libraries are no longer copied to /lib, instead they are linked. Thanks for the diff to Jean-Yves Lebleu.
  • CHANGED: osm-dl.sh. After downloading the tiles the config lines are printed out for copy & paste to config.txt (thanks to Joerg Ostertag)

TODO

The order of this list shows is propably the order of implementation.

  • autodetection of resolution and automatic find the named pipe with the NMEA records
  • directly load the tiles through a bluetooth connection via cell phones from openstreetmap.org
  • memory-marker: quickly jump to stored locations
  • Menue button for showing err.log and stdout.log
  • Showing Battery status
  • support suspend mode
  • simple compass functionality
  • allow changing SD Card without reboot
  • warn if the GPS-Pos is outside of the mapdata
  • calibration: support alphanumeric input of latitude and longitude for easy calibration
  • JPEG-support


The items with √ are already fixed or implemented and will be contained in the next release.

Links

Personal tools