project: [D7] OSM Route
component: module
Overview
This module is born for the need to automatically retrieve and represent a route path starting from a list of coordinates (georeferenced entities) exploiting the YOURS REST APIs.
As far as we have investigated, there are no modules, nor workaround or easily patchable modules aimed at achieving the desired result.
In fact there are no route planning modules in the Drupal cauldron, except a few ones that are not enough versatile. For instance the interesting project routeplanner provides the possibility to build just a two points path, one of which is fixed.
Following Developer Guidelines
Project application check list has been followed, as well as licensing, documentation, and best practices checks.
As for security check, no queries to DB are made, e.g., for retrieving configuration data the Drupal api are always used. The few edit fields are built through the Drupal API and have been tested where used.
Coder (and Coder Sniffer), have been launched in order to adapt the source code and the repository to the Drupal community coding conventions. pareview.sh has been succesfully launched with no warnings.
Case Study
This module has already been succesfully tested and exploited inside the project TPE: Tourisme, Ports Environnement for http://www.maritimeit-fr.net/), thus I consider this module mature for publishing.
Project Inforrmation
Project home page: https://drupal.org/sandbox/artsakenos/2122323
Target: Drupal 7
Git Repo:
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/artsakenos/2122323.git osm_route
PAReview.sh Results: http://pareview.sh/pareview/httpgitdrupalorgsandboxartsakenos2122323git
Reviews to other modules and further contributions
Review Bonus phase 01 (20 Dec 2013)
- https://www.drupal.org/node/2145689#comment-8620675
- https://www.drupal.org/node/2275135#comment-8828607
- https://www.drupal.org/node/2278193#comment-8840063
Went first time in RTBC on 26 January, then more features have been added also to provide driving instructions.
Review Bonus phase 02 (20 Dec 2014)
- https://www.drupal.org/node/2386767#comment-9416497
- https://www.drupal.org/node/2237631#comment-9416613
- https://www.drupal.org/node/2392119#comment-9433829
Further contributions
In the meanwhile I also contributed developing another module to retrieve the elevation profile of a given path. Also this module has been exploited in the projects above mentioned and in the evolution of the web site Sardegna Sentieri. I also started reviewing and patching other modules (e.g., imagemapster, workbench moderation).
Comment | File | Size | Author |
---|---|---|---|
#23 | test_osm_route.png | 388.04 KB | Grimreaper |
Comments
Comment #1
artsakenos CreditAttribution: artsakenos commentedComment #2
PA robot CreditAttribution: PA robot commentedWe are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)
Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #3
cheatlex CreditAttribution: cheatlex commentedHi, a good idea for a module - first glance:
1.) The link to the project contained an empty a tag - cause it not to work.
2.) You only need the git where a reviewer can get the source not your own.
3.) Looks like there is some missing files line 9 in osm_route.module, you require "osm_route.admin.inc", I cant find this file anywhere ?, and insted of require this you should just add it in the .info file.
4.) You should make an install file with check for that curl is installed. take a look at: hook_requirements()
Other than that it looks fine but I cant install it.
Comment #4
artsakenos CreditAttribution: artsakenos commentedDear cheatlex, thanks for your feedback and the precious suggestions.
☑Fixed
☑Fixed.
☑Fixed. The file had been removed last minute for mistake.
☑Fixed. The _requirements() hook has been implemented in order to verify the presence of the needed curl extension.
Further fixes:
The admin menu has been moved under the “services” category.
Comment #5
Bogdan1988 CreditAttribution: Bogdan1988 commentedHi artsakenos!
Here are some suggestions:
1) There is no hook_admin_settings(), please look here https://drupal.org/node/286528. I would recommend you to look here too https://drupal.org/node/1354#forms.
2) Please pay attention to validate and submit functions docs https://drupal.org/node/1354#forms.
3) here is the last suggestion. What if user need couple content types to be able to use OSM. Maybe you can add this ability.
Thank you for nice code!
Comment #6
artsakenos CreditAttribution: artsakenos commentedDear Bodgan1988, thanks for your kind suggestions.
☑Fixed.
☑Fixed.
This is a interesting idea for future work, indeed! In my opinion at this stage of developement, this configuration is effective enough to cover most of the needs, and the simple configuration make it ideal. In any case I would be glad to hear from you some scenario that can take advantage of this functionality.
Thanks again for reviewing.
Comment #7
artsakenos CreditAttribution: artsakenos commentedComment #8
klausiRemoving review bonus tag, you have not listed any reviews in the issue summary? Make sure to read the docs again: http://drupal.org/node/1975228
Comment #9
artsakenos CreditAttribution: artsakenos commentedHi klausi. Obviously there are no reviews in my summary. I flagged for mistake while browsing issue tags and editing the document.
Thanks for the new feedback and the correction and sorry for the inconvenience caused.
Comment #10
ram4nd CreditAttribution: ram4nd commentedSome of these are my personal suggestion that you don't have to take seriously. The first two are those that must be fixed.
Comment #11
artsakenos CreditAttribution: artsakenos commentedHi ram4nd,
thank you for your feedback.
☑ Fixed. Set permission to 644.
☑ Fixed. .gitignore removed from repo.
☑ Fixed. Since W3C consortium is suggesting the use of lowercase ag, so I am changing it everywhere in the module.
☑ Fixed. That’s a remnant from the previous tab indent settings. I fixed it to the 2 spaces indentations.
☑ Fixed. I am considering to list the module in the “Fields” package since it adds a field capability, but I’ll wait for more feedback on this. Now I’ll leave it in the “Others” package.
☑ Fixed. I agree, thanks for noticing. I removed all non necessary double quotes.
Each one of these suggestions was precious.
Thanks a lot.
I tested the module again before pushing, thus back in the queue for this contribution to be reviewed and approved.
In the meanwhile my best wishes for a great 2014 to all the Drupal Community.
Comment #12
markaspot CreditAttribution: markaspot commentedHi artsakenos, I can confirm that all of the issues above are fixed.
There are just two smaller issues:
files[] = osm_route.install
files[] = osm_route.module
Those lines should be removed. It's only necessary to declare files[] if they declare a class or interface.
Please note: The Coder module currently has an unresolved flaw which will prompt you to add file declarations to your .info file even when it's not necessary to do so. Please do not try to make this warning go away by declaring files which do not contain classes or interfaces.
osm_route_admin.inc
. Better practice could be to usedrupal_http_request
instead. This Drupal HTTP client implementation takes care if a site is behind a proxy.Comment #13
artsakenos CreditAttribution: artsakenos commentedDear markaspot, first of all thanks for taking action on the module.
I performed the fixes you suggested:
You’re right, I relayed on coder requirements without noticing the issue you cited.
About the web content retrieval, I switched to
drupal_http_request
leaving a wrapping method for future handling of connection/retrieval failure related behaviours. The .install is no more required, thus it has been removed.Cheers.
Comment #14
artsakenos CreditAttribution: artsakenos commentedI improved the module adding Driving Instructions feature: now the module can automatically store driving instructions to a multivalue long-text field of the node if needed, dividing it into segments of a roadbook. The module can also provide the same functionality on fly in form of a block for a node page.
On the other hand, after the RTBC I prefer to wait for the final review process steps before pushing major changes.
I found no references about the fact that the review bonus is mandatory [see 1, 2, 3], but I also saw this comment by an experienced reviewer. While I am getting the time that providing more valuable reviews deserves, I also developed a module for elevation profiling that seems to be sought after the Drupal community. Clearly I can’t publish it, but in case you're here cause you’re interested at handling with routing, have a look to that other contribution.
Comment #15
artsakenos CreditAttribution: artsakenos commentedIn addition to the cited case studies, the evolution of the module OSM Route, allowing to retrieve the driving directions of a given path. will be used in the Sardegna Sentieri web site with another module I developed to contribute to the Drupal community.
Comment #16
mpdonadiopareview.sh came up clean, but I have been having problems with it the last day or two.
The project page could use some more info about how to use the module.
You need to elaborate the README.txt a little bit to better explain how to use this. At first glance I was expecting
POI and itinerary content types to already be there.
The docblock on osm_route_help is wrong.
(*) Your usage of osm_route.admin.inc is wrong. Typically, you just use this for your admin pages, and not
general hooks. You also set this via the hook_menu, and don't require it at the top level.
(*) You need a hook_uninstall in osm_route.install to get rid of the variables you are creating.
Avoid HTML in t().
Your settings form can probably use element level validation, eg element_validate_number() and friends.
(*) The hook_install() should go in osm_route.install
(*) I am pretty sure #multiple_toggle is coming from a non-core module. It isn't documented in the Form API (https://api.drupal.org/api/drupal/developer!topics!forms_api_reference.h...). I would
convert these to selects or checkboxes.
I don't think osm_route_get_webpage() is needed; use drupal_http_request() instead.
osm_route_node_presave() should use the Field API instead of directly accessing the field values. Or, you
can investigate entity_metadata_wrapper, which is part of the Entity module.
(*) The URL builder in osm_route_get_geofield() is bad. Use drupal_http_request() instead. Don't forget to error
check the response code.
Your define()s aren't namespaced to your module. These may interfere with other modules.
Normally, variables use underscores instead of camel case.
(*) You should check if the referenced nodes in osm_route_node_presave() is published or not. This
would allow users to have tentative changes to routes, and unpublished nodes are normally inaccessible to
anonymous users. See also next, which is similar.
(*) You may also have a weird situation where an itinerary may contain POIs that aren't accessible to all users (for
example, if node access records are in use). This is a tricky situation; your route may expose information about
the node the current user doesn't have access to. I am not sure what the best option is for
this. Perhaps you need to do something like
This doesn't cover the situation of hiding nodes in a route from certain users.
Starred issues (*) are blockers, but I am open to discussion about how to handle the last one.
Please don't remove the security tag, we keep that for statistics and to show examples of security problems.
Comment #17
artsakenos CreditAttribution: artsakenos commentedDear Matthew,
◎ Ok. I double checked, the offline version was reporting no issues. I checked and fixed everything with the online one.
☑ Fixed. The project page has been updated to better explain the module purpose, and to accompany the user during the installation process.
☑ This also has been better explained, step by step with field names as an example.
☑ Fixed, now it just “Implements hook_help().”
☑ All the hooks not belonging to the admin panel have been moved.
☑ Fixed. osm_route.install has been created. hook_install moved inside, and hook_uninstall implemented.
☑ Fixed
☑ Fixed, and this approach made the code cleaner.
☑ Fixed
☑ Fixed
☒ In progress. Thank you for suggesting this. However, since this is not blocking and requires some cautious code replacing and testing I am taking more time to do it. I’ll handle this using entity_metadata_wrapper instead of field_get_items.
☑ Fixed. As I said in a previous comment I would have used osm_route_get_webpage has a wrapper in the future, but ok, it has been removed in favor of drupal_http_request.
☑ Fixed. Contingent error is caught and drupal message and watchdogs are reported.
☑ Fixed
☑ Fixed
☑ Fixed, Since unpublished nodes are (unless otherwise explicitely declared) invisbile to anonymous users, I solve this one inside the next topic.
☑ Fixed, Thinking about this for a while, also to the cases in which a complex system of permissions is being used, I found a solution which could be optimal.
Taking into account that, generally, this module is not intended to work inside intranets with specific permission architectures or to target this kind of situation, I prevent the exposure of non published or non accessible data to the first level of unauthorized users (anonymous users) as a default behaviour, and I let the developer who uses this module to handle more complex behaviour. At first, I was thinking to implement a hook invocation, then I found a better solution passing the list of accessible nodes by the drupal_alter. Waiting for further comments to this intriguing topic.
◎ Ok.
Sorry for my late answer due to work commitments, and thanks for your precious comments and teachings.
Comment #18
klausiReview of the 7.x-1.x branch:
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.
manual review:
Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.
Comment #19
artsakenos CreditAttribution: artsakenos commentedHello Klausi,
☑ Fixed
☑ Fixed
☑ Fixed
☑ Fixed
☑ Fixed
Performed further edits according to suggestions by Denisev.
Thanks a lot.
It is going to be a great module.
A.
Comment #20
artsakenos CreditAttribution: artsakenos commentedAll request have been processed and resolved.
Changing priority to Critical as suggested in the review process.
Went first time in RTBC on 26 January, then more features have been added to provide driving instructions in the natural evolution of the module since its birth in November 2013.
Comment #21
mpdonadio@artsakenos, Getting another review bonus will help speed up the process and make sure it gets on the review admins radar.
Comment #22
GrimreaperHello,
I just test your module, it looks great. It's my first review of a project application.
Pareview.sh : OK
I look the code and I did not see something to say. Maybe phpdoc for the constant you define ?
Documentation :
I think there is one or two more steps to detail and it will be ok.
What about the cardinality of field_path ?
I tried to display some contents on a map modifying the feature in example in the openlayers module and I did not managed to do it.
Should I use the field_path on the openlayer view or the geofield in the POI content type ?
It is a little bit confusing, field_poi or field_waypoints ? : In the README.txt
"A content type (e.g., POI) containing a field of type geofield (e.g., field_poi)" ......"Create/configure the POI content type/entity (e.g., POI): Create a field of type geofield (e.g., field_waypoints)"
I also should say that I tried quickly. I will retry to test tomorrow.
Thanks for this promising module.
Comment #23
GrimreaperOk,
I took the time to well configure the content types and it worked perfectly. I attached a screenshot.
I think what need to be precised is that field_path must be multivalue (or it is unnecessary ?) and that in the openlayers views, for the geofields, uncheck "Display all values in the same row" in the "Multiple field settings" fieldset.
I think to be able to show the waypoints and the itinerary on the same map, it should be the same geofield. But that is clearly a detail.
Thanks for this really cool module.
Comment #24
artsakenos CreditAttribution: artsakenos commentedGrimreaper, thanks for your appreciation and comments.
POI is a content type, field_waypoints is a field, and you're right about the typo in the document, I fixed and improved it also in the project page according to your suggestions.
For future reviewers, please don't put module in "needs work" status if issues are not blocking, this module is already having a hard time.
Answering to #21, I am aware that further reviews are mandatory to have a project published (see my comment #14). I am working on it.
Thanks for your help and suggestions.
Comment #25
er.pushpinderrana CreditAttribution: er.pushpinderrana commented@artsakenos, just a quick review of your module.
#description
inosm_route_near_threshold
field element. Same applies forosm_route_help
.I will do detailed review in next few days, it would better to get review bonus back soon :)
Thank you for your hard work and patience.
Comment #26
artsakenos CreditAttribution: artsakenos commentedDear er.pushpinderrana,
Ok, I am waiting for the second step of this review then.
Please check the version of the module you downloaded, I couldn't find any $field_test in the head of the branch and I can't rise those warnings.
Thanks for your help.
Comment #27
artsakenos CreditAttribution: artsakenos commentedAll issues have been resolved.
Comment #28
balagan CreditAttribution: balagan commentedComment #29
balagan CreditAttribution: balagan commentedThe name of this project is OSM Routes, but it shows up between modules as OpenStreetMap Route. I got a bit confused when I searched for OSM, and did not find the module.
Unfortunately I got "The API page http://www.yournavigation.org/api/1.0/gosmore.php could not be reached." error, and due to this the module is not working. I will try it later, and do a manual review for now.
The codig standards say "Functions and variables should be named using lowercase, and words should be separated with an underscore." I saw you missed this a few times, for example: osm_route_triesnumber, $allfields, OSM_ROUTE_YOURNAVIGATION_URL, OSM_ROUTE_YOURNAVIGATION_QUERY_TEMPLATE,
Otherwise I see no problem. I wonder if yournavigation.org is down only temporarily.
Comment #30
balagan CreditAttribution: balagan commentedComment #31
artsakenos CreditAttribution: artsakenos commentedHello Balagan,
I applied fixes by your suggestions.
About OSM_ROUTE_YOURNAVIGATION_URL, OSM_ROUTE_YOURNAVIGATION_QUERY_TEMPLATE, are registered as constants, so I kept them uppercased and yournavigation refers to the server url so i prefer not to separate words.
Please note that the infrastracture hosting OSM has been renewed leading to some OOS for DNS propagation, just the day you were trying the module. Anyway, OSM Route administration panel allows you to redefine the service address, useful in case a service address changes, and also in case you want to install your Gosmore RE instance.
#24. I forgot last time, Happy Birthday OSM Route.
Comment #32
davidam CreditAttribution: davidam commentedAutomated Review
Yes. http://pareview.sh/pareview/httpgitdrupalorgsandboxartsakenos2122323git
Manual Review
Individual user account
Yes. You can read https://www.drupal.org/node/272587
No duplication
Why do you think that is better create a new project than improve routeplanner?
Master Branch
Yes, you can check: https://www.drupal.org/node/1127732
Licensing
Yes, you can check: https://www.drupal.org/licensing/faq
3rd party code
It's ok, too: https://www.drupal.org/node/422996
README.txt/README.md
You can improve it with https://www.drupal.org/node/2181737
Code long/complex enough for review
Yes, you can read: https://groups.drupal.org/node/195848
Secure Code
Why are you using get_t instead of t?
you can read: https://www.drupal.org/writing-secure-code.
Style of Code
You are using
define('OSM_ROUTE_YOURNAVIGATION_URL', 'osm_route_yournavigation_url');
define('OSM_ROUTE_YOURNAVIGATION_QUERY_TEMPLATE', 'osm_route_yournavigation_quer
y_template');
You can create variables in the admin settings, better.
This code is dirty:
$base_url = variable_get(OSM_ROUTE_YOURNAVIGATION_URL, 'http://www.yournavigat
ion.org/api/1.0/gosmore.php');
$query_base = variable_get(OSM_ROUTE_YOURNAVIGATION_QUERY_TEMPLATE, '?format=g
eojson&flat=%s&flon=%s&tlat=%s&tlon=%s&v=%s&fast=1&layer=mapnik&instructions=1&l
ang=en_GB');
admin/config/services/osm_route: The select fields: Georeferenced
content field, Coordinates field, Name of the field where to save the
calculated path appears empty.
Comment #33
davidam CreditAttribution: davidam commentedComment #34
artsakenos CreditAttribution: artsakenos commentedHi davidam, thanks for your review.
> Why do you think that is better create a new project than improve routeplanner?
Because the purpose of the routeplanner module is different. It aims to provide directions to a fixed point of interest. Also, OSM Route provides multi-path directions, multi-segment descriptions. Of course the target of route planner could change in the next years, before this module will be accepted as a contribution. Please read the project description.
> Why are you using get_t instead of t?
Please read https://api.drupal.org/api/drupal/includes%21bootstrap.inc/function/get_t/7
> admin/config/services/osm_route: The select fields: Georeferenced content field, Coordinates field, Name of the field where to save the calculated path appears empty.
Yes, you need to set them during the configuration process. Please read the project home page or the
README.txt
.Again, I'm aware of the bonus procedure, but good reviews deserve some time. Please next pareview bonus hunters don't put the need work flag if there are non blocking issues. Following rules, I need to remove the critical priority.
Also note that the module stood in RTBC for 4 months with no understaken actions, subsequently I heavily changed the core due to its natural evolution, but after then, all the new issues have been addressed.
Thank you for your comments.
Comment #35
mpdonadio@artsakenos, this application doesn't currently have a review bonus. If you can get one, the process will go quicker.
Comment #36
tormiIMHO its ready to fly.
Comment #37
artsakenos CreditAttribution: artsakenos commentedThank you Tormi.
Here we are, as can be seen in the issue summary I reviewed some more modules, so I'm adding again the Review Bonus flag, exactly one year later. Hope this can add some fuel to the truck.
Thanks to everybody who contributed with reviews, private messages, and comments to my blog to make this module great!
Comment #38
klausiReview of the 7.x-1.x branch (commit 6a05da0):
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.
manual review:
Comment #39
artsakenos CreditAttribution: artsakenos commentedDear Klausi, thank you for the many useful suggestions,
I fixed all the issues you noticed and I took advantage of them to perform some more code cleaning.
☑ Fixed the white spaces issue. (.#32) Now code has no white spaces error and pareview page has been refreshed.
☑ Added the information also in the Project Page.
☑ Fixed according to your suggestion.
☑ Removed from everywhere this (personal) convention that distinguishes the coming block of code from an actual state (///-}).
☑ I now exploited load_multiple, which made code cleaner and helps in performance,
☑ Completely agree. Important. Fixed.
☑ Thanks for let me know this function. Last time I made some research and I thought that to be a good solution, but in fact it was not.
Minor fixes to the issue summary. git#ccd67e1.
Thanks.
Comment #40
klausimanual review:
But otherwise looks good to me now.
Assigning to er.pushpinderrana as he might have time to take a final look at this.
Comment #41
er.pushpinderrana CreditAttribution: er.pushpinderrana commentedAutomated Review
Best practice issues identified by pareview.sh / drupalcs / coder. None
Review of the 7.x-1.x branch (commit ccd67e1):
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.
Manual Review
Most of the points are already covered and nothing major jumped out at me when I read `git diff ccd67e1..` so...
Thanks for your contribution, Addis!
I updated your account so you can promote this to a full project and also create new projects as either a sandbox or a "full" project.
Here are some recommended readings to help with excellent maintainership:
You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!
Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
Thanks to the dedicated reviewer(s) as well.