libpysal.cg.PolygonLocator

class libpysal.cg.PolygonLocator(polygons)[source]

An abstract representation of a polygon indexing data structure.

Methods

contains_point(self, point)

Returns polygons that contain point

inside(self, query_rectangle)

Returns polygons that are inside query_rectangle

nearest(self, query_point[, rule])

Returns the nearest polygon indexed to a query point based on various rules.

overlapping(self, query_rectangle)

Returns list of polygons that overlap query_rectangle

proximity(self, origin, r[, rule])

Returns the indexed polygons located within some distance of an origin point based on various rules.

region(self, region_rect)

Returns the indexed polygons located inside a rectangular query region.

__init__(self, polygons)[source]

Returns a polygon locator object.

__init__(Polygon list) -> PolygonLocator

Parameters
polygonsa 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__(self, polygons)

Returns a polygon locator object.

contains_point(self, point)

Returns polygons that contain point

inside(self, query_rectangle)

Returns polygons that are inside query_rectangle

nearest(self, query_point[, rule])

Returns the nearest polygon indexed to a query point based on various rules.

overlapping(self, query_rectangle)

Returns list of polygons that overlap query_rectangle

proximity(self, origin, r[, rule])

Returns the indexed polygons located within some distance of an origin point based on various rules.

region(self, region_rect)

Returns the indexed polygons located inside a rectangular query region.