shapefile

package module
v0.0.0-...-3861ef8 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2019 License: BSD-3-Clause Imports: 9 Imported by: 0

README

go-whosonfirst-shapefile

Go package for working with Who's On First documents and ESRI shapefiles.

Install

You will need to have both Go (specifically a version of Go more recent than 1.6 so let's just assume you need Go 1.8 or higher) and the make programs installed on your computer. Assuming you do just type:

make bin

All of this package's dependencies are bundled with the code in the vendor directory.

Important

This works. Until it doesn't. Currently it only write points and polygons.

There is a lot still to do including moving code in to generic package (library) functions and sorting out common attributes.

Tools

wof-shapefile-index
./bin/wof-shapefile-index -h
Usage of ./bin/wof-shapefile-index:
  -belongs-to value
    	Include only records that belong to this ID. You may pass multiple -belongs-to flags.
  -exclude-placetype value
    	Exclude records of this placetype. You may pass multiple -exclude-placetype flags.
  -include-placetype value
    	Include only records of this placetype. You may pass multiple -include-placetype flags.
  -mode string
    	The mode to use importing data. Valid modes are: directory,feature,feature-collection,files,geojson-ls,meta,path,repo,sqlite. (default "repo")
  -out string
    	Where to write the new shapefile
  -shapetype string
    	The shapefile type to use indexing data. Valid types are: POINT,POLYGON. (default "POINT")
  -timings
    	Display timings during and after indexing

For example:

$> ./bin/wof-shapefile-index -shapetype POLYGON -out test.shp -mode repo /usr/local/data/whosonfirst-data-constituency-us/
...time passes

$> du -h test.*
3.0M	test.dbf
4.0K    test.prj
401M	test.shp
 56K	test.shx

All of which ends up looking something like this:

See also:

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FeatureToMultiPoint

func FeatureToMultiPoint(f geojson.Feature) (shp.Shape, error)

func FeatureToPoint

func FeatureToPoint(f geojson.Feature) (shp.Shape, error)

func FeatureToPolygon

func FeatureToPolygon(f geojson.Feature) (shp.Shape, error)

func FeatureToPolyline

func FeatureToPolyline(f geojson.Feature) (shp.Shape, error)

func FeatureToShape

func FeatureToShape(f geojson.Feature, shapetype shp.ShapeType) (shp.Shape, error)

func IsValidShapeType

func IsValidShapeType(test string) bool

func ShapeTypes

func ShapeTypes() []string

Types

type Writer

type Writer struct {
	Logger *log.WOFLogger
	// contains filtered or unexported fields
}

func NewWriter

func NewWriter(path string, shapetype shp.ShapeType) (*Writer, error)

func NewWriterFromString

func NewWriterFromString(path string, shapetype string) (*Writer, error)

func (*Writer) AddFeature

func (wr *Writer) AddFeature(f geojson.Feature) (int32, error)

func (*Writer) Close

func (wr *Writer) Close() error

func (*Writer) WriteProjFile

func (wr *Writer) WriteProjFile() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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