Documentation ¶
Overview ¶
Package tegola describes the basic geometeries that can be used to convert to and from.
Index ¶
- Constants
- Variables
- func GeometeryDecorator(g Geometry, ptsPerLine int, comment string, ptDecorator func(pt Point) string) string
- func GeometryAsJSON(g Geometry, w io.Writer) error
- func GeometryAsMap(g Geometry) map[string]interface{}
- func GeometryAsString(g Geometry) string
- func IsCollectionEqual(c1, c2 Collection) bool
- func IsGeometryEqual(g1, g2 Geometry) bool
- func IsLineStringEqual(l1, l2 LineString) bool
- func IsMultiLineEqual(ml1, ml2 MultiLine) bool
- func IsMultiPointEqual(mp1, mp2 MultiPoint) bool
- func IsMultiPolygonEqual(mp1, mp2 MultiPolygon) bool
- func IsPoint3Equal(p1, p2 Point3) bool
- func IsPointEqual(p1, p2 Point) bool
- func IsPolygonEqual(p1, p2 Polygon) bool
- func LineAsPointPairs(l LineString) (pp []float64)
- type BoundingBox
- type Collection
- type Geometry
- type LineString
- type MultiLine
- type MultiPoint
- type MultiPolygon
- type Point
- type Point3
- type Polygon
- type Tile
- func (t *Tile) BoundingBox() BoundingBox
- func (t *Tile) BufferedBoundingBox() (BoundingBox, error)
- func (t *Tile) Deg2Num() (x, y int)
- func (t *Tile) FromPixel(srid int, pt [2]float64) (npt [2]float64, err error)
- func (t *Tile) Init()
- func (t *Tile) Num2Deg() (lat, lng float64)
- func (t *Tile) PixelBounds() (bounds [2][2]float64, err error)
- func (t *Tile) PixelBufferedBounds() (bounds [2][2]float64, err error)
- func (t *Tile) ToPixel(srid int, pt [2]float64) (npt [2]float64, err error)
- func (t *Tile) ZEpislon() float64
- func (t *Tile) ZLevel() int
- func (t *Tile) ZRes() float64
Constants ¶
const ( WebMercator = 3857 WGS84 = 4326 )
const ( DefaultEpislon = 10.0 DefaultExtent = 4096 DefaultTileBuffer = 64.0 MaxZ = 22 )
Variables ¶
var ( WebMercatorBounds = [4]float64{-20026376.39, -20048966.10, 20026376.39, 20048966.10} WGS84Bounds = [4]float64{-180.0, -85.0511, 180.0, 85.0511} )
var UnknownConversionError = fmt.Errorf("do not know how to convert value to requested value")
Functions ¶
func GeometeryDecorator ¶ added in v0.4.0
func GeometryAsMap ¶ added in v0.4.0
func GeometryAsString ¶ added in v0.4.0
func IsCollectionEqual ¶ added in v0.4.0
func IsCollectionEqual(c1, c2 Collection) bool
CollectionIsEqual will check to see if the provided collections are equal. This function does not check to see if the collections contain any recursive structures, and if there are any recursive structures it will hang. If the collections contains any unknown geometries it will be assumed to not match.
func IsGeometryEqual ¶ added in v0.4.0
GeometryIsEqual will check to see if the two given geometeries are equal. This function does not check to see if there are any recursive structures if there are any recursive structures it will hang. If the type of the geometry is unknown, it is assumed that it does not match any other geometries.
func IsLineStringEqual ¶ added in v0.4.0
func IsLineStringEqual(l1, l2 LineString) bool
IsLineStringEqual will check to see if the two linesstrings provided are equal.
func IsMultiLineEqual ¶ added in v0.4.0
IsMultiLineEqual will check to see if the two Multilines that are provided are equal.
func IsMultiPointEqual ¶ added in v0.4.0
func IsMultiPointEqual(mp1, mp2 MultiPoint) bool
IsMultiPointEqual will check to see if the two provided multipoints are equal
func IsMultiPolygonEqual ¶ added in v0.4.0
func IsMultiPolygonEqual(mp1, mp2 MultiPolygon) bool
MultiPolygonIsEqual will check to see if the two provided multi-polygons are equal.
func IsPoint3Equal ¶ added in v0.4.0
IsPoint3Equal will check to see if the two 3d tegola points are equal.
func IsPointEqual ¶ added in v0.4.0
IsPointEqual will check to see if the two tegola points are equal.
func IsPolygonEqual ¶ added in v0.4.0
PolygonIsEqual will check to see if the two provided polygons are equal.
func LineAsPointPairs ¶ added in v0.4.0
func LineAsPointPairs(l LineString) (pp []float64)
Types ¶
type BoundingBox ¶
type BoundingBox struct {
Minx, Miny, Maxx, Maxy float64
// Epsilon is the tolerance for the simplification function.
Epsilon float64
// X,Y,Z are just for debug and display purposes.
X, Y, Z int
HasXYZ bool
}
BoundingBox defines the extent of a tile
type Collection ¶
Collection is a collections of different geometries.
type LineString ¶
LineString is a Geometry of a line.
type MultiLine ¶
type MultiLine interface { Geometry Lines() []LineString }
MultiLine is a Geometry with multiple individual lines.
type MultiPoint ¶
MultiPoint is a Geometry with multiple individual points.
type MultiPolygon ¶
MultiPolygon describes a Geometry multiple intersecting polygons. There should only one exterior polygon, and the rest of the polygons should be interior polygons. The interior polygons will exclude the area from the exterior polygon.
type Point3 ¶
Point3 is a point with three dimensions; at current is just converted and treated as a point.
type Polygon ¶
type Polygon interface { Geometry Sublines() []LineString }
Polygon is a multi-line Geometry where all the lines connect to form an enclose space.
type Tile ¶
type Tile struct { Z int X int Y int Lat float64 Long float64 Tolerance float64 Extent float64 Buffer float64 // contains filtered or unexported fields }
Tile slippy map tilenames
http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames
func NewTileLatLong ¶ added in v0.6.0
NewTileLatLong will return a non-nil tile object.
func (*Tile) BoundingBox ¶
func (t *Tile) BoundingBox() BoundingBox
BoundingBox returns the bound box coordinates for upper left (ulx, uly) and lower right (lrx, lry) in web mercator projection ported from: https://raw.githubusercontent.com/mapbox/postgis-vt-util/master/postgis-vt-util.sql
func (*Tile) BufferedBoundingBox ¶ added in v0.6.0
func (t *Tile) BufferedBoundingBox() (BoundingBox, error)
func (*Tile) PixelBounds ¶ added in v0.6.0
func (*Tile) PixelBufferedBounds ¶ added in v0.6.0
func (*Tile) ZRes ¶
ZRes takes a web mercator zoom level and returns the pixel resolution for that
scale, assuming 256x256 pixel tiles. Non-integer zoom levels are accepted. ported from: https://raw.githubusercontent.com/mapbox/postgis-vt-util/master/postgis-vt-util.sql
TODO(gdey): I'm pretty sure we should be using the extent instead of 256 here. But I don't know what the magic number 40075016.6855785 is used for. 40075016.6855785 is close to 2*webmercator.MaxXExtent or 2*webmercator.MaxYExtent 40075016.6855785 is the equator in meters for WGS84 at z=0 256 is the tile width and height.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
config loads and understands the tegola config format.
|
config loads and understands the tegola config format. |
container
|
|
draw
|
|
!build
|
!build |
Package geom describes geometry interfaces.
|
Package geom describes geometry interfaces. |
encoding/wkb
Package wkb is for decoding ESRI's Well Known Binary (WKB) format for OGC geometry (WKBGeometry) sepcification at http://edndoc.esri.com/arcsde/9.1/general_topics/wkb_representation.htm There are a few types supported by the specification.
|
Package wkb is for decoding ESRI's Well Known Binary (WKB) format for OGC geometry (WKBGeometry) sepcification at http://edndoc.esri.com/arcsde/9.1/general_topics/wkb_representation.htm There are a few types supported by the specification. |
encoding/wkt/internal/cmd/fuzz/fuzz
Package fuzz provides primitives to generate random geom geometry types.
|
Package fuzz provides primitives to generate random geom geometry types. |
internal
|
|
mapbox
|
|
tilejson
TileJSON https://github.com/mapbox/tilejson-spec
|
TileJSON https://github.com/mapbox/tilejson-spec |
Package math contins generic math functions that we need for doing transforms.
|
Package math contins generic math functions that we need for doing transforms. |
webmercator
Package webmercator does the translation to and from WebMercator and WGS84 Gotten from: http://wiki.openstreetmap.org/wiki/Mercator#C.23
|
Package webmercator does the translation to and from WebMercator and WGS84 Gotten from: http://wiki.openstreetmap.org/wiki/Mercator#C.23 |
vector_tile
Package vectorTile is a generated protocol buffer package.
|
Package vectorTile is a generated protocol buffer package. |
debug
The debug provider returns features that are helpful for debugging a tile including a box for the tile edges and a point in the middle of the tile with z,x,y values encoded
|
The debug provider returns features that are helpful for debugging a tile including a box for the tile edges and a point in the middle of the tile with z,x,y values encoded |
Package server implements the http frontend
|
Package server implements the http frontend |
util
|
|
dict
This file was generated using gen.pl and go fmt.
|
This file was generated using gen.pl and go fmt. |