def within_bbox(pt_coord, bbox):
    """Tests if geom is within the bbox envelope. Bbox of form (minx, maxx,
    miny, maxy) - IE the result of an ogr GetEnvelope() call."""
    result = False
    if pt_coord[0] >= bbox[0] and pt_coord[0] <= bbox[1] \
            and pt_coord[1] >= bbox[2] and pt_coord[1] <= bbox[3]:
        result = True      
    return result