{"id":15293367,"url":"https://github.com/whosonfirst/go-whosonfirst-format","last_synced_at":"2026-01-07T22:45:30.995Z","repository":{"id":46760978,"uuid":"203541332","full_name":"whosonfirst/go-whosonfirst-format","owner":"whosonfirst","description":"Formatter for the Who's on First GeoJSON","archived":false,"fork":false,"pushed_at":"2024-05-16T21:55:08.000Z","size":581,"stargazers_count":1,"open_issues_count":3,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-02-04T21:50:06.467Z","etag":null,"topics":["geojson","json","whosonfirst"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/whosonfirst.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-21T08:32:27.000Z","updated_at":"2022-08-06T12:08:46.000Z","dependencies_parsed_at":"2022-08-12T13:01:14.518Z","dependency_job_id":null,"html_url":"https://github.com/whosonfirst/go-whosonfirst-format","commit_stats":null,"previous_names":["tomtaylor/go-whosonfirst-format"],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whosonfirst%2Fgo-whosonfirst-format","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whosonfirst%2Fgo-whosonfirst-format/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whosonfirst%2Fgo-whosonfirst-format/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whosonfirst%2Fgo-whosonfirst-format/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/whosonfirst","download_url":"https://codeload.github.com/whosonfirst/go-whosonfirst-format/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246243553,"owners_count":20746311,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["geojson","json","whosonfirst"],"created_at":"2024-09-30T16:47:11.050Z","updated_at":"2026-01-07T22:45:30.989Z","avatar_url":"https://github.com/whosonfirst.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-whosonfirst-format\n\nStandardised GeoJSON formatting for Whos On First files.\n\nUsable as both a library and a binary.\n\n## Documentation\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/whosonfirst/go-whosonfirst-format.svg)](https://pkg.go.dev/github.com/whosonfirst/go-whosonfirst-format)\n\n## Library usage\n\n```golang\nimport (\n       \"fmt\"\n       \"io/ioutil\"\n       \n       \"github.com/whosonfirst/go-whosonfirst-format\"\n)\n\nfunc main() {\n\n\tinputBytes, _ := ioutil.ReadFile(inputPath)\n\toutputBytes, _ := format.FormatBytes(feature)\n\t\n\tfmt.Printf(\"%s\", outputBytes)\n}\n```\n\n_Error handling removed for the sake of brevity._\n\nThere is also a `FormatFeature` method which takes as its input\ta `paulmach/orb/geojson.Feature` object (this is what the `FormatBytes` method is calling under the hood in order to ensure valid GeoJSON input).\n\n## Tools\n\n```shell\n$\u003e make cli\ngo build -mod vendor -ldflags=\"-s -w\" -o bin/wof-format ./cmd/wof-format/main.go\n```\n\n### wof-format\n\nFormat Who's On First records in files or on STDIN.\n\n```shell\n$\u003e ./bin/wof-format -h\nUsage: ./bin/wof-format [-check] [input]\n\nEither provide a WOF feature on stdin:\ncat input.geojson | ./bin/wof-format \u003e output.geojson\n\nOr provide a path to a WOF feature as the first argument:\n./bin/wof-format input.geojson \u003e output.geojson\n\nOptional arguments:\n\n  -check\n    \texits silently with a non-zero status code if the file is not correctly formatted\n  -output string\n    \twrite the output to a file instead of stdout\n  -overwrite\n    \toverwrite the input file with the formatted output\n```\n\nFor example:\n\n```shell\n$\u003e cat input.geojson | ./bin/wof-format \u003e output.geojson\n```\n\n## WASM (Javascript)\n\nThe `wof-format` functionality is also available as a JavaScript compatible WebAssembly (WASM) binary. The binary comes precompiled with this package but if you need or want to rebuild it the simplest way to do that is to use the handy `wasmjs` Makefile target.\n\n```shell\n$\u003e make wasmjs\nGOOS=js GOARCH=wasm \\\n\t\tgo build -mod vendor -ldflags=\"-s -w\" \\\n\t\t-o www/wasm/wof_format.wasm \\\n\t\tcmd/wof-format-wasm/main.go\n```\n\nTo test the binary open the web application in `www/index.html` using the HTTP server of your choice. I like to use [aaronland/go-http-fileserver](https://github.com/aaronland/go-http-fileserver) but that's mostly because I wrote it. Any old web server will do. For example:\n\n```shell\n$\u003e fileserver -root www\n2025/06/28 06:50:46 Serving www and listening for requests on http://localhost:8080\n```\n\nAnd then when you open your browser to `http://localhost:8080` you'll see a simple two-pane web application where you can enter a document to format on the left and see the result on the right, like this:\n\n![](docs/images/whosonfirst-format-wasm.png)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhosonfirst%2Fgo-whosonfirst-format","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwhosonfirst%2Fgo-whosonfirst-format","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhosonfirst%2Fgo-whosonfirst-format/lists"}