-
-
Notifications
You must be signed in to change notification settings - Fork 361
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
Task: Script that imports oneway-data dump and makes it available via a web API #1022
Comments
Sound like a cool project! Is there a programming language which is preferred by you? |
The only requirement is that it runs on my webspace, the language is the implementer's choice. |
@ENT8R does this mean you picked this task? Otherwise, three questions for @westnordost due to the webspace capabilities:
(If you won't like to answer everything in detail, feel free to point me to your hoster's documentation.) |
Actually I started some experiments and I can now generate already a CSV file with only the ways with the status |
Yes I can't answer the other questions and I wouldn't know how to find this out. The hoster is wint.global, managed with Plesk. |
Wow, they have pretty bad documentation. At least I found nearly nothing. If I would do it with Python, I would ask for your assistance to find out which deployment possibilities they offer. However, since @ENT8R is doing it right now (and I assume with PHP) this is no longer important for me. Thanks anyway. |
I am not sure if he is doing it, he has still a couple of other things open. |
That was the reason why I asked for a commitment to the task. I don't like duplicating effort and while the data crunching and web stuff is fun and pretty straight forward, I would need to read one or two Wikipedia articles to get that LINESTRING centroid right. I prefer to let him do the steps he wanted to do, and wait for his decision. If he won't, I can give it a try. :) |
Here is a hint. |
I think I can show you a first working example in a few hours. I will tell if the code is available on Github. |
Alright. The very first version is now available on Github: https://github.com/ENT8R/oneway-data-api It is completely written in PHP The main problem is currently that the data is not imported into a SQL database but only saved in a file which needs to be accessed everytime a request is made. @exploide Do you have any experience with SQL databases? |
Yes, I have. Feel free to tell me how I can help. Maybe I have time to review later. Hopefully it's not too complex due to the external dependencies you made use of. My PHP is a bit rusty, but I will see :P The first thing I immediately spot is that your unprotected |
So you want to introduce an API key? IMHO a good idea. |
No, I want to have this offline xD Working on it now. If @ENT8R or @westnordost really think they want the update functionality online, then I stop this and you can go with it, but I don't know why this would be useful. Who should have a legitimate reason to trigger this update from the outside? A simple cron job invoking the php script and it's up to date everyday... |
Ah, yes, of course, it may be internally done by a cron job. Anyway as for external connections, one could introduce an API key anyway. Could be useful to limit the server load. |
I just submitted a WIP PR there. Maybe it's good to continue discussion there and in the other issue tracker, so less emails and notifications are emitted to the main project here. |
From my point of view we have now a great working tool/API. If you (@westnordost) have some more suggestions feel free to open an issue in the other repo. |
Fine. @ENT8R are there further construction sites you are aware of? Otherwise we can let @westnordost shoot a glance. I think one could see if either the geophp library or the own geometry code could be removed, but I leave this up to you. Regarding the bounds checks, I also only adapted what you did there to the MySQL query. JSON looked like yours before, but a second round of sanity checking would be good. After I spend the last years in the ORM world, raw SQL looked ugly to me, but for such a small page, I decided to not make use of an additional ORM library and keep the dependencies clean and easy. So from my point of view, we are pretty much done?! EDIT: ok, you commented just in the same moment :P Maybe update your testing site to the DB enabled version?! |
I shot a glance |
Everything seems to work now https://www.westnordost.de/streetcomplete/oneway-data-api/?bbox=18,-34,19,-33 |
(upstream ImproveOSM support shutdown - now to be removed, ref.: #5725) |
I could need help with something that is not a part of this app (=not Java code). Anyone interested?
Introduction
Amongst other things, Telenav collects and aggregates data about the traffic flow direction of likely oneway roads that have not been tagged as
oneway=yes
in OSM yet. This data is available as a daily worldwide dump on http://missingroads.skobbler.net/dumps/OneWays/This data can be used for the oneway-quest (#370). However, it must be made available to the app in form of a web API which can run on my webspace (Python, PHP, Ruby, Perl, perhaps more).
Mission
Your task is to write a script that
In detail:
1. Download and Import
wayId
,fromNodeId
,toNodeId
,latitude
,longitude
. Latitude and longitude should be the centroid of the givenLINESTRING
geometry. Only those rows should be imported which have a status ofOPEN
. WhethernumberOfTrips
should play a role there is TBD.2. Web-API
Resources
Distance between two (on assumed spherical Earth) geo-points in meters, necessary for centroid calculation:
The text was updated successfully, but these errors were encountered: