Skip to content

Use go-whosonfirst-svg and oksvg to render Who's On First features as raster images.

License

Notifications You must be signed in to change notification settings

whosonfirst/go-whosonfirst-image

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Use go-whosonfirst-svg and oksvg to render Who's On First features as raster images.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages