예제 #1
0
 def testappenddown(self):
     "with point near bottom edge, we expect an extra box to the bottom"
     lat = _dec(42.2)
     lon = _dec(-83.5)
     pt = geobox2.Geobox(lat, lon)
     boxes = pt.storage_geoboxes()
     eq_([self.center, self.down], boxes)
예제 #2
0
 def testappendup(self):
     "with point near top edge, we expect an extra box to the top"
     lat = _dec(42.8)
     lon = _dec(-83.5)
     pt = geobox2.Geobox(lat, lon)
     boxes = pt.storage_geoboxes()
     eq_([self.center, self.up], boxes)
예제 #3
0
 def testappendright(self):
     "with point near right edge, we expect an extra box to the right"
     lat = _dec(42.5)
     lon = _dec(-83.2)
     pt = geobox2.Geobox(lat, lon)
     boxes = pt.storage_geoboxes()
     eq_([self.center, self.right], boxes)
예제 #4
0
 def testonebox(self):
     "with point in middle of scope, should be no adjacent boxes added"
     lat = _dec(42.5)
     lon = _dec(-83.5)
     pt = geobox2.Geobox(lat, lon)
     boxes = pt.storage_geoboxes()
     eq_([self.center], boxes)
예제 #5
0
 def testappendtopleft(self):
     "with point near top left edge, we expect extra boxes for the corner"
     lat = _dec(42.8)
     lon = _dec(-83.8)
     pt = geobox2.Geobox(lat, lon)
     boxes = pt.storage_geoboxes()
     eq_(sorted([self.center, self.left, self.up, self.leftup]),
         sorted(boxes))
예제 #6
0
 def testappendbottomright(self):
     "with point near bottom right edge, we expect extra boxes for the corner"
     lat = _dec(42.2)
     lon = _dec(-83.2)
     pt = geobox2.Geobox(lat, lon)
     boxes = pt.storage_geoboxes()
     eq_(sorted([self.center, self.right, self.down, self.rightdown]),
         sorted(boxes))
예제 #7
0
def testboundingbox():
    lat = _dec(42.270872)
    lon = _dec(-83.726329)
    a2 = geobox2.Geobox(lat, lon)
    scope = _dec(1.0)
    top, left, bottom, right = a2.bounding_box(lat, lon, scope)
    assert top > lat, "top > lat"
    assert bottom < lat, "bottom < lat"
    assert left < lon, "left < lon"
    assert right > lon, "right > lon"

    eq_(top, _dec(43.0), "top")
    eq_(bottom, _dec(42.0), "bottom")
    eq_(left, _dec(-84.0), "left")
    eq_(right, _dec(-83.0), "right")