Use go-whosonfirst-svg
and oksvg
to render Who's On First features as raster images.
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.
./bin/wof-feature-to-png /usr/local/data/whosonfirst-data-constituency-us/data/110/874/663/7/1108746637.geojson > 1108746637.png
Would produce: