Discussing 'nested' cities

There’s been an ongoing issue where it appears as though streets are being counted as completed twice. There’s this thread with some conversation on the topic: Fixing street double count

I approached this by:

  • Adding the ability to mark a city as “nested”
  • Adding the ability to relate a nested city to its parent city (a link to the parent city is displayed on nested city pages)
  • Not including nested cities when doing street counts
  • Not including nested cities in the Challenge calculations (unless the Challenge happens to be on a nested city)

I’m currently running some code that finds/marks these nested cities. It seems to be running quickly.

While I was working on this, I noticed some cities that are kind of nested. Which… :roll_eyes: Of course… Right? :sweat_smile:
One example is the southern area of Pomona https://citystrides.com/cities/327 which sticks out of the border of Town of Haverstraw https://citystrides.com/cities/1333
Gotta figure out what to do with those.

1 Like

Very cool! I’ll get started with my new home base of Lisboa, Portugal. There are a lot of neighborhoods that are subsections and the roads here double- or even multi-count: for example, Rua Ramalho Ortigão (22 nodes) = this (13 nodes) + this (9 nodes), and counts as 3 individual streets.

The following “cities” (really, neighborhoods) should be nested in Lisboa:


São Domingos de Benfica


Avenidas Novas




Santa Maria Maior




Santo António


The following “cities” should be nested in Amadora, which isn’t in the cities list for the Lisboa region…a separate problem that I only realized when assembling this list.

Águas Livres

Falagueira-Venda Nova


Encosta do Sol

There are a bunch of other neighborhoods in Lisboa and Amadora that I haven’t run yet, but since I’m the first to respond I don’t know if this is overkill or if you can extract the other neighborhoods/sub-sections once you have the city link. Hope this helps and thanks as always for your constant improvements to a great platform.

1 Like

Awesome, not sure if I made this clear already, I’ll leave it here anyway so you have it all in one place. All the cities in the missing cities spreadsheet under Region: Oslo, should be nested under Oslo when added :slight_smile:

1 Like

For Cardiff, UK we have;

Parent city: https://citystrides.com/cities/171366
Nested city: https://citystrides.com/cities/130572
Nested city: https://citystrides.com/cities/130568
Nested city: https://citystrides.com/cities/130569
Nested city: https://citystrides.com/cities/130566
Nested city: https://citystrides.com/cities/130556
Nested city: https://citystrides.com/cities/130559
Nested city: https://citystrides.com/cities/130554
Nested city: https://citystrides.com/cities/130551
Nested city: https://citystrides.com/cities/130555
Nested city: https://citystrides.com/cities/130549
Nested city: https://citystrides.com/cities/130547
Nested city: https://citystrides.com/cities/130565
Nested city: https://citystrides.com/cities/130541
Nested city: https://citystrides.com/cities/130578
Nested city: https://citystrides.com/cities/130573
Nested city: https://citystrides.com/cities/130574
Nested city: https://citystrides.com/cities/130575
Nested city: https://citystrides.com/cities/130546
Nested city: https://citystrides.com/cities/130544
Nested city: https://citystrides.com/cities/130553
Nested city: https://citystrides.com/cities/130570
Nested city: https://citystrides.com/cities/130552
Nested city: https://citystrides.com/cities/130576
Nested city: https://citystrides.com/cities/130577
Nested city: https://citystrides.com/cities/130563
Nested city: https://citystrides.com/cities/130550
Nested city: https://citystrides.com/cities/130545
Nested city: https://citystrides.com/cities/130564
Nested city: https://citystrides.com/cities/130548
Nested city: https://citystrides.com/cities/130542
Nested city: https://citystrides.com/cities/130561
Nested city: https://citystrides.com/cities/130562
Nested city: https://citystrides.com/cities/130560

(Think that is all of them)

1 Like

This seems like a silly thing to ask humans to do. Surely a computer can figure out which polygons are inside which other polygons.

You’re making some assumptions on a number of things, but the point of at least trying to do this programmatically is a good idea.

1 Like

Parent City:
https://citystrides.com/cities/171362 Edinburgh (City of Edinburgh Council Unitary Authority)

Nested Cities: (Community Council Areas in OSM : 29 of 46)
https://citystrides.com/cities/130411 Balerno
https://citystrides.com/cities/130378 Craigentinny/Meadowbank
https://citystrides.com/cities/130383 Craigmillar
https://citystrides.com/cities/130412 Currie
https://citystrides.com/cities/130377 Drylaw/Telford
https://citystrides.com/cities/130392 Gilmerton/Inch
https://citystrides.com/cities/130395 Gorgie/Dalry
https://citystrides.com/cities/130371 Granton and District
https://citystrides.com/cities/130397 Hutchison/Chesser
https://citystrides.com/cities/130403 Juniper Green
https://citystrides.com/cities/130358 Leith Central
https://citystrides.com/cities/130361 Leith Harbour & Newhaven
https://citystrides.com/cities/130364 Leith Links
https://citystrides.com/cities/130408 Liberton and District
https://citystrides.com/cities/130400 Longstone
https://citystrides.com/cities/130375 Muirhouse/Salvesen
https://citystrides.com/cities/130380 New Town/Broughton
https://citystrides.com/cities/130391 Northfield/Willowbrae
https://citystrides.com/cities/130381 Old Town
https://citystrides.com/cities/130379 Portobello
https://citystrides.com/cities/130402 Sighthill, Broomhouse and Parkhead
https://citystrides.com/cities/130389 Southside
https://citystrides.com/cities/130399 Stenhouse, Saughton Mains and Whitson
https://citystrides.com/cities/130369 Stockbridge/Inverleith
https://citystrides.com/cities/130388 Tollcross
https://citystrides.com/cities/130366 Trinity
https://citystrides.com/cities/130393 West End
https://citystrides.com/cities/130396 Wester Hailes
https://citystrides.com/cities/130373 West Pilton/West Granton

Community Council Areas missing from OSM (17 of 46):
Cramond and Barnton
Drum Brae
Marchmont & Sciennes
Ratho and District
Queensferry and District


While Aberdeen, Scotland doesn’t have a boundary line in CS, the following all fall within the city I believe:

Parent City:
https://citystrides.com/cities/171360 Aberdeen (no boundary line)

Nested cities:
https://citystrides.com/cities/130415 Bridge of Don
https://citystrides.com/cities/130450 Castlehill and Pittodrie
https://citystrides.com/cities/130454 Cove and Altens
https://citystrides.com/cities/130469 Froghall, Powis and Sunnybank
https://citystrides.com/cities/130458 George Street
https://citystrides.com/cities/130416 Old Aberdeen
https://citystrides.com/cities/130452 Seaton, Linksfield and Pittodrie
https://citystrides.com/cities/130471 Tillydrone
https://citystrides.com/cities/130446 Torry


Thanks, I fixed that border.

1 Like

Thanks, that now shows that the 9 nested cities only cover about a third of the parent city. Similar to Edinburgh.

This is awesome! Thanks for doing this. I’m curious if there’s a way now to create new nested cities so that gigantic areas (like Queens or Brooklyn) can be broken up into more bite sized chunks.

It depends on what data is present in OSM. For example, there’s Manhattan https://citystrides.com/cities/171333 (admin level 7) and then there’s also its Community Boards e.g. https://citystrides.com/cities/1601 (admin level 8).
Queens exists at admin level 7 https://www.openstreetmap.org/relation/9691819 but I haven’t been able to find any admin levels below that within Queens…

Wish this could be done for Boston too. I would have been much more interested in trying to finish Allston or Jamaica Plain if that were the case.


First you’d have to figure out where those boundaries even are! https://www.universalhub.com/2019/impossibility-mapping-boston-neighborhood-lines

1 Like

A post was split to a new topic: How to add admin level data to OSM?

So what do you see this as the scope of this? Limited to fixing double street counts, or can it be expanded to split big cities into smaller chunks or combine small villages into bigger targets?

All of the city border data comes from OpenStreetMap. If sub-sections of a city exist in there, I can import those into CityStrides as nested cities.
I’ve done that for a number of larger cities & I’m happy to add more.

One thing I’ve noticed is some roads in “nested cities” that are in the nested city but not the larger city don’t count at all. I don’t know why, I haven’t investigated in OSM, but for instance in my recent activity (https://citystrides.com/activities/14334438) there are 15 unique street names in my completed list, but it only says 9 completed (the 9 that would previously have double-counted). Before Benfica was nested in Lisboa, this run would have shown 24 completed streets (9 x 2 + 6) but the solution to that problem now under-counts the streets I did complete :confounded:

I’ve been trying to figure out Aberdeen, actually. The smaller nested cities has been helpful to me since I live in the midst of all those, but it’s clearly a broken system. I covered a road last week (Prospect Terrace) which has the same name as a road in Dyce. OSM/CS seems to treat them as the same road, given that Dyce is part of Aberdeen (despite being significantly far apart). I wonder if mapping Dyce as a separate, nested boundary would help sort problems like that out?

I also couldn’t figure out why “Castlehill and Pittodrie” or “Froghall, Powis and Sunnybank” are a separate area of the city while Cults, Dyce, Bieldside, Kincorth, etc. aren’t. To my knowledge, these aren’t historically separate towns which merged (unlike Torry, Old Aberdeen, and Bridge of Don, but are somewhat random groupings. They don’t seem to follow any specific metrics for being bound - any insights as to what sets them apart?

I think the boundaries for the nested ‘cities’ in OSM for Aberdeen are, like Edinburgh, for community councils, but I think it may be a work in progress and not all of the Aberdeen community council areas have been added to OSM yet. Here’s the full list: https://www.aberdeencity.gov.uk/services/council-and-democracy/community-councils

Hope that helps.

1 Like