How to use the osmnx.bbox_from_point function in osmnx

To help you get started, we’ve selected a few osmnx examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ppintosilva / anprx / tests / test_core.py View on Github external
def get_bbox(size):

    if size == "small":
        return core.BBox(54.97092396, 54.97080711,
                         -1.622966153, -1.622935367)

    elif size == "medium":
        return core.BBox(*ox.bbox_from_point(
                                point= (54.97351405, -1.62545930208892),
                                distance = 500))

    elif size == "uk":
        return core.BBox(59.478568831926395, 49.82380908513249,
                          -10.8544921875, 2.021484375)

    else:
        raise ValueError("No such bbox size")
github ppintosilva / anprx / tests / test_core.py View on Github external
def test_small_bbox_from_points():
    point1, point2 = get_points()
    bbox = get_bbox(size = "small")

    nw = core.Point(bbox.north, bbox.west)
    sw = core.Point(bbox.south, bbox.west)
    ne = core.Point(bbox.north, bbox.east)
    se = core.Point(bbox.south, bbox.east)

    points = [nw, sw, ne, se]

    bbox = core.bbox_from_points(points)
    expected_bbox = core.BBox(*ox.bbox_from_point(
                            point= core.get_meanpoint([point1, point2]),
                            distance = 100))

    assert_bbox_almost_equal(bbox, expected_bbox)
github ppintosilva / anprx / anprx / plot.py View on Github external
format of the image

    filename : string
        filename of the figure to be saved. The default value is the camera's id.

    dpi : int
        resolution of the image

    Returns
    -------
    fig, ax : tuple
    """
    if filename is None:
        filename = camera.id

    bbox = ox.bbox_from_point(point = camera.point,
                              distance = bbox_side)


    # Set color of near nodes by index
    nodes_colors = [node_color] * len(camera.network.nodes())

    if color_near_nodes:
        i = 0
        for node in camera.network.nodes(data = False):
            if node in camera.lsystem['nnodes']:
                nodes_colors[i] = nn_color
            i = i + 1

    # Color near edges
    edges_colors = [edge_color] * len(camera.network.edges())
github ppintosilva / anprx / anprx / animate.py View on Github external
sample_invalid_color : string
        color of sample points, in candidate edges, that don't fit the criteria: < camera.radius and < camera.max_angle

    Returns
    -------
    anim : FuncAnimation
    """

    start_time = time.time()

    # ----------------------------
    # Generate base fig
    # ----------------------------

    bbox = ox.bbox_from_point(point = camera.point,
                              distance = bbox_side)

    fig, axis = ox.plot_graph(
            camera.network,
            bbox = bbox,
            margin = margin,
            bgcolor = bgcolor,
            node_color = node_color,
            node_edgecolor = node_edgecolor,
            node_zorder = node_zorder,
            edge_color = edge_color,
            node_alpha = node_alpha,
            edge_linewidth = edge_linewidth,
            edge_alpha = edge_alpha,
            node_size = node_size,
            save = False,