Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attributes ¶
Attributes provides access to the dbf record.
type FieldDesc ¶
type FieldDesc interface {
Name() string
}
FieldDesc provides information about an attribute field.
type FieldDescList ¶
type FieldDescList []FieldDesc
FieldDescList is a list of field descriptors.
func (FieldDescList) Exists ¶
func (l FieldDescList) Exists(name string) bool
Exists reutnrs true if the named field exists, and false otherwise.
type GeoJSONOption ¶
type GeoJSONOption func(*geoJSONConfig)
GeoJSONOption funcs can be passed to Record.GeoJSONFeature().
func RenameProperties ¶
func RenameProperties(oldNews map[string]string) GeoJSONOption
RenameProperties allows shapefile field names to be mapped to user-defined GeoJSON property names.
type Info ¶
type Info struct { BoundingBox shp.BoundingBox NumRecords uint32 ShapeType shp.ShapeType Fields FieldDescList }
Info contains combined information from the pair of input files.
type Option ¶
type Option func(*options)
Option funcs can be passed to NewScanner().
func CharacterDecoder ¶
CharacterDecoder sets dbf.CharacterDecoder.
type Record ¶
type Record struct { shp.Shape Attributes }
Record consists of a shape (read from the .shp file) and attributes (from the .dbf file).
func (Record) GeoJSONFeature ¶
func (r Record) GeoJSONFeature(opts ...GeoJSONOption) *geojson.Feature
GeoJSONFeature creates a GeoJSON Feature for the Shapefile Record.
type Scannable ¶
type Scannable interface { AddOptions(...Option) Info() (*Info, error) Scan() error Record() *Record Err() error }
Scannable provides read access to a shapefile.
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner parses a pair or shp and dbf files.
func NewScanner ¶
NewScanner creates a new Scanner for the provided shp and dbf files.
func (*Scanner) AddOptions ¶
AddOptions allows additional options to be set after the scanner has already been created.
func (*Scanner) Err ¶
Err returns the first error encountered when parsing records. It should be called after calling the Record method for the last time.
func (*Scanner) Record ¶
Record returns each record found in the shp and dbf files. A single record consists of a shape and a set of attributes. nil is returned once the last record has been read, or an error occurs - the Err method should be used to check for an error at this point.
type TablePrinter ¶
type TablePrinter struct {
// contains filtered or unexported fields
}
TablePrinter implements a tabulated view of a shapefile.
func NewTablePrinter ¶
func NewTablePrinter(s Scannable, fields ...string) (*TablePrinter, error)
NewTablePrinter creates a TablePrinter for the supplied shapefile, optionally displaying only the specified field names.
func (TablePrinter) PrettyPrint ¶
func (p TablePrinter) PrettyPrint(out io.Writer) error
PrettyPrint writes a pretty ASCII table to the supplied destination.
type ZipScanner ¶
type ZipScanner struct {
// contains filtered or unexported fields
}
ZipScanner wraps Scanner, providing a simple method of reading a zipped shapefile.
func NewZipScanner ¶
NewZipScanner creates a ZipScanner for the supplied zip file. The filename parameter should be the zip file's name (as stored on disk), and MUST match the names of the contained shp and dbf files.
func (*ZipScanner) AddOptions ¶
func (s *ZipScanner) AddOptions(opts ...Option)
AddOptions allows additional options to be set after the scanner has already been created.
func (*ZipScanner) Err ¶
func (s *ZipScanner) Err() error
Err returns the first error encountered when parsing records. It should be called after calling the Shape method for the last time.