-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add date range to overpass query #39
Conversation
Hold off on reviewing this for now. I noticed two things I need to fix. |
e136420
to
077f249
Compare
077f249
to
f341f70
Compare
Ok! This is ready for review. It turns out I had a stray I did notice that there's not much good feedback for the user when a query completes successfully but does not return any features -- such as looking for Emergency Infrastructure in the last month. That request will 200 but since there are no features, no shapefile gets generated. I'm going to make an enhancement card for adding a visual indication that "No features were found". |
#40 is for handling the "No features found" indication |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works and looks good. Got a little tripped up on the construction of the functions for generating the query, but seems to be a thing that makes sense after you spend some time parsing it. I'm satisfied with it if it's reasonably conventional.
relation["${tag}"]${bbox}(newer:"${dateSelection}"); | ||
`; | ||
|
||
const createOverpassDateValueQueryElement = (bbox, dateSelection) => (tag, value) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this common syntax for functions that return functions? Took me a bit of scrolling up and down to put in all together wrt to declarations and usage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's the ES6 way to do currying or partial application. The lodash version of this would read a little more nicely but this project doesn't have that library and it didn't seem worthwhile to bring it in just for this.
I suppose these could be named more clearly to indicate that the initial functions are partially applied, but we can revisit if it becomes necessary.
Thanks for your help with this! |
Overview
Although the UI had a date range dropdown, making a selection there previously did not change the overpass query. This PR adjusts things such that selecting one of the date range options will change the query using the
newer
option:https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#newer
I brought in the momentjs library to handle structuring the dates more easily and ensure they would work on different browsers. Unfortunately, however, its
toISOString
method did not output exactly the format expected by Overpass -- so the code here manually formats it.Connects #38
Notes
First commit here fixes a minor style issue whereby the geocoder coordinate inputs would overextend their horizontal bounds. Glance at the coordinate inputs to verify that they no longer do.
Testing Instructions
./scripts/update