Skip to content

Load and parse the official list of italian cities, with ISTAT codes

Notifications You must be signed in to change notification settings

panta/go-comuni-italiani

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-comuni-italiani

Description

This is a simple Go library and command-line utility to help working with Italian administrative territorial entities (towns, cities, regions, ...).

It provides:

  • a struct Comune to represent the most relevant properties
  • a pre-generated array Comuni (it's a slice of Comune structs) containing up-to-date records already converted to Go
  • and an utility to download the official CSV with ISTAT codes and convert to an easily (de-)serializable JSON format (or to Go source directly)

Building

$ go build -o go-comuni-italiani cmd/go-comuni/main.go

Otherwise you can also use the provided Makefile (which will create the binary bin/github.com/panta/go-comuni-italiani):

$ make

Downloading and converting the official CSV to JSON

$ ./bin/github.com/panta/go-comuni-italiani convert -allow-insecure -output comuni.json

(please note that at this time it seems the -allow-insecure flag seems to be needed on macOS)

You can then unmarshal the generated json into an array of Comune. See the code in example/example.go.

About

Load and parse the official list of italian cities, with ISTAT codes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published