ESRI shapefile (shape)

This format can...

  • read and write waypoints

  • read and write tracks

  • read and write routes

This format has the following options: name, url .

This format reads and writes ESRI shapefiles. When reading a shapefile Point, PointZ and PointM shapes are mapped to waypoints. PolyLine(Arc), PolyLineZ(ArcZ) and PolyLineM(ArcM) shapes are mapped to routes. When writing a shapefile waypoints are mapped to Point shapes and routes or tracks are mapped to PolyLine(Arc) shapes depending on the the objective given by the -w, -r or -t option. Because shapefiles can only contain one type of shape these options are mutually exclusive.

The minimum shape file set for read consists of a .shp, .shx and .dbf file. A .cpg file will be checked if it exists. When passing a file name for a set of shape files the name of any of the files from this set can be used. The files must be unzipped.

On read any projection format in a .prj file will be ignored. This may or may not result in a misinterpretation of the data. GPSBabel expects the coordinate system used in the shapefile to be a Geographic Coordinate System with units in decimal degrees measuring degrees of longitude (x-coordinates) and degrees of latitude (y-coordinates), e.g. WGS 84. To transform from the spatial reference system described in the .prj file to the Geographic Coordinate System WGS 84 you can use the GDAL utility ogr2ogr, e.g. "ogr2ogr -t_srs EPSG:4326 output.shp input.shp".

On read an attempt will be made to check the code page used by the .dbf file and report if it is not UTF-8. However, character data within the .dbf file is always processed as if it was encoded with UTF-8. If the .dbf file was using a different code page this may or may not cause a problem.

name option

Source for name field in .dbf.

This option specifies where to get name information for each shape. Without this option the name data will be fetched from a field named "NAME" if it exists in the .dbf file.

It the value is a set of digits then the name is fetched from a record with that field index in the .dbf file. Otherwise, if the value does not start with a '+' character, the name is fetched from record with that field name in the .dbf file. When the value starts with a '+' character then multiple records from the .dbf file can be combined to create the name. The plus character should be followed by a set of digit(s) representing a field index, or a field name as above. This may be followed by an additional '+' character, and another set of digits or a field name. As many records as desired can be selected in this fashion. For example shape,name=+0+4 would create a name by combining records with field indices 0 and 4. shape,name=+osm_id+name would create a name by combining records with field names 'osm_id' and 'name'.

url option

Source for URL field in .dbf.

This option specifies where to get URL information for each shape. Without this option the URL data will be fetched from a field named "URL" if it exists in the .dbf file.

It the value is a set of digits then the URL is fetched from a record with that field index in the .dbf file. Otherwise, the URL is fetched from record with that field name in the .dbf file.