reader

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2021 License: BSD-3-Clause Imports: 7 Imported by: 36

README

go-whosonfirst-reader

Common methods for reading Who's On First documents.

Examples

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

LoadReadCloserFromID
import (
	"context"
	"github.com/whosonfirst/go-reader"
	wof_reader "github.com/whosonfirst/go-whosonfirst-reader"
	"io"
	"os"
)

func main() {

	ctx := context.Backround()
	wof_id := int64(101736545)

	r_uri := "local:///usr/local/data/whosonfirst-data-admin-ca/data"
	r, _ := reader.NewReader(ctx, r_uri)

	fh, _ := wof_reader.LoadReadCloserFromID(ctx, r, wof_id)
	io.Copy(os.Stdout, fh)
}
LoadBytesFromID
import (
	"context"
	"fmt"
	"github.com/whosonfirst/go-reader"
	wof_reader "github.com/whosonfirst/go-whosonfirst-reader"
)

func main() {

	ctx := context.Backround()
	wof_id := int64(101736545)

	r_uri := "local:///usr/local/data/whosonfirst-data-admin-ca/data"
	r, _ := reader.NewReader(ctx, r_uri)

	body, _ := wof_reader.LoadReadCloserFromID(ctx, r, wof_id)
	fmt.Printf("%d bytes\n", len(body))
}
LoadFeatureFromID
import (
	"context"
	"fmt"
	"github.com/whosonfirst/go-reader"
	wof_reader "github.com/whosonfirst/go-whosonfirst-reader"	
)

func main() {

	ctx := context.Backround()
	wof_id := int64(101736545)

	r_uri := "local:///usr/local/data/whosonfirst-data-admin-ca/data"
	r, _ := reader.NewReader(ctx, r_uri)

	f, _ := wof_reader.LoadFeatureFromID(ctx, r, wof_id)
	fmt.Println(f.Name())
}

See also

Jump to

Keyboard shortcuts

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