Skip to content
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

Find stops that appear to be misplaced #14

Open
mattwigway opened this issue Oct 30, 2014 · 5 comments
Open

Find stops that appear to be misplaced #14

mattwigway opened this issue Oct 30, 2014 · 5 comments
Assignees

Comments

@mattwigway
Copy link
Contributor

We want to find stops that are a long way away from the nearest stop. A good way to do this would be to compute the G function of all the stops and then see if this stop lies far from the distribution.

This seems like it would be slow, but this takes an imperceptible amount of time using one core of my machine, computing the G function for 14,000 randomly distributed stops (which is about how many there are in Chicago, the largest GTFS feed I know of).

library(spatstat)

# generate some random points
x <- runif(14000)
y <- runif(14000)

the.pp <- ppp(x, y)

est <- Gest(the.pp)

plot(est)
@mattwigway
Copy link
Contributor Author

Also, we don't have to do coordinate transforms; we can just multiply all of the longitudes by (radius of earth at equator)/(length of chord at agency latitude), and units will be invariant enough.

@mattwigway mattwigway self-assigned this Oct 30, 2014
@mattwigway
Copy link
Contributor Author

K-function might be better to find groups of misplaced stops.

@laidig
Copy link
Contributor

laidig commented May 2, 2016

How do you define misplaced?

  • likely to be out of order,
  • not near the shape,
  • or not near the others on the trip?

@mattwigway
Copy link
Contributor Author

I was thinking more of stops that are not near the rest of the stops in the entire feed, e.g. reversed lat/lon or at null island (0 lat 0 lon, due to math errors).

@laidig
Copy link
Contributor

laidig commented May 3, 2016

Using the number of stops in of a cluster or iterative k-means are good formulations.

If machine learning approaches seem a bit confusing, I have a suggestion: If you know the overall precision you want to target, use geohashes as a heuristic. If you spot something that does not have the same prefix, calculate the adjacent hashes and compare with those.

https://en.wikipedia.org/wiki/Geohash

This library has a method for calculating adjacent hashes.
https://github.com/davidmoten/geo

If you're interested in a test set, I have a copy of the Amtrak feed from 2013. I'm not able to think of a GTFS for a bigger region.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants