ABSTRACT

One of the most important functions of geographical information system (GIS) software is to read popular GIS data file formats, such as shapefiles. A shapefile is a binary data file format originally developed by ESRI, and has been widely used for exchanging vector data among different GIS professionals and communities. This chapter introduces how shapefiles are formatted and how to read them with Python, that is, reading binary data, reading a shapefile header, reading a point shapefile, and reading polyline and polygon shapefiles. It also introduces how to use the struct module to handle binary data. The struct module has a number of functions to read data from and write data into binary format. struct handles binary data by converting data back and forth between its original format and binary format. The chapter also introduces vector data file formats, ESRI's shapefile format, and explains how to read the files through the Mini-GIS.