Coder Social home page Coder Social logo

spatial_hash_ex's Introduction

SpatialHash

Build Status Hex.pm

A library for calculating spatial hashes for points and geometries. This is most useful for building spatial databases with very fast indexing.

Installation

defp deps do
  [{:spatial_hash, "~> 0.1.0"}]
end

Usage

Full Documentation

The SpatialHash module provides a hash function that takes a single point on any dimension as an array of coordinates and an array of gridding properties for each dimension. Grid properties are specified as a tuple of coordinate min and max as well as a step value for the grid spacing. Convenience function of SpatialHash.world_grid() is provided that returns a grid of the entire world in degress with step value roughly equivalent to 10 meters.

A hash_range function is also provided that takes an Envelope or Geometry and returns the range covered in each dimension.

SpatialHash.hash_range(
  %Envelope{
    min_x: -90.082756,
    min_y: 29.949766,
    max_x: -90.079484,
    max_y: 29.952280
  }, [{-180, 180, 0.01}, {-90, 90, 0.01}]) // -> [8991..8992, 11994..11995]

SpatialHash.hash_range(
  %{type: "LineString", coordinates: [
    { -90.082746, 29.950955},
    {-90.081453, 29.952280},
    {-90.079489, 29.949770}
  ]}, SpatialHash.world_grid) // -> [89917..89920, 119949..119952]

spatial_hash_ex's People

Watchers

 avatar  avatar

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.