pysal.lib.cg.Grid

class pysal.lib.cg.Grid(bounds, resolution)[source]

Representation of a binning data structure.

Methods

add(item, pt) Adds an item to the grid at a specified location.
bounds(bounds) Returns a list of items found in the grid within the bounds specified.
in_grid(loc) Returns whether a 2-tuple location _loc_ lies inside the grid bounds.
nearest(pt) Returns the nearest item to a point.
proximity(pt, r) Returns a list of items found in the grid within a specified distance of a point.
remove(item, pt) Removes an item from the grid at a specified location.
__init__(bounds, resolution)[source]

Returns a grid with specified properties.

__init__(Rectangle, number) -> Grid

Parameters:
bounds : the area for the grid to encompass
resolution : the diameter of each bin

Examples

TODO: complete this doctest >>> g = Grid(Rectangle(0, 0, 10, 10), 1)

Methods

__init__(bounds, resolution) Returns a grid with specified properties.
add(item, pt) Adds an item to the grid at a specified location.
bounds(bounds) Returns a list of items found in the grid within the bounds specified.
in_grid(loc) Returns whether a 2-tuple location _loc_ lies inside the grid bounds.
nearest(pt) Returns the nearest item to a point.
proximity(pt, r) Returns a list of items found in the grid within a specified distance of a point.
remove(item, pt) Removes an item from the grid at a specified location.