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
- pup
python:tuplewithlat-lon or lon-latforupperleftcornerofboundingbox - pdown
python:tuplewithlat-lon or lon-latforlowerrightcornerofboundingbox - k
numberofgridcells(gridpointswillbeonemore) - lonxbool
toassesstheorderofthecoordinates, for lon,lat (default) = True, for lat,lon = False
- pup
- Returns
- grid
python:listoftupleswithlat-lon or lon-latforgridpoints,rowbyrow, starting with the top row and moving to the bottom; coordinate tuples are returned in same order as input
- grid
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)]