-
Notifications
You must be signed in to change notification settings - Fork 107
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
New strategy : Retain up from polygon #310
New strategy : Retain up from polygon #310
Conversation
Ready for review We will add a full exemple of the config used at Tisséo with the next (and last) PR |
@@ -270,6 +271,26 @@ You can remove a specific entity from a feed. | |||
|
|||
Note that removing an entity has a cascading effect. If you remove a trip, all the stop times that depend on that | |||
trip will also be removed. If you remove a route, all the trips and stop times for that route will be removed. | |||
|
|||
#### Retain Up From Polygon |
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.
I must admit that I find the terminology of "retaining up" and "retaining down" confusing. What do you mean by that?
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.
We did'nt found a better term. This one is direct from the existing retain algotithm that seems very stable.
"Up" means that the algorithm will traverse up the entity dependency tree by applying retainUp to each of them. Starting from the stop, retainUp will be applied to the stop_times referencing this stop, then to the trips, and so on.
Then, when the base of the tree is reached, it applies retainDown to all the traversed entities. Therefore, all the trips of the route and then all the stop_times of each trip will be tagged as "retain".
Entities not marked as "retain" will be deleted.
The goal of the strategy is to retain all entities that are directly or indirectly linked to the area.
We will add this brief explanation to the documentation.
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.
okay, that's fine.
|
||
@Override | ||
public void run(TransformContext transformContext, GtfsMutableRelationalDao gtfsMutableRelationalDao) { | ||
Geometry geometry = buildPolygon(polygon); |
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.
Move this into the setter and check if it's valid and non-empty there. Throw an exception immediately if it isn't.
String message = String.format("Error parsing WKT string : %s", e.getMessage()); | ||
log.error(message); | ||
return null; |
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.
Don't cover up a bad input string and re-throw as a RuntimeException. The program should fail as soon as possible.
* @return true if the point is within the boundaries of the geometry; false otherwise. | ||
*/ | ||
private boolean insidePolygon(Geometry geometry, double lon, double lat) { | ||
GeometryFactory geometryFactory = new GeometryFactory(); |
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.
I wil merge this in and then make this an instance of the class instead.
I will merge this and make a few small changes. |
Update documentation and code (exception handling has been fixed) |
Summary:
Solve Issue #237 : Add RetainUpFromPolygon strategy