Vector format mapping for GPSS
Updated 1030 Friday 20th April 2007 UK Time
from Robin on 20th April 2007:
Please see the
page for the latest USA mapping and how it is organised.
This page documents the format of vector mapping used with GPSS.
Some of the information may not be complete or accurate.
It is intended for use by those, such as GIS/mapping businesses, students and academics, who are considering the creation of this type of vector mapping for use with GPSS.
This documentation may not be sufficient in itself, but with the example USA data, it should at least permit the quantity of work to be estimated.
This mapping could be for any region of the world and of any scale. Street level mapping covering all the USA has been freely available off www.gpss.co.uk for years. You may wish to visit the Tiger page which describes the USA vector mapping since examples given here will draw on this.
The majority of mapping used with GPSS is in raster format. i.e. industry-standard BMP image files, and text files (sometimes known in recent years as CSV or comma seperated value files) such as .DES and .WAW. For details click here
Why use vector format, rather than the simpler raster format ?
Smaller size is the simple answer: it would not have been feasible to provide street level mapping for all the USA as simple downloads as we have. Even the compressed downloads occupy some 200 MB. Size may be less important in recent years, as PC memory has rocketed in size (most modern laptops now have 1000x greater hard disk capacity than they did when GPSS was launched in 1995).
Another reason for choosing vector format may simply be that a GIS/mapping business holds mapping data in vector format already, and simply wishes to find the most practical way of converting this to work with GPSS.
The format chosen for the GPSS vector data was a compromise between simplicity, compactness (size) and speed (when displayed by GPSS).
In December 2005 the GPSS vector format was modified to give greater compaction
and more map detail within a given storage limit - such as that imposed by a CD
rather than a DVD. The changes are explained below. GPSS has been modified to
permit a mixture of old and new data to be used - for those downloading the mapping
from this web site. More details of this "Tiger Project" work are
Please see the USA Download page for the latest USA mapping and how it is organised.
If you run the download, such as 37N122W.EXE, it will self extract into the files used by GPSS.
These 18 files hold all the vector data within the 1 degree x 1 degree area:
330,393 37N122W$.VEC - text of names such as street names.
2,208 37N122WD.VEC - drainage vectors. DCW DR drainage water
30,424 37N122WH.VEC - highway vectors.
5,568 37N122WM.VEC - major highway vectors. DCW RD Major road
6,604 37N122WP.VEC - population centre outline vectors. DCW PO population
30,760 37N122WR.VEC - road vectors.
37,580 37N122WS.VE0 - street vectors - first 0.1 latitude.
30,164 37N122WS.VE1 - street vectors - next 0.1 latitude.
49,272 37N122WS.VE2 - street vectors - etc
133,800 37N122WS.VE3 - street vectors
143,220 37N122WS.VE4 - street vectors
181,872 37N122WS.VE5 - street vectors
163,680 37N122WS.VE6 - street vectors
351,104 37N122WS.VE7 - street vectors
228,900 37N122WS.VE8 - street vectors
285,384 37N122WS.VE9 - street vectors - last 0.1 latitude.
19,552 37N122WT.VEC - positions of name text.
51,752 37N122WW.VEC - water vectors.
3,320 37N122WN.VEC - names of places such as towns. Added in April 2007. See USANAMES.TXT below.
Most of these files are created from the Tiger data, but three are from much less detailed vector data from Digital Chart of the World (DCW). Note that the last character of the name (e.g. S in 37N122WS.VE0) gives the type of data.
The vector files hold the line features (such as streets) as a series of WGS84 lat/lon start and end locations. There is also a pointer to the $.VEC file which holds the text of the street name.
The basic format has remained unchanged since 1999/2000 but in December 2005 it was extended to give better compaction of data, but still retain the ability of GPSS to handle a mix of new and old data.
Within GPSS the record structure used is:
rlat1r As Integer
rlon1r As Integer
rlat2r As Integer
rlon2r As Integer
rptr As Long
These lat/lon positions are relative to the lat/lon origin of the vector file. For the example above, this origin is 37, -122.
The integer is scaled by 10000. i.e. lat1 = 37 + rlat1r / 10000.
The main change was to avoid the need to repeat the start lat/lon, when it is identical to the last end lat/lon. Also, in a similar manner, there is no need for the text pointer if the name is the same as for the previous line. i,e. on the same road.
The basic record structure is now the lat/lon pair, as two 16 bit integers. A negative latitude indicates that a full record needs to be read. The full record has additional information in the top byte of rptr. The sign bit (i.e. a negative rptr) indicates new format data. The old 1999/2000 VEC data has these top bits as zero. The other 7 bits of the top byte are used as a "shape code".
Shape code of zero is the default: straight lines between lat/lon points. Other value codes indicate particular curves or angular shapes between points. This approach is intended to provide more detail with little or no increase in storage.
In the above example, all road and street names are held in the file 37N122W$.VEC.
e.g. "Kansas St" near the centre of the picture on the right.
Only one copy of the actual text "Kansas St" will be held within 37N122W$.VEC, but there may be many references to it in the vector file of positions, giving the lat/lon location of every bend and junction of Kansas St.
Another example of name text is "United States Highway 101".
Again, only one copy of the text "United States Highway 101" is held in 37N122W$.VEC but there will be many references to it within the vector files.
There is no duplication of text within 37N122W$.VEC, but a street or highway crossing into other 1 degree x 1 degree "tiles" will appear in the corresponding $.VEC file. e.g. 38N122W$.VEC.
The pointer (rptr above) within the vector file, is used by GPSS to find the text of the name to be drawn on the map from 37N122W$.VEC with a SEEK file access command. A simple file read is used to read the text string which is held in the standard text string format of 16 bit word count of characters (e.g. 9 for "Kansas St"), followed by the ASCII bytes (e.g. "K", "a", etc.).
GPSS accesses all it's mapping via simple text files with the extention .DES.
The DES file gives basic information such as if the mapping is held in a BMP file (raster mapping) or VEC files (vector mapping), and information on the geographic coverage of the mapping. More detail on GPSS DES files can be found here.
The following describes DES files for vector mapping:
Here is an example of a VEC DES file, USA2KY.DES :
USA 2000 yards
100000N1750000W, 0, 479
800000N0450000W, 639, 0
USA 2000 yards - the name of the map.
USA2KY - the file name, linking to files such as USA2KYS.VEC, USA2KYH.VEC, etc
VEC,1.83,0 - VEC type map, of scale east-west across display of 1.83 km (2000 yards).
100000N1750000W, 0, 479 - south west limit of this scale.
800000N0450000W, 639, 0 - north east limit. (other values not used)
C0703_V1200_W0101_S0214_.....etc - plotting instructions.
Note that this file describes a particular scale of map, covering all the USA (Latitudes 10 to 80 North, Longitudes 175 to 45 West) with appearance being determined by the formatting instructions on the last line (where a WAW file would normally appear). GPSS selects the "best" WAW file automatically, when this map (scale) is selected.
The "plotting instructions" are used by GPSS.EXE
to determine how
to create the vector map image on the screen. The line of text breaks
down into groups of 6 character (e.g. "S0214_") each of which define a
particular plotting action.
e.g. for the text "S0214_":
S = file name is S added to USA2KY. i.e. USA2KYS.VEC
02 = thickness of line drawn in display pixels.
14 = colour (Yellow here) as a Microsoft (QBasic colour).
_ = line type (continuous here).
You will find examples of DES files in the GPSS Baseline on the download page.
In 2005 a file names USANAMES.TXT was added to the USADISK.EXE download, to support the display of placenames such as towns on the vector map. USANAMES.TXT held 23,790 such names, and - although speed was not a problem on the full Windows version of GPSS, the Pocket PC version made us put this data into a more suitable form. The file names are the same as other vector files, but ending in N.VEC. The format of the data is identical to that in USANAMES.TXT and is best illustrated by this example extract:
+40.669800 -073.943849,New York,27.2 +34.112101 -118.411201,Los Angeles,18.8 +41.837050 -087.684965,Chicago,16.8 +29.768700 -095.386728,Houston,12.9 +40.006817 -075.134678,Philadelphia,12.7 +32.814950 -117.135770,San Diego,10.7 etc,etc -11.103769 -171.048136,Swains village,.4 -14.282883 -170.567480,Utumea East village,.4 -14.335483 -170.817207,Utumea West village,.4 END,END,END
The format is pretty self-evident, being latitude, longitude,name, and a number - which is an approximate size as a radius in kilometres, based on population size. This supports the logic for GPSS and GPSSppc recognizing if a detailed (small area) map falls inside a particular place.