Object

vectorpipe

Collate

Related Doc: package vectorpipe

Permalink

object Collate

"Collator" or "Schema" functions which form VectorTiles from collections of GeoTrellis Features. Any function can be considered a valid "collator" if it satisfies the type:

collate: (Extent, Iterable[Feature[G,D]]) => VectorTile

Usage

Create a VectorTile from some collection of GeoTrellis Geometries:

val tileExtent: Extent = ... // Extent of _this_ Tile
val geoms: Iterable[Feature[Geometry, Map[String, String]]] = ...  // Some collection of Geometries

val tile: VectorTile = Collate.withStringMetadata(tileExtent, geoms)

Create a VectorTile via some custom collation scheme:

def partition(f: Feature[G,D]): String = ...
def metadata(d: D): Map[String, Value] = ...

val tileExtent: Extent = ... // Extent of _this_ Tile
val geoms: Iterable[Feature[G, D]] = ...  // Some collection of Geometries

val tile: VectorTile = Collate.generically(tileExtent, geoms, partition, metadata)

Writing your own Collator Function

We provide a few defaults here, but any collation scheme is possible. Collation just refers to the process of organizing some Iterable collection of Geometries into various VectorTile Layers. Creating your own collator is done easiest with generically. It expects a partition function to guide Geometries into separate Layers, and a metadata transformation function.

Partition Functions

A valid partition function must be of the type:

partition: Feature[G,D] => String

The output String is the name of the Layer you'd like a given Feature to be relegated to. Notice that the entire Feature is available (i.e. both its Geometry and metadata), so that your partitioner can make fine-grained choices.

Metadata Transformation Functions

One of these takes your D type and transforms it into what VectorTiles expect:

metadata: D => Map[String, Value]

You're encouraged to review the Value sum-type in geotrellis.vectortile

On Winding Order

VectorTiles require that Polygon exteriors have clockwise winding order, and that interior holes have counter-clockwise winding order. These assume that the origin (0,0) is in the top-left corner.

Any custom collator which does not call generically must correct for Polygon winding order manually. This can be done via the vectorpipe.winding function.

But why correct for winding order at all? Well, OSM data makes no guarantee about what winding order its derived Polygons will have. We could correct winding order when our first RDD[OSMFeature] is created, except that its unlikely that the clipping process afterward would maintain our winding for all Polygons.

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

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def byGeomType[G <: Geometry, D](f: Feature[G, D]): String

    Permalink

    Can be used as the partition argument to generically.

    Can be used as the partition argument to generically. Splits Geometries by their subtype, naming three Layers: points, lines and polygons.

  6. def byOSM(tileExtent: Extent, geoms: Iterable[OSMFeature]): VectorTile

    Permalink

    Give each Geometry type its own VectorTile layer, and store the ElementData as-is.

  7. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. def generically[G <: Geometry, D](tileExtent: Extent, geoms: Iterable[Feature[G, D]], partition: (Feature[G, D]) ⇒ String, metadata: (D) ⇒ Map[String, Value]): VectorTile

    Permalink

    Given some Feature and a way to determine which Layer it should belong to (by layer name), collate each Feature into the appropriate Layer and form a VectorTile.

    Given some Feature and a way to determine which Layer it should belong to (by layer name), collate each Feature into the appropriate Layer and form a VectorTile. Polygon winding order is corrected.

    tileExtent

    The Extent of this Tile.

    geoms

    The Features to collate into various Layers.

    partition

    The means by which to place a certain Feature into a certain Layer. The String is returns is the name of the Layer the collate the Feature into.

    metadata

    The means by which to transform some Feature's metadata into the type that VectorTiles expect.

  12. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  13. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  14. def intoOneLayer[G <: Geometry, D](f: Feature[G, D]): String

    Permalink

    Partition all Features into a single Layer.

  15. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  16. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  17. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  18. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  19. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  20. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  21. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. def withStringMetadata[G <: Geometry](tileExtent: Extent, geoms: Iterable[Feature[G, Map[String, String]]]): VectorTile

    Permalink
  25. def withoutMetadata[G <: Geometry, D](tileExtent: Extent, geoms: Iterable[Feature[G, D]]): VectorTile

    Permalink

    Collate some collection of Features into a VectorTile while dropping any metadata they might have had.

    Collate some collection of Features into a VectorTile while dropping any metadata they might have had. The resulting Tile has three Layers, labelled points, lines, and polygons.

    tileExtent

    The CRS Extent of the Tile to be created.

Inherited from AnyRef

Inherited from Any

Ungrouped