nzmap

package
v0.0.0-...-f2c17e5 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2024 License: MIT, Apache-2.0 Imports: 2 Imported by: 0

README

New Zealand Maps

A pkg for making maps of New Zealand without a database.

The following files in this project are auto generated:

  • nzicon.go
  • nzmedium.go
  • nzrcicon.go
  • nzsicon.go

They are generated using map180/nzmap_gen_test.go. Refer to that file for instructions.

Data Sources

The assembled New Zealand data set uses data sourced from:

Documentation

Overview

Package nzmap is for drawing large scale context maps in SVG format of the New Zealand region. There are no external dependencies.

Calling code can draw markers on the maps as required. The closing </svg> tag must also be added.

  var b bytes.Buffer
  var pts nzmap.Points

  pts.Medium(b)

	for _, p := range pts {
		if p.Visible() {
			b.WriteString(fmt.Sprintf("<path d=\"M%d %d l5 0 l-5 -8 l-5 8 Z\" stroke-width=\"0\" fill=\"blue\" opacity=\"0.7\"></path>",
			p.X(), p.Y()))
		}
	}

 b.WriteString("</svg>")

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Point

type Point struct {
	Longitude, Latitude float64

	Value                 float64 // Points can be sorted by Value.
	Stroke, Fill, Opacity string  // Optional for any later drawing funcs
	Size                  int     // Optional for any later drawing funcs
	// contains filtered or unexported fields
}

func (*Point) Icon

func (p *Point) Icon(b *bytes.Buffer)

Icon selects a small low resolution coastline map of New Zealand, and possibly surrounding regions, that is suitable for icon size maps.

func (*Point) Visible

func (p *Point) Visible() bool

Visible returns true if p is visible on the SVG canvas. Icon() or Map() must be called to set this value.

func (*Point) X

func (p *Point) X() int

Returns the SVG x coord for p. Icon() or Map() must be called to set this value.

func (*Point) Y

func (p *Point) Y() int

Returns the SVG y coord for p. Icon() or Map() must be called to set this value.

type Points

type Points []Point

func (Points) Len

func (p Points) Len() int

func (Points) Less

func (p Points) Less(i, j int) bool

func (Points) Medium

func (pts Points) Medium(b *bytes.Buffer)

Medium returns a map of New Zealand or the region around New Zealand at medium resolution. Linear interpolation is used between grid points to estimate the location of each Point on the map.

pts[0] is used to decide which region to return.

func (Points) Swap

func (p Points) Swap(i, j int)

Jump to

Keyboard shortcuts

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