-
Notifications
You must be signed in to change notification settings - Fork 74
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
Check population density around stops #870
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
src/main/java/com/conveyal/gtfs/error/SuspectStopLocationError.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.conveyal.gtfs.error; | ||
|
||
import com.conveyal.gtfs.validator.model.Priority; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* Indicates that a stop is in a suspect location, for example in a place like a desert where there are not enough | ||
* people to support public transit. This can be the result of incorrect coordinate transforms into WGS84. | ||
* Stops are often located on "null island" at (0,0). This can also happen in other coordinate systems before they | ||
* are transformed to WGS84: the origin of a common French coordinate system is in the Sahara. | ||
*/ | ||
public class SuspectStopLocationError extends GTFSError implements Serializable { | ||
public static final long serialVersionUID = 1L; | ||
|
||
public SuspectStopLocationError(String stopId, long line) { | ||
super("stops", line, "stop_id", stopId); | ||
} | ||
|
||
@Override public String getMessage() { | ||
return String.format( | ||
"Stop with ID %s is in a sparsely populated area (fewer than 5 inhabitants per square km in any " + | ||
"neighboring 1/4 degree cell)", | ||
affectedEntityId | ||
); | ||
} | ||
|
||
@Override public Priority getPriority() { | ||
return Priority.MEDIUM; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 population grid loaded and used anywhere else? I'm wondering if we should be concerned about resource management or additional time delays here.
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.
No, it was only used by a GTFS validator that was not included in r5 when we moved the gtfs-lib code in, so is not currently used elsewhere. This is a 4.3 kb text file containing ones and zeros which gets loaded into a BitSet, so should amount to a few hundred bytes in memory. There would be some cost of reading that file and creating that object, but this is in the context of loading and validating GTFS which involves loading large volumes of numbers from text files into a database. So I'd say it's a one-off cost per feed that's a similar action to what GTFS ingestion already requires, but several orders of magnitude smaller. In principle a single instance of the grid could be cached, but at a few hundred bytes it's so tiny that I don't think it will have any impact.