Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"make stats" supported? #35

Closed
MaRaSu opened this issue Jan 3, 2021 · 2 comments
Closed

"make stats" supported? #35

MaRaSu opened this issue Jan 3, 2021 · 2 comments

Comments

@MaRaSu
Copy link

MaRaSu commented Jan 3, 2021

I would like to query for specific areas & time periods ways meeting a certain criteria and for those ways get count and total length. As an example:

[timeout:60][date:"2020-01-01T00:00:00Z"][out:json];area(3603579531)->.searchArea;(way["mtb:scale"](area.searchArea););make stat number=count(ways),length=sum(length()); out;

I can manually build the query and use .toJSON() on query response to access the desired stats values, however preferred way would be to use overpassQueryBuilder and Data class. Looking at the code it looks like this is not supported?

@mocnik-science
Copy link
Owner

Dear MaRaSu, you are right, make stats is currently not supported by the overpassQueryBuilder. There is some functionality of Overpass that is only used rarely, and this command is among them. I might extend OSMPythonTools somewhen but have currently no time to do so. Due to the special type of request, I anyway would recommend to provide the query as a string. I hope that this is fine and works well.

@mocnik-science
Copy link
Owner

Dear @MaRaSu,

Thank you again for your patience. I have check this issue again and come to the conclusion that it would not be a good idea to add such functionality. OSMPythonTools should be as simple as possible, and implementing such statistical functionality would mean to make (1) the code much harder to read and maintain, (2) makes it harder to understand the possibilities this package offers for the standard user, and (3) would eventually lead to creating a language that is equally powerful than the one used by Overpass. I would advise to build your queries manually and use the toJSON function in the way you do it. I understand that you might not feel happy about this decision, but it seems impossible to always be en par with the options offered by the Overpass language. Sorry.

Best

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants