https://github.com/whosonfirst/go-whosonfirst-image
Use go-whosonfirst-svg and oksvg to render Who's On First features as raster images.
https://github.com/whosonfirst/go-whosonfirst-image
golang image raster svg whosonfirst
Last synced: 3 months ago
JSON representation
Use go-whosonfirst-svg and oksvg to render Who's On First features as raster images.
- Host: GitHub
- URL: https://github.com/whosonfirst/go-whosonfirst-image
- Owner: whosonfirst
- License: bsd-3-clause
- Created: 2018-04-24T03:24:46.000Z (about 7 years ago)
- Default Branch: main
- Last Pushed: 2022-08-12T19:26:39.000Z (almost 3 years ago)
- Last Synced: 2025-01-17T20:16:38.776Z (5 months ago)
- Topics: golang, image, raster, svg, whosonfirst
- Language: Go
- Homepage:
- Size: 15.3 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-whosonfirst-image
Use `go-whosonfirst-svg` and `oksvg` to render Who's On First features as raster images.
## Example
```
import (
"github.com/whosonfirst/go-whosonfirst-image"
"image/png"
"io"
"os"
)func main() {
path := "/path/to/feature.geojson"
r, _ := os.Open(path)
defer r.Close()
body, err := io.ReadAll(r)opts := image.NewDefaultOptions()
img, _ := image.FeatureToImage(body, opts)png.Encode(opts.Writer, img)
}
```_Error handling removed for brevity._
## Tools
### wof-feature-to-png
```
./bin/wof-feature-to-png /usr/local/data/whosonfirst-data-constituency-us/data/110/874/663/7/1108746637.geojson > 1108746637.png
```Would produce:

As in: https://spelunker.whosonfirst.org/id/1108746637/
## See also
* https://github.com/srwiley/oksvg
* https://github.com/whosonfirst/go-whosonfirst-svg