esri

package
v0.0.0-...-642f764 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2019 License: Unlicense Imports: 11 Imported by: 0

Documentation

Overview

Package esri handles interaction with GIS servers. Specifically, it provides functions which act on PAGIS.org web services and littlerock.gov servers. This includes: - Geocoding - Obtaining land parcel geometry - Finding flood hazard areas within a geometric envelope - Finding streets and their classification within an envelope - Finding zoning classification of a parcel There are a large number of mostly redundant structs which exist to keep some coherence of the highly varied JSON responses which the GIS servers provide to the queries.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchCases

func FetchCases(e Envelope) (string, error)

FetchCases returns all the case files associated with a parcel. TODO: fetch a list of cases instead of the first

func FetchMap

func FetchMap(e Envelope) image.Image

FetchMap takes ring geometry as an argument, calculates the coordinates of an envelope with a 10% buffer and makes a GET request to the PAGIS server for a png image of the area.

func FetchZone

func FetchZone(l Location) (string, error)

FetchZone takes an envelope (two points defining a rectangle which enclose a parcel) and returns a Zone, which is a code for land uses permitted by municipal ordinance. example:

R2 - single family residential
PRD - Planned Residential Development

func InFloodway

func InFloodway(fh []FloodHaz) bool

InFloodway is a simple function that

func IsMultifam

func IsMultifam(z string) bool

IsMultifam is a trivial function to determine if zoning is multifamily (ie) anything zoned M24, etc. Does not capture planned residential developments which would require deep inspection of zoning files.

Types

type Envelope

type Envelope struct {
	Min Point
	Max Point
}

Envelope is a pair of coordinate points which describe the lower-left and upper-right corners of a rectangle on a map.

func MakeEnvelope

func MakeEnvelope(ring Ring, r float64) Envelope

MakeEnvelope takes a geometry ring and a buffer radius (relative distance) as

arguments, then calculates a rectangular bounding box which encloses the

ring enlarged by the buffer TODO: This needs a sensible failure mechanism

type FloodHaz

type FloodHaz int

FloodHaz is an enumeration of valid flood hazard area designations. Its use is an alternative to a hashmap

const (
	X    FloodHaz = iota
	FIVE          // 0.2% annual chance
	A
	AE
	FLOODWAY
	LEVEE
)

Flood Hazard Area classifications

func FloodData

func FloodData(e Envelope) ([]FloodHaz, error)

FloodData takes an envelope as an argument, queries the PAGIS DFIRM map server and returns an array of strings of flood zones

func Unique

func Unique(fh []FloodHaz) []FloodHaz

Unique filters redundant FloodHaz zones

func (FloodHaz) String

func (f FloodHaz) String() string

type Location

type Location struct {
	X float64 `json:"x"`
	Y float64 `json:"y"`
}

Location is a coordinate pair representing the centroid of an addressed parcel.

func Geocode

func Geocode(addr string) (Location, error)

Geocode takes an address string and returns the location matched by the PAGIS server

type PResponse

type PResponse struct {
	Displayfieldname string           `json:"displayFieldName"`
	Fieldaliases     fieldAliases     `json:"fieldAliases"`
	Geometrytype     string           `json:"geometryType"`
	Spatialreference spatialReference `json:"spatialReference"`
	Features         []features       `json:"features"`
}

PResponse is a wrapper for the response to queries to the esri server for parcel data.

func FetchByPID

func FetchByPID(id string) (PResponse, error)

FetchByPID is an analog of FetchParcel; however, instead of taking a location it takes a parcel ID string

func FetchParcel

func FetchParcel(loc Location) (PResponse, error)

FetchParcel takes a location ie {x:float64,Y:float64} and returns the first ESRI "ring" object given by the PAGIS REST API. A ring is a 2-dimensional array of x,y coordinates which describe the points of a (irregular) polygon. FetchParcel also retunrs a float64 (acres) because

type Point

type Point struct {
	X float64
	Y float64
}

Point is a coordinate pair (lat and lon)

type Ring

type Ring [][]float64

Ring is a convenience type

func GetRing

func GetRing(p PResponse) Ring

GetRing probably doesn't need to be its own function. Really just here for ease of refactoring...

type Street

type Street struct {
	Name  string
	Class StreetClass
	Row   int
	Alt   bool
	ARDOT bool
}

Street refers to a specific road

func FetchRoads

func FetchRoads(e Envelope) ([]Street, error)

FetchRoads takes an envelope as an argument and returns a list of street names and their classifications. TODO: this is HIGHLY sensitive to the envelope buffer. Absolute widths are probably necessary.

type StreetClass

type StreetClass int
const (
	Residential StreetClass = iota
	MinorResidential
	Collector
	Commercial
	MinorArterial
	Arterial
)

Street classifications. Residential and minor residential aren't queryable so there may be no way to get this to work.

func (StreetClass) String

func (i StreetClass) String() string

Jump to

Keyboard shortcuts

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