GithubHelp home page GithubHelp logo

Unions filter about osmnx HOT 5 CLOSED

arkty avatar arkty commented on August 21, 2024
Unions filter

from osmnx.

Comments (5)

gboeing avatar gboeing commented on August 21, 2024 1

Closed by #1204

from osmnx.

gboeing avatar gboeing commented on August 21, 2024

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.

arkty avatar arkty commented on August 21, 2024

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.

gboeing avatar gboeing commented on August 21, 2024

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.

arkty avatar arkty commented on August 21, 2024

@gboeing i've created a PR #1204.

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.