pysal.lib.cg.PolygonLocator

class pysal.lib.cg.PolygonLocator(polygons)[source]

An abstract representation of a polygon indexing data structure.

Methods

contains_point(point) Returns polygons that contain point
inside(query_rectangle) Returns polygons that are inside query_rectangle
nearest(query_point[, rule]) Returns the nearest polygon indexed to a query point based on various rules.
overlapping(query_rectangle) Returns list of polygons that overlap query_rectangle
proximity(origin, r[, rule]) Returns the indexed polygons located within some distance of an origin point based on various rules.
region(region_rect) Returns the indexed polygons located inside a rectangular query region.
__init__(polygons)[source]

Returns a polygon locator object.

__init__(Polygon list) -> PolygonLocator

Parameters:
polygons : a list of polygons to index

Examples

>>> p1 = Polygon([Point((0, 1)), Point((4, 5)), Point((5, 1))])
>>> p2 = Polygon([Point((3, 9)), Point((6, 7)), Point((1, 1))])
>>> pl = PolygonLocator([p1, p2])
>>> isinstance(pl, PolygonLocator)
True

Methods

__init__(polygons) Returns a polygon locator object.
contains_point(point) Returns polygons that contain point
inside(query_rectangle) Returns polygons that are inside query_rectangle
nearest(query_point[, rule]) Returns the nearest polygon indexed to a query point based on various rules.
overlapping(query_rectangle) Returns list of polygons that overlap query_rectangle
proximity(origin, r[, rule]) Returns the indexed polygons located within some distance of an origin point based on various rules.
region(region_rect) Returns the indexed polygons located inside a rectangular query region.