Skip to content

Commit

Permalink
2024 data
Browse files Browse the repository at this point in the history
  • Loading branch information
mtmail committed Jan 27, 2025
1 parent 1b1ce76 commit 66ede09
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 19 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ jobs:
- name: Install Ubuntu dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y -qq --no-install-recommends python3-gdal python3-pip python3-pytest unzip
sudo apt-get install -y -qq --no-install-recommends libgdal-dev unzip
- name: Install Python dependencies
run: pip install -r requirements.txt
run: |
pip install -r requirements.txt
pip install pytest
- name: Run tests
run: pytest-3
run: pytest

- name: Create output
run: |
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*/__pycache__
*/__pycache__
venv-tiger
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ Replace '2024' with the current year throughout.

```bash
# Ubuntu:
sudo apt-get install python3-gdal python3-pip unzip
pip3 install -r requirements.txt
sudo apt-get install python3

python3 -m venv venv-tiger
. venv-tiger/bin/activate
pip install -r requirements.txt
```

2. Get the TIGER 2024 data. You will need the EDGES files
Expand All @@ -35,14 +38,16 @@ Replace '2024' with the current year throughout.

3. Convert the data into CSV files. Adjust the file paths in the scripts as needed

```bash
```bash
./convert.sh <input-path> <output-path>
cd output-path
./patch.sh
```

4. Maybe: package the created files

```bash
tar -czf tiger2024-nominatim-preprocessed.csv.tar.gz tiger
```bash
tar -czf tiger2024-nominatim-preprocessed.csv.tar.gz *.csv
```


Expand Down
5 changes: 1 addition & 4 deletions lib/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
import json
import re

try:
from osgeo import ogr
except ImportError:
import ogr
from osgeo import ogr

# https://www.census.gov/geo/reference/codes/cou.html
# tiger_county_fips.json was generated from the following:
Expand Down
9 changes: 4 additions & 5 deletions lib/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
Deal with coordinate system transformations/projections
"""

try:
from osgeo import osr
except ImportError:
import osr
from osgeo import osr

osr.DontUseExceptions()

# Same as the contents of the *_edges.prj files
PROJCS_WKT = \
Expand All @@ -27,4 +26,4 @@
def unproject(point):
"""Covert point to WGS84"""
projected = transformer.TransformPoint(point[0], point[1])
return (projected[0], projected[1])
return (round(projected[0], 6), round(projected[1], 6))
5 changes: 5 additions & 0 deletions patch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#/bin/bash

# The 1..45 line is way off
grep -v '45;1;all;Woodfall Rd;Middlesex;MA;02478' 25017.csv > 25017.csv.tmp
mv 25017.csv.tmp 25017.csv
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gdal==3.8.4
1 change: 1 addition & 0 deletions tests/test_project.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from lib.project import unproject

def test_unproject():
# This test fails on my MacOS, no idea why, must be my local python setup
assert(unproject([-76.521714, 36.330247])) == (36.330247, -76.521714)
2 changes: 1 addition & 1 deletion tiger_address_convert.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3

"""
Tiger road data to OSM conversion script
Expand Down

0 comments on commit 66ede09

Please sign in to comment.