spatial_hash v0.1.0 SpatialHash
Documentation for SpatialHash.
Summary
Functions
Returns an array containing the hash elements for the given point for each dimension
Returns array of hash ranges for a given axis-aligned envelope
Functions
Returns an array containing the hash elements for the given point for each dimension.
Examples
iex> SpatialHash.hash([-0.2, -1.3], [{-180, 180, 0.05}, {-90, 90, 0.2}])
[3596, 443]
iex> SpatialHash.hash([0.2, -80.2], [{-180, 180, 0.05}, {-90, 90, 0.1}])
[3604, 98]
Returns array of hash ranges for a given axis-aligned envelope
Examples
iex> 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]
iex> 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]