citygrid

package module
v0.0.0-...-2b89640 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2014 License: MIT Imports: 7 Imported by: 0

README

citygrid

Build an image of a city from a list of addresses using Go

Addresses

Various cities and the sources of their data.

Denver

From data.denvergov.org, found through data.opencolorado.org

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HSLModel = color.ModelFunc(hslModel)

HSLModel converts any color.Color to a HSL color.

View Source
var HSVModel = color.ModelFunc(hsvModel)

HSVModel converts any color.Color to a HSV color.

Functions

func HSLToRGB

func HSLToRGB(h, s, l float64) (r, g, b uint8)

HSLToRGB converts an HSL triple to a RGB triple.

Ported from http://goo.gl/Vg1h9

func HSVToRGB

func HSVToRGB(h, s, v float64) (r, g, b uint8)

HSVToRGB converts an HSV triple to a RGB triple.

Ported from http://goo.gl/Vg1h9

func Image

func Image(width, height, pixel int, freq Frequency) *image.RGBA

func RGBToHSL

func RGBToHSL(r, g, b uint8) (h, s, l float64)

RGBToHSL converts an RGB triple to a HSL triple.

Ported from http://goo.gl/Vg1h9

func RGBToHSV

func RGBToHSV(r, g, b uint8) (h, s, v float64)

RGBToHSV converts an RGB triple to a HSV triple.

Ported from http://goo.gl/Vg1h9

Types

type Frequency

type Frequency []float64

func CreateFrequency

func CreateFrequency(h *Histogram, index int) Frequency

func CreateMaxFrequency

func CreateMaxFrequency(h *Histogram) Frequency

type HSL

type HSL struct {
	H, S, L float64
}

HSL represents a cylindrical coordinate of points in an RGB color model.

Values are in the range 0 to 1.

func (HSL) RGBA

func (c HSL) RGBA() (uint32, uint32, uint32, uint32)

RGBA returns the alpha-premultiplied red, green, blue and alpha values for the HSL.

type HSV

type HSV struct {
	H, S, V float64
}

HSV represents a cylindrical coordinate of points in an RGB color model.

Values are in the range 0 to 1.

func (HSV) RGBA

func (c HSV) RGBA() (uint32, uint32, uint32, uint32)

RGBA returns the alpha-premultiplied red, green, blue and alpha values for the HSV.

type Histogram

type Histogram struct {
	Width  int
	Height int
	Blocks [][]int
	// contains filtered or unexported fields
}

func AutoHeightHistogram

func AutoHeightHistogram(width int, extrema Rect) *Histogram

Uses the ratio of latitude and longitude at 45 deg N/S

func (*Histogram) CountLocations

func (h *Histogram) CountLocations(locations []Location)

type Location

type Location interface {
	LatLong() (float64, float64)
}

All we need from addresses is their latitude and longitude

type LocationParser

type LocationParser interface {
	Parse(*os.File) ([]Location, error)
}

Given a file of addresses, return a list of locations

type Rect

type Rect struct {
	// contains filtered or unexported fields
}

func Extrema

func Extrema(minX, minY, maxX, maxY float64) (rect Rect)

func LocationExtrema

func LocationExtrema(locations []Location) (rect Rect)

func LocationExtrema999

func LocationExtrema999(locations []Location) (rect Rect)

func LocationExtrema9999

func LocationExtrema9999(locations []Location) (rect Rect)

type Simple

type Simple struct {
	Latitude  float64
	Longitude float64
}

A simple implementation of the location interface

func (Simple) LatLong

func (s Simple) LatLong() (float64, float64)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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