← All projects
DataUnited States·2024·1 month
Geospatial Address CSV Generator
Python script that organizes 7,851 US addresses across 15 markets into 190 CSV files, ensuring 2,100m geospatial separation between any two addresses per file.
Overview
The client needed to split a large address list into delivery route files where no two addresses could be within 2,100 meters of each other — a geospatial bin-packing problem at scale.
Problem
- 7,851 addresses across 15 US markets
- 190 output CSV files, max 40 addresses each
- Minimum 2,100m linear distance between any two addresses in the same file
- Prioritize market-specific files before mixing markets
- Named sequentially: AUSTIN #1, AUSTIN #2, ..., MIXED #1
Solution
- Haversine formula for accurate linear distance calculations between coordinates
- Greedy bin-packing algorithm: fills each file with addresses that satisfy the distance constraint
- Market priority sorting ensures market-specific files are maximized before MIXED files are created
- Final output: 190 structured CSVs with correct naming convention
Result
Delivered within 48 hours. The project had a challenging start due to scope alignment, but the final result exceeded expectations.
Tech stack
PythonPandasGeoPyHaversineCSV
★★★★★
"Ghandour transformed a challenging start into a significant victory for our team. His unwavering commitment never faltered. He tirelessly worked, even late into the night. His exceptional technical proficiency in Python and automation was evident. I would rehire him in a heartbeat and strongly recommend hiring him."
— Spritz · United States