Package

geotrellis.vectortile.protobuf

internal

Permalink

package internal

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. internal
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. sealed trait Command extends Serializable

    Permalink

    VectorTile geometries are stored as packed lists of "Command Integers".

    VectorTile geometries are stored as packed lists of "Command Integers". There are currently three legal Commands: MoveTo, LineTo, and ClosePath. Each adhere to the following format:

    [ ... 00000 | 000 ]
    -------------------
          |        |
          |        --- The "Command ID". MoveTo: 001 (1)
          |                              LineTo: 010 (2)
          |                              ClosePath: 111 (7)
          |
          --- The remaining 29 bits are the "Parameter Count".
              This indicates the number of _pairs_ of ints
              that follow that should be interpreted as Z-encoded
              deltas from the current "cursor".

    The "cursor" is the location of the current vertex being considered, and it starts at (0,0) for each Feature. As MoveTo and LineTo commands are read, the cursor moves according the list of parsed delta pairs. ClosePath does not move the cursor, but may in future versions of the spec.

    Caveats:

    • Point features, whether single or multi, will always consist of a single MoveTo.
    • Any Polygon in a Polygon feature must have a LineTo with a count of at least 2.
    • ClosePath must always have a parameter count of 1.
  2. case class CommandError(id: Int, count: Int) extends Exception with Product with Serializable

    Permalink

    If some invalid combination of command id and parameter count are given.

  3. case class CommandSequenceError(message: String) extends Exception with Product with Serializable

    Permalink

    If an sequence of Commands is given that does not conform to what the Point, LineString, and Polygon decoders expect.

  4. case class LineTo(deltas: Array[(Int, Int)]) extends Command with Product with Serializable

    Permalink

    LineTo indicates that a LineString should be continued from the current cursor.

  5. case class MoveTo(deltas: Array[(Int, Int)]) extends Command with Product with Serializable

    Permalink

    MoveTo signals a series of moves from the current cursor (default of (0,0)).

    MoveTo signals a series of moves from the current cursor (default of (0,0)). The parameter pairs that follow don't represent a point to move to, but instead are deltas from the current cursor.

  6. trait ProtobufGeom[G1 <: Geometry, G2 <: MultiGeometry] extends Serializable

    Permalink

    An isomorphism for any Geotrellis geometry type that can convert between a collection of Command Integers.

    An isomorphism for any Geotrellis geometry type that can convert between a collection of Command Integers. As of version 2.1 of the VectorTile spec, there is no explicit difference between single and multi geometries. When there eventually is, this trait will have to be split to provide separate instances for both the single and multi forms.

    Since we assume that all VectorTiles implicitely exist in some CRS, we ask for the top-left corner of the current Tile's extent, as well as its resolution in order to perform the transformation into CRS space.

    Instances of this trait can be found in the package object.

    Usage:

    val topLeft: Point = ...
    val resolution: Double = ...
    
    implicitly[ProtobufGeom[Point, MultiPoint]].fromCommands(Command.commands(Seq(9,2,2)), topLeft, resolution)

Value Members

  1. object ClosePath extends Command with Product with Serializable

    Permalink

    Signals the end of a Polygon.

    Signals the end of a Polygon. Never has parameters, and doesn't move the cursor.

  2. object Command extends Serializable

    Permalink

    Contains convenience functions for handling Commands.

  3. def fromProjection(point: Point, topLeft: Point, resolution: Double): (Int, Int)

    Permalink

    Translate Point coordinates within a CRS to those of a fixed VectorTile grid.

    Translate Point coordinates within a CRS to those of a fixed VectorTile grid. The reverse of toProjection.

    point

    The Point in CRS space.

    topLeft

    The CRS coordinates of the top-left corner of this Tile.

    resolution

    How much of the CRS's units are covered by a single VT grid coordinate.

    returns

    Grid coordinates in VectorTile space.

  4. implicit val protoLine: ProtobufGeom[Line, MultiLine]

    Permalink

    Instance definition of the ProtobufGeom typeclass for Lines.

  5. implicit val protoPoint: ProtobufGeom[Point, MultiPoint]

    Permalink

    Instance definition of the ProtobufGeom typeclass for Points.

  6. implicit val protoPolygon: ProtobufGeom[Polygon, MultiPolygon]

    Permalink

    Instance definition of the ProtobufGeom typeclass for Polygons.

  7. implicit def protoVal(value: internal.vector_tile.Tile.Value): Value

    Permalink

    Automatically convert mid-level Protobuf Values into a high-level Value.

  8. def toProjection(point: (Int, Int), topLeft: Point, resolution: Double): Point

    Permalink

    Translate coordinates in VectorTile grid space into real CRS coordinates.

    Translate coordinates in VectorTile grid space into real CRS coordinates.

    point

    A point in a VectorTile geometry, in grid coordinates.

    topLeft

    The location in the current CRS of the top-left corner of this Tile.

    resolution

    How much of the CRS's units are covered by a single VT grid coordinate.

    returns

    The Point projected into the CRS.

    Translation Logic

    Extents always exist in some CRS. Below is information for determining values related to translating fixed VectorTile grid coordinates into map coordinates within the implied CRS. You can find resolution this way. Let:

    G := Height of grid (# number of cell rows)
    T := Height of a Tile (default 4096)
    E := Height of the Extent

    Then the resolution

    R = E / (G * T)

    This actually allows same-Tile Layers with different integer extent values to make sense! Finding the top-left corner

    X = xmin + (R * T * SpatialKeyX)
    Y = ymax - (R * T * SpatialKeyY)

    Resolution and the top-left corner only need to be calculated once per Layer. Shifting the VT grid points

    vtX = X + (R * tileX)
    vtY = Y - (R * tileY)
  9. package vector_tile

    Permalink

Inherited from AnyRef

Inherited from Any

Ungrouped