libpysal API reference¶
Spatial Graph¶
Modern implementation of spatial graphs encoding spatial weights matrices.
|
Graph class encoding spatial weights matrices |
|
Graph Summary |
|
Read Graph from a Apache Parquet |
|
Read Graph from a GAL file |
|
Read Graph from a GWT file |
Spatial Weights¶
Legacy implementation of spatial weights matrices.
|
Spatial weights class. |
Distance Weights¶
|
Spatial weights based on distance band. |
|
Spatial weights based on kernel functions. |
|
Creates nearest neighbor weights matrix based on k nearest neighbors. |
|
Constructs the Gabriel graph of a set of points. |
|
Constructor of the Delaunay graph of a set of input points. |
Constructs the Relative Neighborhood graph from a set of points. |
Contiguity Weights¶
|
Construct a weights object from a collection of pysal polygons that share at least one vertex. |
|
Construct a weights object from a collection of pysal polygons that share at least one edge. |
|
Voronoi weights for a 2-d point set |
|
Spatial weights class. |
spint Weights¶
|
Thin |
|
Create a network-contiguity based weight object based on different nodal relationships encoded in a network. |
|
Convert a matrix denoting network connectivity (edges or flows) to a list denoting edges |
|
Constructs an o*d by o*d origin-destination style spatial weight for o*d flows using standard spatial weights on o origins and d destinations. |
|
Distance-based spatial weight for vectors that is computed using a 4-dimensional distance between the origin x,y-coordinates and the destination x,y-coordinates |
Weights tools to interface with rasters¶
|
Create a W object from xarray.DataArray with an additional attribute index containing coordinate values of the raster in the form of Pandas.Index/MultiIndex. |
|
Create a WSP object from xarray.DataArray with an additional attribute index containing coordinate values of the raster in the form of Pandas.Index/MultiIndex. |
|
Creates xarray.DataArray object from passed data aligned with W object. |
|
Creates xarray.DataArray object from passed data aligned with WSP object. |
|
Creates 2 or 3 dimensional test xarray.DataArray object |
Weights Util Classes and Functions¶
|
Construct spatial weights for regime neighbors. |
|
Create a W object for a regular lattice. |
|
Combinations of size n taken from items |
|
Determine the non-redundant order of contiguity up to a specific order. |
|
Contiguity weights object of order k. |
Find the Shimbel matrix for first order contiguity matrix. |
|
|
Remaps the IDs in a spatial weights object. |
|
Create a PySAL W object from a full array. |
Generate a full numpy array. |
|
|
Convert a pysal WSP object (thin weights matrix) to a pysal W object. |
|
Gets the IDs from the DBF file that moves with a given shape file or a geopandas.GeoDataFrame. |
Gets a data array of x and y coordinates from a given shapefile. |
|
|
Returns a new weights object with values inserted along the main diagonal. |
Weights user Classes and Functions¶
Get the maximum nearest neighbor distance. |
|
|
Create a sparse W matrix for a regular lattice. |
Local clustering coefficients for each unit as a node in a graph. |
|
|
Contiguity weights for either a sparse W or W for order k. |
|
Create a W object for a hexagonal lattice. |
|
Attach nearest neighbor to islands in spatial weight w. |
Detect neighbors for non-planar polygon collections |
|
|
Fuzzy contiguity spatial weights |
Get the maximum nearest neighbor distance between observations in the shapefile. |
|
Build a lattice shapefile with nrows rows and ncols cols. |
|
|
Sparse scipy matrix for w from a gal file. |
Test if the neighbor sets are equal between two weights objects |
Set Theoretic Weights¶
|
Returns a binary weights object, w, that includes all neighbor pairs that exist in either w1 or w2. |
|
Returns a binary weights object, w, that includes only those neighbor pairs that exist in both w1 and w2. |
|
Returns a binary weights object, w, that includes only neighbor pairs in w1 that are not in w2. |
Returns a binary weights object, w, that includes only neighbor pairs that are not shared by w1 and w2. |
|
|
Returns a binary weights object, w, that includes only those observations in ids. |
|
Clip a continuous W object (w1) with a different W object (w2) so only cells where w2 has a non-zero value remain with non-zero values in w1. |
Spatial Lag¶
Spatial lag operator. |
|
|
Spatial lag operator for categorical variables. |
cg: Computational Geometry¶
alpha_shapes¶
|
Alpha-shape delineation (Edelsbrunner, Kirkpatrick & Seidel, 1983) from a collection of points |
|
Computation of alpha-shape delineation with automated selection of alpha. |
voronoi¶
|
Create Voronoi polygons from a GeoSeries of points, lines, or polygons. |
sphere¶
Convert a string or number to a floating-point number, if possible. |
|
Convert a string or number to a floating-point number, if possible. |
|
|
Arc distance between two points on a sphere. |
|
Convert an arc distance (spherical earth) to a linear distance (R3) in the unit sphere. |
|
Computes a brute-force \(k\) nearest neighbors. |
|
Computes \(k\) nearest neighbors on a sphere. |
|
Find all neighbors on a sphere within a threshold distance. |
|
Convert a linear distance in the unit sphere (R3) to an arc distance based on supplied radius. |
|
Convert a point's x,y,z to latitude and longitude. |
Convert a point's latitude and longitude to x,y,z. |
|
|
Converts point order from lat-lon tuples to lon-lat (x,y) tuples. |
|
Alternative the arc distance function, uses the haversine formula. |
|
Finds a point on a sphere along the great circle distance between two points on a sphere also known as a way point in great circle navigation. |
|
Computes a \(k+1\) by \(k+1\) set of grid points for a bounding box in lat-lon. |
shapes¶
|
Geometric class for point objects. |
|
Geometric representation of line segment objects. |
|
Geometric representation of line objects. |
|
Geometric representation of ray objects. |
|
Geometric representation of a chain, also known as a polyline. |
|
Geometric representation of polygon objects. |
|
Geometric representation of rectangle objects. |
|
Returns a PySAL shape object from |
standalone¶
|
Old Stars method for bounding box overlap testing. |
|
Find bounding box for a list of geometries. |
|
Returns the angle formed between a pair of rays which share an origin. |
|
Returns whether a triplet of points is collinear. |
|
Returns the intersection of two segments if one exists. |
Returns the intersection of a segment and point. |
|
|
Returns the intersection of a polygon and point. |
Returns the intersection of a rectangle and point. |
|
|
Returns the intersection of a ray and line segment. |
Returns the intersection between two rectangles. |
|
|
Returns the distance between a polygon and point. |
|
Returns the distance between a pair of points. |
|
Returns (1) the distance between a line segment and point and (2) the distance along the segment to the closest location on the segment from the point as a ratio of the length of the segment. |
|
Returns the point at a distance and angle relative to the origin of a ray. |
|
Returns the convex hull of a set of points. |
|
Returns whether a list of points describing a polygon are clockwise or counterclockwise. |
|
Returns |
|
Returns the line segments in common to both polygons. |
|
Calculate a distance matrix. |
locators¶
|
Representation of a binning data structure. |
|
An abstract representation of a point indexing data structure. |
|
An abstract representation of a polygon indexing data structure. |
kdtree¶
|
kd-tree built on top of kd-tree functionality in scipy. |
io¶
alias of |
|
|
Metaclass for supporting spatial data file read and write. |
examples¶
Return a dataframe with available datasets. |
|
Explain a dataset by name. |
|
|
Get the path for a file by searching installed datasets. |