preindex

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package preindex

Background

The Ray Casting algorithm's time complexity is $O(n^2)$ which is expensive for high throughput API that severing geo based data like weather forecasts. And most of these requests are came from big cities around the world.

If we can reduce these location's query execution times, our API could got performance improvements.

How to

Preindex's logic is very simple, generate map tiles around a multi polygon, and exclude 1/2 edge layer, then merge to upper tiles. Then dumps all the tiles's X/Y/Z and timezone to Protocol Buffer based data.

A sample image of output tiles show on maps: https://user-images.githubusercontent.com/13536789/200174943-7d40661e-bda5-4b79-a867-ec637e245a49.png

Some areas are excluded from prefindex, since default most small tile `level==11` couldn't cover polygon shape details, see tzf#76 for more backgrounds. Latest excluded areas can be views here exclude.geojson

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DropEdgeTiles

func DropEdgeTiles(tiles []maptile.Tile) []maptile.Tile

Drop most outside layer of tile, since tile may cover area not included in timezone.

func EnsureInside

func EnsureInside(geopolys []*geometry.Poly, tiles []maptile.Tile) []maptile.Tile

func PreIndexTimezone

func PreIndexTimezone(input *pb.Timezone, idxZoom, aggZoom, maxZoomLevelToKeep maptile.Zoom, dropEdgeLayger int) ([]*pb.PreindexTimezone, error)

PreIndexTimezone will gen tiles at idxZoom level and merge up to aggZoom.

The `idxZoom` level tiles will be removed before final return.

func PreIndexTimezones

func PreIndexTimezones(input *pb.Timezones, idxZoom, aggZoom, maxZoomLevelToKeep maptile.Zoom, dropEdgeLayger int) *pb.PreindexTimezones

func PreIndexTimezonesToGeoJSON

func PreIndexTimezonesToGeoJSON(input *pb.PreindexTimezones) []byte

Types

This section is empty.

Jump to

Keyboard shortcuts

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