Data Sources and Access

ESRI Shapefiles

Shapefiles store geographic data in a format created by ESRI. It is an open format described in the ESRI Shapefile Technical Description. The geomap::lnarr command in the tclgeomap package can read certain shape files with the help of the shptobin application. shptobin reads a shapefile named on its command line, and sends the contents to standard output in a format intelligible to geomap::lnarr fmbin. One can either send the output to a new file, or send the data directly to geomap::lnarr fmbin by putting a pipe character, '|', in the file argument.

For example, the following command reads data from a shapefile named c_12my03 into a linearray named counties:

tclsh$ geomap::lnarr fmbin counties "|shptobin -s c_12my03"
counties
The -s option tells shptobin to make single precision output. This is necessary because shapefiles normally store data in double precision, but the geomap::lnarr command expects single precision. Other options are available. See the shptobin man page for complete details. This application is part of the tkgm_util distribution, which is available at the download page. Building it requires some code from the shapelib library, which is available from http://shapelib.maptools.org/ or locally (with some browsers, you might have to right click and select "Save link as ...").

NWS/AWIPS

The National Weather Service provides access to many useful data sets used by its AWIPS software package at http://www.nws.noaa.gov/geodata. Most of the data is in shapefiles, which can be accessed in the manner described above. The geomap_awips package provides procedures and namespaces that manage some of the more complex data sets. The geomap_awips man page for details. This package is part of the tkgm_util distribution, which is available at the download page.

GMT Coastline Data

GMT - Generic Mapping Tools - is a free collection of Unix tools and data sets for access and display of geographic data. One of the utilities is pscoast which prints lists of latitude-longitude values for various outlines and features to standard output. Tclgeomap's "geomap::lnarr fmbin" command can read this output with the help of the psc2tkgm application. psc2tkgm transforms output from commands of form 'pscoast -M -bos options' into a format intelligible to geomap::lnarr fmbin. The -M and -bos options tell pscoast to send data to standard output as a single precision binary stream. Additional options identify the data type and resolution. See the GMT documentation for details. The transformed data can be put into a new file or given directly to 'geomap::lnarr fmbin' using the pipe, '|', character in the file name. For example, the following command loads GMT's coastal data for the entire world at low resolution into an array named gcoast:
tclsh$ geomap::lnarr fmbin gcoast "|pscoast  -M -bos -Dl -W -R-180/180/-90/90 | psc2tkgm"
For further details, consult the psc2tkgm man page. psc2tkgm is part of the tkgm_util distribution, which is available at the download page.

USGS Gazetteer

The U.S. Geological Survey maintains a data base of named places at http://mapping.usgs.gov/www/gnis. The actual files are at http://geonames.usgs.gov/geonames/stategaz/index.html. The geomap_usgs_gaz package provides procedures and namespaces that access and manage this data from the "Columnar Record Format" files. For further details, consult the man page. This package is part of the tkgm_util distribution, which is available at the download page.

U.S. Census Bureau Gazetteer

The U.S. Census Bureau has a gazetteer of named places in the United States at http://www.census.gov/geo/www/gazetteer/places2k.html. The data are in http://www.census.gov/tiger/tms/gazetteer/places2k.txt or http://www.census.gov/tiger/tms/gazetteer/places2k.zip. The geomap_census_gaz package provides procedures and namespaces that access and manage this data. For further details, consult the man page. This package is part of the tkgm_util distribution, which is available at the download page.

Factmonster Cities

There is a convenient list of cities at factmonster.com. World cities are in A0001769.html and U.S. cities are in A0001796.html.

A cleaned up version is in file cities. The following code will load it:

tclsh$ package require tclgeomap 2
2.0
tclsh$ set in [open cities]
file3
tclsh$ while {[gets $in line] >= 0} {
>if {[llength $line] ==2} {
>set name [lindex $line 0]
>set latLon [lindex $line 1]
>geomap::place new $name [geomap::dmstodec $latLon]
>}
>}
tclsh$ close $in
tclsh$ {Bristol, England} set
51.466667 -2.583333
tclsh$ {Calgary, Alba., Can.} set
51.016667 -114.016667
      
Return to tkgeomap home page