コード例 #1
0
def test_location_filters(base_kwargs):
    result = AccidentMarker.bounding_box_query(yield_per=50, **base_kwargs)
    accident_markers = result.accident_markers
    rsa_markers = result.rsa_markers
    for marker in accident_markers:
        assert base_kwargs['sw_lat'] <= marker.latitude  <= base_kwargs['ne_lat']
        assert base_kwargs['sw_lng'] <= marker.longitude <= base_kwargs['ne_lng']
    for marker in rsa_markers:
        assert base_kwargs['sw_lat'] <= marker.latitude  <= base_kwargs['ne_lat']
        assert base_kwargs['sw_lng'] <= marker.longitude <= base_kwargs['ne_lng']
コード例 #2
0
def test_location_filters(base_kwargs):
    result = AccidentMarker.bounding_box_query(yield_per=50, **base_kwargs)
    accident_markers = result.accident_markers
    rsa_markers = result.rsa_markers
    for marker in accident_markers:
        assert base_kwargs['sw_lat'] <= marker.latitude <= base_kwargs['ne_lat']
        assert base_kwargs['sw_lng'] <= marker.longitude <= base_kwargs['ne_lng']
    for marker in rsa_markers:
        assert base_kwargs['sw_lat'] <= marker.latitude <= base_kwargs['ne_lat']
        assert base_kwargs['sw_lng'] <= marker.longitude <= base_kwargs['ne_lng']
コード例 #3
0
ファイル: clusters_calculator.py プロジェクト: yarons/anyway
def retrieve_clusters(**kwargs):
    start_time = time.time()
    result = AccidentMarker.bounding_box_query(is_thin=True, **kwargs)
    accident_markers_in_box = result.accident_markers.all()
    rsa_markers_in_box = result.rsa_markers.all()
    logging.debug("getting cluster data from db took %f seconds" %
                  (time.time() - start_time))
    start_time = time.time()
    clusters = calculate_clusters(accident_markers_in_box + rsa_markers_in_box,
                                  kwargs["zoom"])
    logging.debug("calculating clusters took %f seconds" %
                  (time.time() - start_time))
    return clusters
コード例 #4
0
def test_light_severity_filter(base_kwargs):
    base_kwargs['show_light'] = False
    markers = AccidentMarker.bounding_box_query(yield_per=50, **base_kwargs)[0]
    for marker in markers:
        assert marker.severity != 3
コード例 #5
0
def test_approx_filter(base_kwargs):
    base_kwargs['accurate'] = False
    markers = AccidentMarker.bounding_box_query(yield_per=50, **base_kwargs)[0]
    for marker in markers:
        assert marker.locationAccuracy != 1
コード例 #6
0
def test_location_filters(base_kwargs):
    query = AccidentMarker.bounding_box_query(yield_per=50, **base_kwargs)[0]
    for marker in query:
        assert base_kwargs['sw_lat'] <= marker.latitude  <= base_kwargs['ne_lat']
        assert base_kwargs['sw_lng'] <= marker.longitude <= base_kwargs['ne_lng']
コード例 #7
0
def test_light_severity_filter(base_kwargs):
    base_kwargs['show_light'] = False
    result = AccidentMarker.bounding_box_query(yield_per=50, **base_kwargs)
    accident_markers = result.accident_markers
    for marker in accident_markers:
        assert marker.accident_severity != 3
コード例 #8
0
def test_approx_filter(base_kwargs):
    base_kwargs['accurate'] = False
    result = AccidentMarker.bounding_box_query(yield_per=50, **base_kwargs)
    accident_markers = result.accident_markers
    for marker in accident_markers:
        assert marker.location_accuracy != 1
コード例 #9
0
def test_light_severity_filter(base_kwargs):
    base_kwargs['show_light'] = False
    result = AccidentMarker.bounding_box_query(yield_per=50, **base_kwargs)
    accident_markers = result.accident_markers
    for marker in accident_markers:
        assert marker.accident_severity != 3
コード例 #10
0
def test_approx_filter(base_kwargs):
    base_kwargs['accurate'] = False
    result = AccidentMarker.bounding_box_query(yield_per=50, **base_kwargs)
    accident_markers = result.accident_markers
    for marker in accident_markers:
        assert marker.location_accuracy != 1