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 with lat-lon or lon-lat for upper left corner of bounding box
pdowntuple with lat-lon or lon-lat for lower right corner of bounding box
knumber of grid cells (grid points will be one more)
lonxbool to assess the order of the coordinates,

for lon,lat (default) = True, for lat,lon = False

Returns
gridlist 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)]