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 Layer
s: points
, lines
and
polygons
.
Give each Geometry type its own VectorTile layer, and store the ElementData as-is.
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.
The Extent of this Tile.
The Features to collate into various Layers.
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.
The means by which to transform some Feature's metadata into the type that VectorTiles expect.
Partition all Features into a single Layer.
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
.
The CRS Extent of the Tile to be created.
"Collator" or "Schema" functions which form
VectorTile
s from collections of GeoTrellisFeature
s. 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:
Create a VectorTile via some custom collation scheme:
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 VectorTileLayer
s. 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:
The output String is the name of the
Layer
you'd like a givenFeature
to be relegated to. Notice that the entireFeature
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 whatVectorTile
s expect:You're encouraged to review the
Value
sum-type in geotrellis.vectortileOn 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.