libpysal.cg.geogrid

libpysal.cg.geogrid(pup, pdown, k, lonx=True)[source]

Computes a \(k+1\) by \(k+1\) set of grid points for a bounding box in lat-lon. Uses geointerpolate.

Parameters:
puptuple

The lat-lon or lon-lat for the upper left corner of the bounding box.

pdowntuple

The lat-lon or lon-lat for The lower right corner of The bounding box.

kint

The number of grid cells (grid points will be one more).

lonxbool

The method to assess the order of the coordinates. True for (lon,lat); False for (lat,lon). Default is True.

Returns:
gridlist

A list of tuples with (lat-lon) or (lon-lat) for grid points, row by row, starting with the top row and moving to the bottom; coordinate tuples are returned in same order as input.

Examples

>>> pup = (42.023768, -87.946389)       # Arlington Heights, IL
>>> pdown = (41.644415, -87.524102)     # Hammond, IN
>>> geogrid(pup,pdown, 3, lonx=False)
[(42.023768, -87.946389),
 (42.02393997819538, -87.80562679358316),
 (42.02393997819538, -87.66486420641684),
 (42.023768, -87.524102),
 (41.897317, -87.94638900000001),
 (41.8974888973743, -87.80562679296166),
 (41.8974888973743, -87.66486420703835),
 (41.897317, -87.524102),
 (41.770866000000005, -87.94638900000001),
 (41.77103781320412, -87.80562679234043),
 (41.77103781320412, -87.66486420765956),
 (41.770866000000005, -87.524102),
 (41.644415, -87.946389),
 (41.64458672568646, -87.80562679171955),
 (41.64458672568646, -87.66486420828045),
 (41.644415, -87.524102)]