carto

package
v0.0.0-...-a009b50 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2016 License: BSD-2-Clause, GPL-3.0 Imports: 19 Imported by: 0

README

carto

Go language GIS map drawing library

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Font = "" // Default font to use
)

Functions

func ConvertSVGToPNG

func ConvertSVGToPNG(filename string)

func Degrees2meters

func Degrees2meters(lon, lat float64) (x, y float64)

convert from long/lat to google mercator (or EPSG:4326 to EPSG:900913)

func DrawShapes

func DrawShapes(f io.Writer, strokeColor, fillColor []color.NRGBA,
	linewidth, markersize float64, shapes ...geom.T)

Convenience function for making a simple map.

Types

type ColorMap

type ColorMap struct {
	Type          string  // "Linear" or "Lincutoff"
	CutPercentile float64 // Percentile at which discontinuity occurs for "LinCutoff" type.
	NumDivisions  int     // "Number of tick marks on legend.

	ColorScheme string // "optimized" or ...

	LegendWidth       float64 // width of legend in inches
	LegendHeight      float64 // height of legend in inches
	LineWidth         float64 // width of lines in legend in points
	FontSize          float64 // font size in points.
	Font              string  // Name of the font to use in legend
	FontColor         string
	EdgeColor         string // Color for legend outline
	BackgroundColor   string
	BackgroundOpacity float64
	// contains filtered or unexported fields
}

func NewColorMap

func NewColorMap(Type string) (c *ColorMap)

Initialize new color map. Types available are "Linear", and "LinCutoff", which is linear with a discontinuity at a percentile specified by "CutPercentile".

func (*ColorMap) AddArray

func (c *ColorMap) AddArray(data []float64)

func (*ColorMap) AddArrayServer

func (c *ColorMap) AddArrayServer(datachan chan []float64,
	finished chan int)

func (*ColorMap) AddGeoJSON

func (c *ColorMap) AddGeoJSON(g *GeoJSON, propertyName string)

func (*ColorMap) AddMap

func (c *ColorMap) AddMap(data map[string]float64)

func (*ColorMap) GetColor

func (cm *ColorMap) GetColor(v float64) color.NRGBA

get color for input value. Must run c.Set() first.

func (*ColorMap) Legend

func (c *ColorMap) Legend(w io.Writer, label string) (err error)

func (*ColorMap) Set

func (c *ColorMap) Set()

Figure out rules for color map

type Crs

type Crs struct {
	Type       string   `json:"type"`
	Properties CrsProps `json:"properties"`
}

Coordinate reference system. Used for GeoJSON

type CrsProps

type CrsProps struct {
	Name string `json:"name"`
}

Coordinate reference system properties.

type GeoJSON

type GeoJSON struct {
	Type     string `json:"type"`
	CRS      Crs    `json:"crs"`
	Features []*GeoJSONfeature
}

func LoadGeoJSON

func LoadGeoJSON(r io.Reader) (*GeoJSON, error)

func (*GeoJSON) GetGeometry

func (g *GeoJSON) GetGeometry() ([]geom.T, error)

func (*GeoJSON) GetProperty

func (g *GeoJSON) GetProperty(propertyName string) []float64

func (*GeoJSON) Sum

func (g *GeoJSON) Sum(propertyName string) float64

type GeoJSONfeature

type GeoJSONfeature struct {
	Type       string             `json:"type"`
	Geometry   geojson.Geometry   `json:"geometry"`
	Properties map[string]float64 `json:"properties"`
}

type MapData

type MapData struct {
	Cmap   *ColorMap
	Shapes []geom.T
	Data   []float64

	DrawEdges bool
	EdgeWidth float64
	// contains filtered or unexported fields
}

func NewMapData

func NewMapData(numShapes int, colorScheme string) *MapData

func (*MapData) ToGeoJSON

func (m *MapData) ToGeoJSON(valueName string) (*GeoJSON, error)

Convert map data to GeoJSON, where value name is a name for the data values being output.

func (*MapData) WriteGoogleMapTile

func (m *MapData) WriteGoogleMapTile(w io.Writer, zoom, x, y int) error

type Mapper

type Mapper interface {
	DrawVector(geom.T, color.NRGBA, color.NRGBA, float64, float64)
	Save()
}

type RasterMap

type RasterMap struct {
	I  draw.Image
	GC draw2d.GraphicContext
	// contains filtered or unexported fields
}

func NewRasterMap

func NewRasterMap(N, S, E, W float64, width int, f io.Writer) *RasterMap

func NewRasterMapFromRaster

func NewRasterMapFromRaster(S, W, dy, dx float64, ny, nx int,
	data []float64, cmap *ColorMap, f io.Writer) *RasterMap

Make a new raster map from raster data. It is assumed that the outer axis in the data is the Y-axis (north-south) and the inner axis is the X-axis (west-east) (i.e., len(data)==nx*ny && val[j,i] = data[j*nx+i]).

func (*RasterMap) DrawVector

func (r *RasterMap) DrawVector(g geom.T, strokeColor,
	fillColor color.NRGBA, linewidth, markersize float64)

Draw a vector on a raster map when given the geometry, stroke and fill colors, the width of the bounding line, and the size of the marker (only used for point shapes).

func (*RasterMap) Save

func (r *RasterMap) Save()

type UnsupportedGeometryError

type UnsupportedGeometryError struct {
	Type reflect.Type
}

func (UnsupportedGeometryError) Error

func (e UnsupportedGeometryError) Error() string

Jump to

Keyboard shortcuts

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