Giter VIP home page Giter VIP logo

Comments (1)

gboeing avatar gboeing commented on June 12, 2024

Thanks for using OSMnx.

The current problem is that when using OSMnx's graph_from_polygon (and potentially other graph functions) function, there is no straightforward way to specify a buffer zone in meters around the polygon. This limitation makes it challenging to include the street network data within a specified buffer, which is essential in cases where users need a more comprehensive representation of the network, especially in areas near the polygon boundary.

Users can currently do this with 2 lines of code, so we're probably not going to add this to the API. Historically, some piecemeal buffering functionality used to exist for some OSMnx functions, but was deprecated and will be fully removed from the codebase when v2.0 comes out. The consistent simple expectation is that users just request the study site that they actually want, since study site definitions are infinitely and easily adjustable. But as you rightly mention, the artificial periphery problem is essential to keep in mind in all spatial network analysis.

Sample code to do this now and in the future:

import osmnx as ox
geom = ox.geocode_to_gdf("Piedmont, CA, USA")["geometry"].iloc[0]

# buffer the geometry by 100 meters
geom_proj, crs = ox.projection.project_geometry(geom)
geom_buff, _ = ox.projection.project_geometry(geom_proj.buffer(100), crs=crs, to_latlong=True)

# model the driving network within the buffered geometry
G = ox.graph_from_polygon(geom_buff, network_type="drive")

from osmnx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.