ESRI ArcGIS can export compressed geographic files using the ‘LPK’ file extension. ESRI also have a number of datasets available for free download on their website that use this extension, e.g. the popular North America Postal Areas and Zip Codes datasets. Unfortunately the LPK extension is a proprietary extension not directly supported by other tools, but this post shows you how to convert the format into a Shapefile for use in QGIS and other geospatial systems.
It turns out an LPK file is actually just a 7-ZIP file in disguise. These usually use the “.7z” extension and can be un-archived using the 7-ZIP utility (7-Zip for Windows, Linux, Unix). The Windows version of this utility has a GUI which will readily accept archives with strange extensions. A typical LPK file will have an esriinfo directory describing the data, and directories for different versions. These latter directories will have names like v10 or v106. Choose the directory that seems most appropriate (typically the later/higher one).
This directory will contain a “.lyr” file and a sub-directory with the “.gdb” extension. These store the geo-database that we wish to convert.
QGIS can read vector data from these gdb files directly – simply open the GDB file in the QGIS brwoser and drag the required data layer into the Layers window. The zipcode data is a vector layer and should import okay. Note that QGIS cannot import raster data from gdb files.
Alternatively you can convert GDB files to shapefiles using the the ogr2ogr utility. GDAL/OGR is typically installed with QGIS as a part of the OSGeo4W package. If you do not have it, you can download it from the official GDAL website.
Here is the required command for the above zip code example:
ogr2ogr -f "ESRI Shapefile" zip_codes zip_poly.gdb
This was executed from the directory with the “.lyr” file ( v106\ in this example). zip_poly.gdb is the name of the gdb directory to convert. zip_codes is the name of a new directory which will receive the shapefiles. The new files will receive the name zip_poly.shp , zip_poly.dbf, etc. This method has the advantage that it can create a widely used geospatial data format that can be read by most geospatial applications. However it will only work with attribute names which fit the shape (i.e. DBF) field specification.
For the zip code example, the resulting layer covers much of the World, including all 50 States, Puerto Rico, the Aleutians, and Guam. Here is a view zoomed into an area that includes part of the Dallas – Fort Worth Metroplex:
Zip code 75062 has been selected, and you can see that ogr2ogr also imported the data fields correctly. As well as the name of the zip code, we have the place (city), State, and Population.