7 ESRI Shapefile
Tom Russo edited this page 2026-01-06 13:30:03 -07:00

Using ESRI Shapefile maps

By far, the most useful vector map (point, line, polygon) format in Xastir is the ESRI Shapefile format. "ESRI" is the name of the company that created the format for their products.

Shapefiles are a format originally intended for use in ESRI GIS products, but have become adopted as a simple format by many creators of map products.

Shapefiles can contain point, line, or polygon features. Xastir supports most of the possible types of shapefiles, with the exception of "Multipoint" files.

"shapefiles" are actually _at least_ three separate files

While we call them "shapefiles", a shapefile is actually a collection of multiple files: .shp, .shx, and .dbf. The first contains the actual coordinate pairs needed for each shape in the data layer, the second is an index file, and the third holds the attributes for each shape in the collection. These three files are essential to the function of the shapefile and must all be present.

There are often extra files included that are not part of the shapefile standard but may also be very important (such as a .prj file containing information about the coordinate system, and usually some form of metadata file documenting the source of the data and other important data about the data).

When copying shapefiles from one location to another, it is important to copy all of the files that have the same base name.

Requirements for using shapefiles

You must have the shapelib library and pcre2 installed in order to use ESRI Shapefile maps. These packages are in most operating system's package management systems. See Installing Xastir.

How Xastir uses Shapefiles

Shapefiles are the map format Xastir uses to display Weather Alerts. Shapefiles from government agencies that issue weather alerts are used to highlight areas for which there are active weather alerts. At the time of this writing, only shapefiles for the United States are readily available.

Shapefiles may also be used in Xastir for general purpose map import.

How Xastir renders Shapefiles in the map window

When selected from the Map Chooser, shapefiles are drawn in the map window in alphabetical order as they appear in the chooser. By setting a map layer in the Map Properties dialog, one can refine the order in which shapefiles are drawn; maps with lower layer numbers are drawn before maps with higher layer numbers. Maps with equal layer numbers are drawn in alphabetical order.

By default, shapefiles are drawn in black lines with no labels.

By writing dbfawk files, users and developers can control how Xastir displays shapefiles. Dbfawk files can control the color of lines, polygons, and labels, whether and how polygons are filled, and even assign APRS symbols to the points in a point shapefile. One can control whether features and their labels are displayed based on the map level.

If a shapefile you find on the web doesn't display nicely in Xastir with the dbfawk files we provide, you're on your own to create a dbfawk file to go with it. If it is of general interest, please contribute to the Xastir project so we can include your work.

Shapefiles currently supported in Xastir with pre-written dbfawk files

Xastir's config directory comes with dbfawk files for several different sets of shapefiles that have been found over the years:

  • Most 2025 Edition Tiger/Line shapefiles from the U.S. Census
  • National Weather Service (U.S) shapefiles used for weather alerts (may also be used as simple polygon maps)

There are additional dbfawk files that are included with Xastir to render older data that used to be available on the web (and may still exist in some Xastir users' maps directories):

  • Tiger/Line shapefiles from the 2008 and 2009 editions
  • Old Tiger/Line data in topological format that have been converted to shapefile (2003 edition, 2006 edition)
  • Australian Bureau of Meteorology weather alert shapefiles (were working as of 2012, but these are now apparently hard to get)
  • Open Street Maps shapefiles from Cloudmade (These are no longer available on the web)
  • Open Street Maps shapefiles from geofabrik (These dbfawks work with older geofabrik shapefiles, and are known to be broken for new ones)

Most of these dbfawk files are user-contributed, and many have not been updated as the files they apply to become outdated or unavailable. We're working on that.

Xastir's Shapefile Mapping Assumes Latitude/Longitude Shapefiles!

Important

Xastir makes the assumption that every shapefile you give it is in latitude/longitude coordinates in the WGS84 datum.

You may encounter shapefiles that are NOT in this datum or this coordinate system.

If you are lucky, these shapefiles come with a file that has a ".prj" extention that documents exactly the correct projection and coordinate system that the coordinates in the shapefile represent. If so, you can transform the shapefile's coordinates into those that Xastir can use.

This is an advanced map topic.

Many agencies that produced shapefiles are moving to other more modern formats

While the ESRI Shapefile is still in widespread use, many producers of GIS data are moving to other, more flexible formats such as GeoPackage. Xastir cannot read these files, but GDAL provides a means of creating shapefiles from these formats. See [[Map Converters]].