Code Monkey home page Code Monkey logo

pgs2's Introduction

pgs2

Postgres extension for S2 spherical geometry.

Fixed Length Types

These fixed length types are stored "flat" and only turned into S2 instances at the point of use. They are stored very efficiently by Postgres.

S2Point

Stored as 3 double precision floats.

S2Cap

Point and radius stored as 4 doubles.

S2LatLng

Stored as 2 doubles.

S2LatLngRect

Stored as 4 doubles.

S2Cell

An S2CellId is an unsigned 64bit integer, but since Postgres doesn't have unsigned integer types, it's SQL literal representation is an S2Cell "token" string. The token is decoded into an unsigned int64 and stored optimally.

Cells can be cast to S2Point and S2LatLng by returning their center point. S2Point and S2LatLng can be cast to a cell. Normally there is exactly one such cell for a given point, but for points along cell boundaries one cell id detiministically chosen:


TODO Variable Length S2Region Types

These types are variable length "expanded" types, they are stored in a flattened representation using S2 Encoder/Decoder and automatically expanded into live objects as needed when loaded into memory.

S2Polyline

S2Loop

S2Polygon

TODO Aggregate S2Builder

S2Builder is wrapped by an aggregate, any region can be added to the builder.

select s2builder(region, layer_name) as from ... where ...;

s2builder supports all current geometry types.

TODO Indexing

S2Cell Token btree with text_pattern_ops

S2CellId QuadTree with SP-GIST TODO

S2RegionTermIndexer using GIN TODO

pgs2's People

Contributors

michelp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

dm1tr1 zhangdida

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.