Skip to content

🚲 A .NET CLI tool for finding all Danish zip codes within a specified distance from a given address

Notifications You must be signed in to change notification settings

simontjell/ReachableZipCode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ReachableZipCode

A .NET CLI tool for finding all zip codes within a specified distance (as crow flies) from a given address in Denmark.

Prerequisites

Setup

1. Clone the Repository

git clone https://github.com/simontjell/ReachableZipCode.git
cd ReachableZipCode

2. Download Zip Code Data

Before using the CLI, you need to download the Danish zip code data:

./scripts/download-zip-codes.sh

This will download the latest zip code data from the Danish Address, Real Property and Land Register (DAR) API and save it to the data/zipcodes.json file.

3. Build the Project

Build the entire solution:

dotnet build

Usage

Navigate to the CLI project folder and run the application:

cd src/ReachableZipCodeCli
dotnet run -- "Randersvej 13" -m 10 -z 8200

Command Parameters

  • Street Address (required): The starting address to search from
  • -z, --zipcode (required): The zip code for the starting address
  • -m, --max-distance (required): Maximum distance in kilometers (default: 10.0)

Example

Find all zip codes within 10 kilometers of "Randersvej 13" in Aarhus (8200):

dotnet run -- "Randersvej 13" -m 10 -z 8200

This will output a list of zip codes and their corresponding city names that are within 10 kilometers of the specified address.

image

Development

Running Tests

To run the test suite:

dotnet test

Project Structure

  • src/ReachableZipCode/ - Core library with calculation logic
  • src/ReachableZipCodeCli/ - Command-line interface
  • tst/ReachableZipCode.Tests/ - Unit tests
  • scripts/ - Data download scripts
  • data/ - Downloaded zip code data

Data Source

This tool uses zip code data from the Klimadatastyrelsen via https://dataforsyningen.dk/.

About

🚲 A .NET CLI tool for finding all Danish zip codes within a specified distance from a given address

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published