structureprovider

package
v0.0.0-...-cd09ded Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 14 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitNSISP

func InitNSISP() nsiStreamProvider

func InitNSISPwithOcctypeFilePath

func InitNSISPwithOcctypeFilePath(occtypefp string) nsiStreamProvider

func InitStructureProvider

func InitStructureProvider(filepath string, layername string, driver string) (*gdalDataSet, error)

func InitStructureProviderwithOcctypePath

func InitStructureProviderwithOcctypePath(filepath string, layername string, driver string, occtypefp string) (*gdalDataSet, error)

func NsiFeaturetoStructure

NsiFeaturetoStructure converts an nsi.NsiFeature to a structures.Structure

func OptionalSchema

func OptionalSchema() []string

func StructureSchema

func StructureSchema() []string

Types

type NsiFeature

type NsiFeature struct {
	Properties NsiProperties `json:"properties"`
}

NsiFeature is a feature which contains the properties of a structure from the NSI API

type NsiProperties

type NsiProperties struct {
	Name             int     `json:"fd_id"`
	X                float64 `json:"x"`
	Y                float64 `json:"y"`
	Occtype          string  `json:"occtype"`
	FoundHt          float64 `json:"found_ht"`
	FoundType        string  `json:"found_type"`
	DamCat           string  `json:"st_damcat"`
	StructVal        float64 `json:"val_struct"`
	ContVal          float64 `json:"val_cont"`
	CB               string  `json:"cbfips"`
	Pop2amu65        int32   `json:"pop2amu65"`
	Pop2amo65        int32   `json:"pop2amo65"`
	Pop2pmu65        int32   `json:"pop2pmu65"`
	Pop2pmo65        int32   `json:"pop2pmo65"`
	NumStories       int32   `json:"num_story"`
	FirmZone         string  `json:"firmzone"`
	GroundElevation  float64 `json:"ground_elv"`
	ConstructionType string  `json:"bldgtype"`
}

NsiProperties is a reflection of the JSON feature property attributes from the NSI-API

type NsiStreamProcessor

type NsiStreamProcessor func(str NsiFeature)

NsiStreamProcessor is a function used to process an in memory NsiFeature through the NsiStreaming service endpoints

type Stats

type Stats struct {
	TotalCount          int
	TotalValue          float64
	CountByCategory     map[string]int
	ValueByCategory     map[string]float64
	TotalResPop2AM      int32   //total population to calculate percapita losses
	WorkingResPop2AM    int32   //working population to calculate percapita losses
	NonResidentialValue float64 //for capital loss ratio for indirect economics
}

func StatsByFips

func StatsByFips(fips string, sp StructureProvider) Stats

type StructureProvider

type StructureProvider interface {
	// TODO regulate more common methods
	ByFips(fipscode string, sp consequences.StreamProcessor)
	ByBbox(bbox geography.BBox, sp consequences.StreamProcessor)
}

StructureProvider can be a gpkDataSet, nsiStreamProvider, or shpDataSet

type StructureProviderInfo

type StructureProviderInfo struct {
	StructureProviderDriver string                `json:"structure_provider_driver,omitempty"` // ESRI SHP, GPKG, PARQUET (OGR DRIVERS...)
	StructureProviderType   StructureProviderType `json:"structure_provider_type"`             // Provider_NSI or Provider_Local
	StructureFilePath       string                `json:"structure_file_path,omitempty"`       // Required if StructureProviderType == Provider_Local
	OccTypeFilePath         string                `json:"occtype_file_path,omitempty"`         // optional
	LayerName               string                `json:"layername,omitempty"`                 // required if specified a geopackage StructureFilePath
}

func (StructureProviderInfo) CreateStructureProvider

func (spi StructureProviderInfo) CreateStructureProvider() (StructureProvider, error)

NewStructureProvider generates a structure provider

type StructureProviderType

type StructureProviderType string
const (
	Unknown StructureProviderType = "UNKNOWN" //0
	NSIAPI  StructureProviderType = "NSIAPI"  //1
	GPKG    StructureProviderType = "GPKG"    //2
	SHP     StructureProviderType = "SHP"
	OGR     StructureProviderType = "OGR"
)

func (StructureProviderType) String

func (spt StructureProviderType) String() string

Jump to

Keyboard shortcuts

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