writer

package module
v3.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2025 License: BSD-3-Clause Imports: 7 Imported by: 13

README

go-sfomuseum-writer

Common methods for writing SFO Museum (Who's On First) documents with whosonfirst/go-writer.Writer instances.

Documentation

Go Reference

Examples

Note that error handling has been removed for the sake of brevity.

WriteFeature
import (
	"context"
	"github.com/paulmach/orb/geojson"
	"github.com/whosonfirst/go-writer"	
	sfom_writer "github.com/sfomuseum/go-sfomuseum-writer"	
)

func main() {

	ctx := context.Background()
	wr, _ := writer.NewWriter(ctx, "stdout://")
	
	for _, feature_path := range flag.Args() {
	
		fh, _ := os.Open(feature_path)
		body, _ := io.ReadAll(fh)
		f, _ := geojson.UnmarshalFeature(body)

		sfom_writer.WriteFeature(ctx, wr, f)
	}
WriteBytes
import (
	"context"
	"github.com/whosonfirst/go-writer"	
	sfom_writer "github.com/sfomuseum/go-sfomuseum-writer"
	"io"
)

func main() {

	ctx := context.Background()
	wr, _ := writer.NewWriter(ctx, "stdout://")
	
	for _, feature_path := range flag.Args() {
	
		fh, _ := os.Open(feature_path)
		body, _ := io.ReadAll(fh)
		
		sfom_writer.WriteBytes(ctx, wr, body)
	}

See also

Documentation

Overview

package writer provides common methods for writing SFO Museum (Who's On First) documents using `whosonfirst/go-writer.Writer` instances.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteBytes

func WriteBytes(ctx context.Context, wr go_writer.Writer, body []byte) (int64, error)

WriteBytes will write 'body' using 'wr' using a SFO Musuem specific `whosonfirst/go-whosonfirst-export/v2.Exporter` instance.

func WriteFeature

func WriteFeature(ctx context.Context, wr go_writer.Writer, f *geojson.Feature) (int64, error)

WriteFeature will serialize and write 'f' using 'wr' using a SFO Museum specific `whosonfirst/go-whosonfirst-export/v2.Exporter` instance.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL