示例#1
0
 def test_buffer_within_buffer(self):
     point = project(POINT_3200M['geometry']['coordinates'])
     found = self.location.get_object(point, buffer_size=4000)
     self.assertIsNotNone(found)
示例#2
0
 def test_buffer_nearest2(self):
     point = project(POINT_3200M['geometry']['coordinates'])
     found = self.location.get_object(point, buffer_size=100000)
     self.assertIsNotNone(found, "get_object failed to return object")
     error = "get_object failed to return object with id=polygon1: Actual < {0} >"
     self.assertEqual('polygon1', found['id'], error.format(found['id']))
示例#3
0
 def test_basic(self):
     self.assert_found(project(POINT_WITHIN['geometry']['coordinates']))
     self.assert_none(project(POINT_3200M['geometry']['coordinates']))
     self.assert_none(project(POINT_53000M['geometry']['coordinates']))
示例#4
0
 def test_buffer_within_buffer(self):
     point = project(POINT_3200M['geometry']['coordinates'])
     found = self.location.get_object(point, buffer_size=4000)
     self.assertIsNotNone(found)
示例#5
0
 def test_basic(self):
     self.assert_found(project(POINT_WITHIN['geometry']['coordinates']))
     self.assert_none(project(POINT_3200M['geometry']['coordinates']))
     self.assert_none(project(POINT_53000M['geometry']['coordinates']))
示例#6
0
 def test_buffer_nearest2(self):
     point = project(POINT_3200M['geometry']['coordinates'])
     found = self.location.get_object(point, buffer_size=100000)
     self.assertIsNotNone(found, "get_object failed to return object")
     error = "get_object failed to return object with id=polygon1: Actual < {0} >"
     self.assertEqual('polygon1', found['id'], error.format(found['id']))
示例#7
0
import unittest
import os
from os.path import dirname
import sys

from rtree import index

from . import ROOT as GEOTWEET_DIR  # also adds ROOT to path to import from geotweet
from geotweet.mapreduce.utils.lookup import project, SpatialLookup

TEST_GEOJSON_LOCAL = os.path.join(GEOTWEET_DIR,
                                  'data/geo/us_states102005.geojson')
MAX_COUNT = 100
RESULTS_COUNT = 51
PORTLAND = project((-122.5, 45.5))


def exists(location):
    dat = location + ".dat"
    idx = location + ".idx"
    return os.path.isfile(dat) and os.path.isfile(idx)


def clear(location):
    try:
        os.remove(location + ".idx")
    except:
        pass
    try:
        os.remove(location + ".dat")
    except:
示例#8
0
import unittest
import os
from os.path import dirname
import sys

from rtree import index

from . import ROOT as GEOTWEET_DIR  # also adds ROOT to path to import from geotweet
from geotweet.mapreduce.utils.lookup import project, SpatialLookup


TEST_GEOJSON_LOCAL = os.path.join(GEOTWEET_DIR, 'data/geo/us_states102005.geojson')
MAX_COUNT = 100
RESULTS_COUNT = 51
PORTLAND = project((-122.5, 45.5))


def exists(location):
    dat = location + ".dat"
    idx = location + ".idx"
    return os.path.isfile(dat) and os.path.isfile(idx)


def clear(location):
    try: os.remove(location + ".idx")
    except: pass
    try: os.remove(location + ".dat")
    except: pass


class GetObjectTests(unittest.TestCase):