route_network/tests/test_planner.py
def grid_graph(min_lat, min_lon, max_lat, max_lon, step=0.001):
    """Generate a fully-connected rectangular grid.

    :param min_lat: Initial latitude [degrees].
    :param min_lon: Initial longitude [degrees].
    :param max_lat: Latitude limit [degrees].
    :param max_lon: Longitude limit [degrees].
    :param step: Step size [degrees].
    :returns: RouteNetwork message.
    """
    nid = unique_id.toMsg(unique_id.fromURL(PKG_URL + '/test_network'))

    r = RouteNetwork(id=nid)
    prev_row = None
    for latitude in float_range(min_lat, max_lat, step):
        prev_col = None
        this_row = len(r.points)
        for longitude in float_range(min_lon, max_lon, step):
            fake_url = 'fake://point/' + str(latitude) + '/' + str(longitude)
            pt_id = unique_id.fromURL(fake_url)
            r.points.append(makeWayPoint(pt_id, latitude, longitude))
            if prev_col is not None:
                s = makeSeg(prev_col, pt_id)
                r.segments.append(s)
                s = makeSeg(pt_id, prev_col)
                r.segments.append(s)
            prev_col = pt_id
            if prev_row is not None:
                prev_id = r.points[prev_row].id.uuid
                s = makeSeg(prev_id, pt_id)
                r.segments.append(s)
                s = makeSeg(pt_id, prev_id)
                r.segments.append(s)
                prev_row += 1
        prev_row = this_row
    return r
Generate a fully-connected rectangular grid.

    :param min_lat: Initial latitude [degrees].
    :param min_lon: Initial longitude [degrees].
    :param max_lat: Latitude limit [degrees].
    :param max_lon: Longitude limit [degrees].
    :param step: Step size [degrees].
    :returns: RouteNetwork message.
    
Generate a fully-connected rectangular grid.
Generate a fully - connected rectangular grid .
def grid_graph(min_lat, min_lon, max_lat, max_lon, step=0.001):
    nid = unique_id.toMsg(unique_id.fromURL(PKG_URL + '/test_network'))
    r = RouteNetwork(id=nid)
    prev_row = None
    for latitude in float_range(min_lat, max_lat, step):
        prev_col = None
        this_row = len(r.points)
        for longitude in float_range(min_lon, max_lon, step):
            fake_url = 'fake://point/' + str(latitude) + '/' + str(longitude)
            pt_id = unique_id.fromURL(fake_url)
            r.points.append(makeWayPoint(pt_id, latitude, longitude))
            if prev_col is not None:
                s = makeSeg(prev_col, pt_id)
                r.segments.append(s)
                s = makeSeg(pt_id, prev_col)
                r.segments.append(s)
            prev_col = pt_id
            if prev_row is not None:
                prev_id = r.points[prev_row].id.uuid
                s = makeSeg(prev_id, pt_id)
                r.segments.append(s)
                s = makeSeg(pt_id, prev_id)
                r.segments.append(s)
                prev_row += 1
        prev_row = this_row
    return r
def grid_graph ( min_lat , min_lon , max_lat , max_lon , step = 0.001 ) : nid = unique_id . toMsg ( unique_id . fromURL ( PKG_URL + '/test_network' ) ) r = RouteNetwork ( id = nid ) prev_row = None for latitude in float_range ( min_lat , max_lat , step ) : prev_col = None this_row = len ( r . points ) for longitude in float_range ( min_lon , max_lon , step ) : fake_url = 'fake://point/' + str ( latitude ) + '/' + str ( longitude ) pt_id = unique_id . fromURL ( fake_url ) r . points . append ( makeWayPoint ( pt_id , latitude , longitude ) ) if prev_col is not None : s = makeSeg ( prev_col , pt_id ) r . segments . append ( s ) s = makeSeg ( pt_id , prev_col ) r . segments . append ( s ) prev_col = pt_id if prev_row is not None : prev_id = r . points [ prev_row ] . id . uuid s = makeSeg ( prev_id , pt_id ) r . segments . append ( s ) s = makeSeg ( pt_id , prev_id ) r . segments . append ( s ) prev_row += 1 prev_row = this_row return r
Generate a fully-connected rectangular grid.
Generate a fully - connected rectangular grid .
"""Generate a fully-connected rectangular grid.

    :param min_lat: Initial latitude [degrees].
    :param min_lon: Initial longitude [degrees].
    :param max_lat: Latitude limit [degrees].
    :param max_lon: Longitude limit [degrees].
    :param step: Step size [degrees].
    :returns: RouteNetwork message.
    """
None
min_lat
Initial latitude [degrees].
Initial latitude [ degrees ] .
min_lon
Initial longitude [degrees].
Initial longitude [ degrees ] .
max_lat
Latitude limit [degrees].
Latitude limit [ degrees ] .
max_lon
Longitude limit [degrees].
Longitude limit [ degrees ] .
step
Step size [degrees].
Step size [ degrees ] .