This document explains how to set up GDAL for automatic shapefile-to-GeoJSON conversion of Ohio address data.
GDAL (Geospatial Data Abstraction Library) is an open-source library for working with geospatial data formats. We use the ogr2ogr command-line tool from GDAL to convert shapefiles from the Ohio LBRS site into GeoJSON format.
brew install gdalsudo apt-get update
sudo apt-get install gdal-bin- Download GDAL from: https://gdal.org/download.html
- Or use OSGeo4W installer: https://trac.osgeo.org/osgeo4w/
- Add GDAL to your PATH environment variable
If running in Docker, add to your Dockerfile:
RUN apt-get update && \
apt-get install -y gdal-bin && \
rm -rf /var/lib/apt/lists/*After installation, verify GDAL is working:
ogr2ogr --versionYou should see output like:
GDAL 3.8.0, released 2023/11/13
Run the test script to verify everything works:
./scripts/test_gdal.shThis will:
- Check if GDAL is installed
- Download a sample Ohio county address file
- Extract and convert it to GeoJSON
- Display statistics about the conversion
The application downloads ZIP files from Ohio LBRS:
https://gis1.oit.ohio.gov/LBRS/_downloads/ADA_ADDS.zip
Where ADA is the 3-letter county code (e.g., ADA = Adams County).
The ZIP file is extracted to a temporary directory. It typically contains:
*.shp- Shapefile (geometry data)*.shx- Shape index*.dbf- Attribute database*.prj- Projection information
Using ogr2ogr:
ogr2ogr -f GeoJSON -t_srs EPSG:4326 output.geojson input.shpParameters:
-f GeoJSON- Output format-t_srs EPSG:4326- Transform to WGS84 coordinate system- Output and input file paths
A GeoJSON file with structure:
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"hash": "...",
"number": "123",
"street": "Main St",
"city": "Columbus",
"postcode": "43215"
},
"geometry": {
"type": "Point",
"coordinates": [-82.999, 39.971]
}
}
]
}GDAL is not installed or not in your PATH. Follow the installation instructions above.
The shapefile may be corrupted or the ZIP extraction failed. Check:
- ZIP file downloaded completely
- ZIP file is not corrupted
- Temporary directory has write permissions
The shapefile may contain geometry types other than Points. This is unusual for address data but can happen. Check the shapefile contents:
ogrinfo -al input.shp | head -20Large county files can take several minutes to convert. This is normal for datasets with 100,000+ addresses. The conversion is cached, so it only happens once per county.
If automatic conversion fails, you can convert manually:
# Download
curl -O https://gis1.oit.ohio.gov/LBRS/_downloads/ADA_ADDS.zip
# Extract
unzip ADA_ADDS.zip
# Convert
ogr2ogr -f GeoJSON -t_srs EPSG:4326 \
oh/adams-addresses-county.geojson \
ADA_ADDS.shp
# Verify
head oh/adams-addresses-county.geojsonThe application caches:
- Downloaded ZIP files (24 hours)
- Converted GeoJSON files (24 hours)
This prevents unnecessary re-downloads and re-conversions.
- ZIP files: ~1-50 MB per county
- GeoJSON files: ~5-200 MB per county (uncompressed)
- Total for all 88 Ohio counties: ~5-15 GB
- Small county (< 10,000 addresses): 5-30 seconds
- Medium county (10,000-50,000 addresses): 30-120 seconds
- Large county (> 50,000 addresses): 2-10 minutes
If GDAL installation is problematic, consider:
-
OpenAddresses: May have pre-converted data
-
Manual batch conversion: Convert all counties once, commit GeoJSON to repo
- Run conversion script on a machine with GDAL
- Commit resulting GeoJSON files
- Trade storage space for processing time
- GDAL Documentation: https://gdal.org/
- ogr2ogr Manual: https://gdal.org/programs/ogr2ogr.html
- Ohio LBRS Data: https://gis1.oit.ohio.gov/LBRS/
- OpenAddresses: https://openaddresses.io/