Total miles in a city idea

Not sure if this has been mentioned or suggested before so apologies if it has.
I’m not sure if the databases used for these cities have the length of each road/street that is within that city.
It would be cool to finish a city and find out that all of the streets combined is say 52 miles or something like that.
Would also be neat as you’re keeping track of the streets that you’ve run in a town. The percentage complete can be misleading. For example I’m working on the town of Epping NH currently. 187 streets total, and I’m really dreading running route 125, a 5ish mile stretch of road that is super busy with traffic most hours of the day. Say I complete 186/187 streets in epping. City strides will say I’m 99.5% complete with the town when I really have a single very long road to run which is probably closer to 5% of the total mileage of roads in the town.

2 Likes

I also like this idea, but for a slightly different reason. I will sometimes have a lot of streets progressed but not completed, so it doesn’t factor into the % completed. So, if it would show percentage of miles ran for a city, then that would be easier to gauge how much more running it was going to take to complete.

5 Likes

I would love the number because I am fond of statistics and graphs: number of streets, nodes, kilometers (or miles if you live elswhere :slight_smile: )
Even buildings, canals, schools, churches, foodstores, dead ends etcetera would be fine :slight_smile:

3 Likes

Hi @beatlekevin87 check out this similar thread Nodes As Metric. I don’t believe that the data brought in from OSM includes distance. That would be an interesting addition to have though!

@rus.golden, using the nodes as a percentage of completeness would give a way more accurate indication of how much you’ve run in the city.

1 Like

Nodes would certainly be more accurate but it would also be pretty cool to see how many miles of roads any given city has and how much you ran so far. I was reading about Rickey Gates who ran all of San Francisco which is apparently 1100 miles. Obviously to do a city is probably going to take at least 20% more than that because of out and backs and such but just having the overall metric for the town gives a real sense of its size and the accomplishment.

1 Like

I like the idea, but I don’t know how accurate I can calculate this…

I think I’d have to write some code that goes street by street, calculating the distance between each Node & summing those up. Some troubles that would come up:

  • Some streets don’t have Nodes at the exact beginning and end, so I wouldn’t get their complete distance
  • Some streets don’t have Nodes evenly distributed, so curvy streets would get calculated incorrectly

Maybe it’s enough to report the total distance as “Roughly X miles/kilometers”?

2 Likes

@JamesChevalier would it be easier to start with a proxy for distance, which would just be node count?

Specific thread for this idea here:
Nodes Instead of Streets as Completeness Metric

1 Like

@davemorin: a street can be miles long, and have 2 nodes, at start and end. Another street kan be 200 meters, curved and have 10+ nodes. I think nodes count is not a good replacement for streets count or distance

3 Likes

@JamesChevalier: I don’t understand how a street/line doesn’t have an exact start and end? A line drawn in OSM always have a start and end. Can you give an example? I would have thought that getting distances between nodes of a line in OSM would give an fairly accurate overview of the street length, and added together for the nett distance in meters/miles you have to run in a city.

I definitely see it will be an approximation, but would still be fun to see. Another issue will be large roads that have nodes/lines on each side of the street. But, for those roads, we should probably run both sides anyway :slight_smile:

1 Like

I am not saying it wouldn’t be fun, but this is super-low priority in my mind.

I would be a negative vote if such a thing existed as I’d rather see other things like automatic OSM updates, Challenges, and a few others get the development time before this.

2 Likes

As noted in other posts, you just have to add up the aggregate distance between nodes. Obviously, keeping the segments separate where streets are disjoint (extreme example: Cape Coral, Florida, USA). If you’ve run both endpoints of a line segment, the distance “counts” towards the distance run on that street. The fact that OSM may not be accurate in some cases is not a good argument against doing this. Eventually OSM will get updated and this “update city data” code that you’re writing someday in theory will update the street distances.

1 Like

So it looks like the Overpass API introduced a “length()” operator in v0.7.55: Overpass API/Overpass QL - OpenStreetMap Wiki

I tried this in Overpass Turbo:

way(id:231833288);
make stat length=sum(length());
out;

Which results in:

  <stat id="1">
    <tag k="length" v="639.163"/>
  </stat>

The way on OSM: Way: ‪Muinkkaai‬ (‪231833288‬) | OpenStreetMap
The street on CS: Muinkkaai - CityStrides

Measuring this street in Google Maps: Total distance: 696.53 m (2,285.19 ft)

3 Likes

I wonder if that can be included in the Street Query I’m using… Otherwise, I’d have to run that length query against each individual street :flushed:

1 Like

Would that also help in identifying duplicate streets? If you had two streets with the same name and same non-zero distance…just a random thought. Would definitely be exciting to incorporate distance measurements in various aspects of the site.

1 Like

If I understand what you’re referring to…
That issue isn’t that the streets are duplicate, it’s that there are encompassing cities that exist. So the streets in smaller-city-A also exist in larger-city-B.
If I de-duplicated those streets by removing the streets from smaller-city-A then that city would have no streets & if I de-duplicated them by removing them from larger-city-B then that city wouldn’t have a complete list of all the streets it contains.

I’m not saying they shouldn’t exist in any capacity, but they seem to count double (or triple or quadruple) in challenges, leaderboards and I assume my total road count. It sort of makes those numbers largely meaningless if in some places you run a road and it counts 4 times.
I assume as it stands you have multiple “Street A”'s that are really the same street but with different street_ids instead of just one “Street A” that you associate to multiple towns with some sort of completed flag. Anyways I have no idea how your database is setup (just a guess) and I’m sure you’re better at it than me, but basically contrasting the two setups below. Both setups allow for “Street A” to belong to more than one city but one setup doesn’t duplicate roads.

Do you actually know what smaller cities exist in larger cities? Is that relationship stored or easily figured out? I would assume that would let you dedupe, but if not then something like street length might assist

streets
street_name, street_id, completed
“Street A”, 1, false

cities
city_name, city_id
“City A”, 1
“City B”, 2
“City B”, 3

city_streets
city_id, street_id
1, 1
2, 1
3, 1


streets
street_name, street_id, completed
“Street A”, 1, false
“Street A”, 2, false
“Street A”, 3, false

cities
city_name, city_id
“City A”, 1
“City B”, 2
“City B”, 3

city_streets
city_id, street_id
1, 1
2, 2
3, 3

Yeah, that seems to be possible, adapted from your Street Query: overpass turbo
In this small town: Bas Pennewaert is running Cadix, Occitanie - CityStrides

"number": "3",
"length": "2903.196"

Which seems correct, 2 roads and a bridge with a total length of 2.9 km.

To get each street length, you could use something like this: overpass turbo

1 Like

I think the problem of duplicate streets comes from having “cities” that overlap geographically, so that one real street is present in both City A and City B. If you run the street it will count as +1 in City A and in City B. For example, Albany St. in Manhattan will count in Manhattan and in Manhattan Community Board 1.

1 Like

I think in that case maybe it makes sense to duplicate the road in some fashion. That would definitely be a tricky situation. I’m not sure about other places but at least here this is a smaller percentage of cases. Those border roads are usually not more than a half dozen or so per town and sometimes it makes me run the whole road past the town to get it and sometimes not.

One possible solution (Guessing at db table design) but you could put the “complete” flag on city_streets relationship table which would denote the road being done for a specific city and then another flag on the streets table to denote complete for all cities. I’m sure James data and design is much more complex than my simplistic thoughts here but having a solution to duplicates would certainly bolster several of the existing features which are really muddied by it. Also apologies for muddying this thread, I’m sure there is a duplicates thread somewhere.

1 Like