Creating maps
From gpsdrive
Contents |
External data sources
- See the Data sources wiki page.
GpsDrive tile format
File format
- Common image format (Tiff, PNG, JPEG, ...) of size 1280x1024
Map registration
The map name, center coordinate, and map scaling parameter are saved in the map index file: ~/.gpsdrive/map_koord.txt
- map_* maps
- top_* maps
Important! The maps must be named "map_*" for UTM-like projections (lat:lon = 1:cos(lat)) and "top_*" for lat/lon Plate carree projection (lat:lon = 1:1). The prefix is given so that gpsdrive knows how to scale the maps correctly. Alternatively the maps can be stored without prefix in subdirectories of $HOME/.gpsdrive/ which end in "_map" or "_top".
- see the man page
How to calculate the scaling factor
meters_per_pixel * 2817.947378
- Where does 2817.947378 come from?
- Perhaps 2817 was someone's monitor DPI converted to pixels/meter??
For a 21" monitor with aspect ratio of 4:3, monitor width is given by
so that constant in the GpsDrive code assumes that monitor resolution
setting is fixed at
thus for correct scaling it assumes monitor resolution is set with width 1202 pixels. Mine is set at 1280 wide, so not too far off. If I switch resolutions it gets worse though.
The GIMP offers a calibration option to overcome this problem of everyone's monitors being different:
- File → Preferences → Display → dpi [Calibrate]
Downloading from within the program
- Select "Options → Maps → Download" from the menu
- Currently NASA OnEarth LANDSAT global mosaic and OpenStreetMap.org Tiles are available.
Using gpsfetchmap.pl
- You can automatically download a set of map tiles along a route using GpsDrive's gpsfetchmap.pl script.
- TODO
Example
TODO
Using gdal_slice.sh
gdal_slice lets you create map tiles from a wide range of data formats using the GDAL software.
Misc. data formats will will have to be processed with a tool like gdal_translate.
- Get the gdal_slice.sh script (in the scripts/ dir in the source code)
- Make sure that GDAL can read the format,
gdalinfo filename.ext
Check installed GDAL supported formats:
gdalinfo --formats
If the GDAL webpage says that the format is supported but you can't seem to access it, check that your copy of GDAL was built with support for it. You may have to rebuild GDAL yourself with the switch for that format enabled.
- If GDAL can read the format, but it is not georeferenced, you will have to take care of that first. You should see some information about the coordinate system used and the lat/lon coordinates of the four corners of the map. See the #Georefencing section of this page.
- edit the filename information at the top of the script
- run the script (make sure you have execute permission set on the file)
./gdal_slice.sh
- move the files into your ~/.gpsdrive/maps/ directory and merge in the registration information into the ~/.gpsdrive/map_koord.txt file.
Common inputs
BSB Softcharts
work in progress, see mailing list posting linked at the end of this page
- Download free BSB charts from NOAA
- NOAA BSB rasterized nautical charts (Requires GDAL support)
- Check with gdalinfo
- Modify gdal_slice.sh
- Run gdal_slice.sh
- move tiles and map registration info into ~/.gpsdrive
Example
TODO
Using GRASS GIS's d.out.gpsdrive
You can render and export a custom scene from the GRASS GIS software using the GRASS GIS d.out.gpsdrive module.
- See the d.out.gpsdrive help page
Procedure
- Import S-57 ENC vector data with v.in.ogr
- NOAA ENC Direct to GIS vector data (S-57?) (Requires GDAL/OGR support)
- See the S-57 data wiki page for more information
- Import BSB raster RNC chart scan with r.in.gdal
- See the BSB data wiki page for more information
- Display selected layers and overlays in an xmon (d.* modules) and zoom to desired area
- Export with d.out.gpsdrive
Example
d.out.gpsdrive output=tile_name
Online map servers
Google Maps
- Fetch Google Maps by (??)
- For Program select (*) gpsDrive
- To prevent problems with overlapping tiles choose an Overlap (%) of more than 25%.
- In the map box drag and zoom the map to your overall area of interest.
- Zoom out slightly so the map box shows the bounding box of the area you wish to fetch entirely.
- Set the east,west,south,north values using the buttons (you may have to vary the order of pressing the buttons, keep at it until all values are updated, the this order first).
- Zoom in on the map to your desired detail level and click on the [Set zoom] button. Write down this zoom level.
- If you changed the overlap percent after setting the bounds you'll want to recalculate.
- Ensure that GpsDrive is ticked and press [Generate Wget].
- Follow the instructions given by the result, cut and paste the wget commands into a terminal window.
If the map scale seems to be somewhat off, take the zoom level number you wrote down earlier and plug in the central latitude value from the map_koord.txt entry. A more correct scale factor can be calculated with the following equation:
DEG_TO_RAD = pi/180 # GpsDrive's hardcoded pixels per meter ratio: PixelFact = 2817.947378 # WGS84 major axis radius for Earth a = 6378137.0 dynscale = ( a * 2*pi * cos(lat * DEG_TO_RAD) * PixelFact ) / ( 256*pow(2,zoom) )
OpenStreetMap (non-Mapnik)
(old & out of date??)
- Fetch OpenStreetMap data with gpsdrive-generate-mapnik-tiles.py
- You will also have to set up mapnik for OSM
Blue Marble mosaic
You can automatically create map tiles from the NASA Blue Marble 2002 dataset. See Documentation/README.nasamaps in the source code.
