Skip to content

Commit

Permalink
Convert mph to kph
Browse files Browse the repository at this point in the history
  • Loading branch information
ansoncfit committed Sep 5, 2023
1 parent 7b0c986 commit 9d7594d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/com/conveyal/r5/shapefile/SpeedMatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

public class SpeedMatcher extends ShapefileMatcher {

static double KPH_PER_MPH = 1.609344;
public SpeedMatcher (StreetLayer streets) {
super(streets);
}
Expand All @@ -16,7 +17,7 @@ public SpeedMatcher (StreetLayer streets) {
@Override
void setEdgePair (SimpleFeature feature, int attributeIndex, EdgeStore.Edge edge) {
if (feature.getAttribute(attributeIndex) != null) {
double speedKph = ((Number) feature.getAttribute(attributeIndex)).doubleValue();
double speedKph = KPH_PER_MPH * ((Number) feature.getAttribute(attributeIndex)).doubleValue();
edge.setSpeedKph(speedKph);
edge.advance();
edge.setSpeedKph(speedKph);
Expand Down

0 comments on commit 9d7594d

Please sign in to comment.