Comments (5)
Closed by #1204
from osmnx.
Interesting idea for a relatively minimal change to make this a bit smoother for the user. I'm trying to think through the implications and trade-offs of this technique. Please share any insights as such.
See also the discussion at gboeing/osmnx-examples#90 for another (possibly infeasible) idea of addressing this.
from osmnx.
Another way to implement this is actually use overpass unions.
This will require to change query creation.
Example code (not tested).
for polygon_coord_str in polygon_coord_strs:
way_subquery_str = ""
for way_filter_str in way_filter:
way_subquery_str += f"(way{way_filter_str}(poly:{polygon_coord_str!r});"
query_str = f"{overpass_settings};{way_subquery_str}>;);out;"
yield _overpass_request(OrderedDict(data=query_str))
In some cases, polygon_coord_str
can be really long (because poly statement will appear in each way query), therefore request payload size will be increased. I have not found any limits about request size on Overpass side, so this still can be an implementation option.
Adding support for custom_filter
to be a list of filters looks like a simple change, but I am not sure will this confuse users or not, because it might be not clear that custom_filter: list[str]
means union filter.
On the other hand, creating own query structure for custom_filter
will lead to reproducing Overpass query language. And this not looks like a thing that can be easily developed and maintained.
from osmnx.
Overall I think making this change to custom_filter: str | list[str] | None = None
would be a sensible enhancement to simplify union queries (thus avoiding nx.compose
).
@arkty would you like to open a PR?
@EwoutH this may be of interest given your question at the examples repo.
from osmnx.
@gboeing i've created a PR #1204.
from osmnx.
Related Issues (20)
- Add function to merge parallel roads HOT 4
- Publish v2 pre-releases HOT 1
- Issues with plotting and basic stats when using DiGraphs HOT 1
- AttributeError: module 'osmnx' has no attribute 'convert' HOT 1
- InsufficientResponseError while HOT 1
- FutureWarning: The 'unary_union' attribute is deprecated HOT 4
- Issue with graph_from_bbox on Visual Studio code. HOT 5
- plot_graph raises an MPL error while running in a remote Linux machine HOT 1
- Change bounding box coordinates' order for v2.0.0? HOT 2
- Graph route animations HOT 3
- `consolidate_intersections` crashes with dictionary for tolerances HOT 4
- Bounding Box doesn't work in ox.features_from_bbox(bbox, tags) HOT 1
- We need a fucntion that can generate gdf_nodes and gdf_edges from locallly downloaded road network loaded using geopandas as gdf HOT 3
- No Modules 1.9.3 HOT 1
- Optimize _remove_polygon_holes function for improved performance with complex geometries HOT 9
- Response Error for some network types/cities HOT 1
- Feature request: truncate_by_nearest_edge while generating graph from point HOT 1
- TypeError when using graph_from_bbox in OSMnx 2.0.0b1 HOT 9
- Incompatible with the version of numpy 2.1.0.rc1 when using 2.0.0b1 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from osmnx.