Skip to content

AVanVlack/CGI-BIN-Geo-Zip-Code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

CGI-Bin Zipcode

A cgi-bin zipcode geocoding script. Written in Go.

Dataset from Geo Names ((CC BY 4.0))

New datasets can be download from: http://download.geonames.org/export/zip

On first run, the script will turn the dataset into a .gob quick dataset loading.

After updating the dataset, remove the old .gob file and a new file will be created on next run.

Support for single country dataset (US). Multiple countries to be added in the future.

Compiling

go build zipcode.go

Linux cross compile:

GOOS=linux GOARCH=amd64 go build -o bin/zipcode-amd64-linux zipcode.go

Usage

Executed from cgi-bin folder. Place 'US.txt' or generated gob dataset in same directory as binary.

Request

{
	"zipcode": "97211"
	"countryCode: "US"
}

Repsonse

{
	"zipCode": "97211",
	"placeName": "Portland",
	"adminName": "Oregon",
	"latitude": "45.5653",
	"longitude": "-122.6448"
}

TODO

  • Multi country support, specified by request
  • Response error codes
  • Clean up error handling

Release History

  • 1.0
    • Inital release

Meta

Drew VanVlack – @avanvlackA.Vanvlack@Gmail.com Distributed under the MIT license. See LICENSE for more information.

https://github.com/avanvlack

About

Lookup lat-long from zipcodes via cgi-bin

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages