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

How to include Date Diff Adiff queries? #179

Closed
neogeomat opened this issue Jul 25, 2019 · 11 comments
Closed

How to include Date Diff Adiff queries? #179

neogeomat opened this issue Jul 25, 2019 · 11 comments

Comments

@neogeomat
Copy link
Contributor

how to query attic date using the date, diif , adiff parameters as stated here?
https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#date

@mpadge
Copy link
Member

mpadge commented Jul 25, 2019

Hey, I didn't realise that those QL features had been implemented - thanks so much for the info. At the moment, this is not possible, but i'll try to implement it soon.

@neogeomat
Copy link
Contributor Author

I wrote this much, couldn't get the datetime_string inside quotes as required in the query.

add_date <- function (opq,datetime=Sys.time())
{
  datetime_string <- as.character(t,format = "%Y-%m-%dT%H:%M:%SZ")
  opq$prefix <- paste('[date:',datetime_string,']',opq$prefix,sep = "")
  print(opq$prefix)
}
add_date(op)

@mpadge
Copy link
Member

mpadge commented Jul 25, 2019

You'd be most welcome to submit a PR if you'd like. You can easily insert quotes by escaping: \". Until you or I implement this, a workaround would be to call opq() separately, then modify the string in there by adding "date:..", then pass it to add_osm_feature() %>% osmdata_sc/f/p().

@mpadge mpadge pinned this issue Oct 29, 2019
@TomBor
Copy link

TomBor commented Mar 5, 2020

Would be great to have this functionality!

@mpadge
Copy link
Member

mpadge commented Mar 5, 2020

Relevant news from r-devel NEWS:

R now provides a syntax for specifying raw character constants similar to the one used in C++: r"(...)" with ... any character sequence, except that it must not contain the closing sequence )". This makes it easier to write strings that contain backslashes or both single and double quotes. For more details see ?Quotes.

@mpadge mpadge closed this as completed in fa1ae12 Mar 5, 2020
@Robinlovelace
Copy link
Member

Impressive!

@mpadge
Copy link
Member

mpadge commented Mar 5, 2020

That commit implements opq() parameters datetime (for dates) and datetime2 (for differences in data between 2 dates). Re-opened to document in vignette.

@mpadge mpadge reopened this Mar 5, 2020
@mpadge
Copy link
Member

mpadge commented Mar 5, 2020

Also have to add the datetime values to the output metadata

mpadge added a commit that referenced this issue Mar 6, 2020
@mpadge mpadge closed this as completed in 2f84878 Jun 8, 2020
@jmaspons
Copy link
Collaborator

Adiff queries still missing. It requires to parse a different xml response format containing the new and old status of the objects. I would reopen the issue

@mpadge
Copy link
Member

mpadge commented Nov 30, 2022

@jmaspons but there's no way of representing the information from an "Adiff" query in any of the data structures here. This package remains in essence a spatial package, and that Adiff information is effectively unstructured, and generally not spatial. Or even worse: You can never know in advance whether an Adiff will reflect actual spatial differences, or other, non-spatial differences. One of the biggest challenges of this package is rectifying the non-spatial and spatial aspects; for an Adiff that task becomes far more difficult.

This is not to say it would be impossible, just way more trouble than what it would be worth. I presume - and this is just a presumption - that even Diff queries are relatively little-used within this package, and that when anybody wants time comparisons, then a standard Diff will almost always suffice. The use-cases for ADiff are very specialised, and accordingly of equivalently little general relevance. Processing ADiff results would be too much work for too little general boost in package functionality here, I'd say.

@jmaspons
Copy link
Collaborator

@mpadge OSM is a database with more than spatial data. I'm working in implementing queries with out tags; which return simpler structures which can easily fit in a data.frame.

Currently, adiff results works with osmdata_xml. We can leave the user to play with the xml and take advantage of all the nice infrastructure to build queries and get results from overpass. Later, perhaps we can offer adiff results with osmdata_data.frame (see #285) and out tags; queries. And who knows, perhaps in the future somebody can solve the problem with adiff queries and spatial data.

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

5 participants