preindex

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2022 License: MIT Imports: 10 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 location 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

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 location.

func EnsureInside

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

func PreIndexLocation

func PreIndexLocation(input *pb.Location, idxZoom, aggZoom, maxZoomLevelToKeep maptile.Zoom, dropEdgeLayger int) ([]*pb.PreindexLocation, error)

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

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

func PreIndexLocations

func PreIndexLocations(input *pb.Locations, idxZoom, aggZoom, maxZoomLevelToKeep maptile.Zoom, dropEdgeLayger int) *pb.PreindexLocations

func PreIndexLocationsToGeoJSON

func PreIndexLocationsToGeoJSON(input *pb.PreindexLocations) []byte

Types

This section is empty.

Jump to

Keyboard shortcuts

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