a-b-street / abstreet

Transportation planning and traffic simulation software for creating cities friendlier to walking, biking, and public transit
https://a-b-street.github.io/docs/
Apache License 2.0
7.66k stars 340 forks source link

Import Salzburg #366

Open natrius opened 3 years ago

natrius commented 3 years ago

Hey, I found https://github.com/dabreegster/abstreet/issues/119 this issue and its quite long so i wanted to ask in general if there is a checklist of howto or what to do to import a new map. I'm interested in Salzburg, for example, its not that big but it should be really good mapped because there are a lot of mappers around (including me). So it may be a good example as well?

What additional information would be needed?

dabreegster commented 3 years ago

Hi! https://dabreegster.github.io/abstreet/howto/new_city.html has the instructions. If you're just trying things out, the one-shot command should be fine. If you'd like to collaborate more and get Salzburg running well in A/B Street, then it'd be easier to add it as a supported city, so we can iterate on it more quickly.

If you have trouble running the one-shot commands, let me know and I can do it. The most useful input to start is a bounding polygon for the area you're interested in. You can get a sense from the existing maps in the game about how big this should be; maybe it's the entire area, or maybe it's better to divide into a few pieces (which can overlap).

natrius commented 3 years ago

So, i was partly succesfull. I downloaded a small part via osm.org and then mistakenly opened the .osm file with JOSM. Decided to download via JOSM the rest but it seems the rest is just blacked out with some buildings in there. I guess the JOSM files differ from the direct export somehow?

grafik

Starting File (change from txt to osm) map.txt

File with additional data via JOSM cannot be uploaded because its above 28MB but the only difference i can see is export via page is like <member type="way" ref="102141199" role=""/> and JOSM is <member type='way' ref='102141199' role='' />

Another thing: Via JOSM it would be possible to reduce the downloaded data with an Overpass, if you can tell what is definitely not needed it could be excluded when downloading. Or mention that JOSM is not suited for providing data for the game.

Whatever, Downloaded via https://download.bbbike.org/ Salzburg and imported it with the importer.exe --oneshot=Salzburg.osm and it needed quite much more time than my failed JOSM approach. But it seemed the are covered by this download is basically huge (the map file is now 394MB) and i will try to make it way smaller.

Another thing i noticed right now - my wrong import hat some driving buses around, the bbbox download not - is it possible theree are some routes missing - or how can i find out more about this?

EDIT:

Made a Polygon with bbbike and its now working fine, size about 47MB and loding fast enough. What information is now needed to populate the city? Guess i will look into the permanent take at home.

dabreegster commented 3 years ago

Decided to download via JOSM the rest but it seems the rest is just blacked out with some buildings in there

When you omit --oneshot_clip, then the map boundary is taken from the <bounds minlat="..." ..../> tag in the file. My guess is that JOSM doesn't update this properly when you tell it to download a new area with an existing file. Anything outside the boundary gets clipped out, except parking lots.

Via JOSM it would be possible to reduce the downloaded data with an Overpass, if you can tell what is definitely not needed it could be excluded when downloading.

That is a possibility, but I'm not sure the complexity is worth it. What A/B Street will extract from the .osm could change over time. The main thing that increases .osm file size and isn't needed are the version, timestamp, changeset, author metadata on all of the objects. I think I've seen some OSM tools that support filtering that out.

it needed quite much more time than my failed JOSM approach

Yup, large areas take longer to import. It's not documented yet, but you can also pass --skip_ch to avoid an expensive importing step that builds contraction hierarchies, which speed up route-finding later.

my wrong import hat some driving buses around, the bbbox download not

Extracting the bus routes and building the paths for them is actually broken right now; I need to finish #190 still. A few routes might get imported, but it doesn't have much to do with your choice of .osm extract.

What information is now needed to populate the city?

The most interesting information would be a travel demand model, which tells you how many people travel between different buildings (or parcels of land, or small regions -- depending on the agency producing the model), when they leave, how likely they are to drive vs bike vs walk vs take transit. It's been quite hard to find public data for this. An intermediate that would help is some sort of census, showing how many people live in different chunks of the city, and ideally some attributes about how many of them own cars, take transit, etc. Even without any of this, you can still start traffic on the map by changing the "Traffic" dialog at the top to "trips from home to work" -- this will just infer residences vs businesses from OSM tags.

One way to use A/B Street to find things to map is by looking for street parking. A few roads are tagged (this is from the parking layer, press l and then p): Screenshot from 2020-10-15 09-42-12 https://dabreegster.github.io/abstreet/howto/map_parking.html has some info on this.

I imported the entire bbike area and glanced at it. Two things jump out that're bugs in A/B Street I could work on:

1) Kapuzinerberg and other large parks aren't being picked up. Looks like https://github.com/dabreegster/abstreet/blob/1e0d8536a4cc51a363c068dd1f8f4a3971097426/convert_osm/src/extract.rs#L522 should map landuse=forest to AreaType::Park, just to render it green.

2) Residenzplatz uses pedestrian areas. A/B Street doesn't support these yet, sadly. So you'll probably notice all of the buildings have driveways/paths connecting to the nearest road, and that the paths just cut right through other buildings.

I can fix 1) later this week. Next steps depend on your goals. Are you looking to use A/B Street as Q/A testing to find parts of Salzburg that have lanes, street parking, turn restrictions, etc mis-tagged? Are you interested in exploring some proposal to pedestrianize some roads or make new bus-only lanes or something like that?

dabreegster commented 3 years ago

Closing this issue for now, because I don't think there's anything left to do. Feel free to reopen if you have some more steps in mind!

natrius commented 3 years ago

What information is now needed to populate the city?

The most interesting information would be a travel demand model, which tells you how many people travel between different buildings (or parcels of land, or small regions -- depending on the agency producing the model), when they leave, how likely they are to drive vs bike vs walk vs take transit. It's been quite hard to find public data for this.

Can you give me a hint on what to search for? I found https://www.researchgate.net/publication/326175780_Travel_Demand_Modelling_of_Touristic_Trips_in_the_Province_of_Salzburg this but this is for the surrounding and not for the city itself. It seems like something like this will be provided via https://www.bmk.gv.at/themen/verkehrsplanung/verkehrsmodell.html but that would need some more time.

An intermediate that would help is some sort of census, showing how many people live in different chunks of the city, and ideally some attributes about how many of them own cars, take transit, etc. Even without any of this, you can still start traffic on the map by changing the "Traffic" dialog at the top to "trips from home to work" -- this will just infer residences vs businesses from OSM tags.

At least the first part is possible via https://www.stadt-salzburg.at/statistik-bevoelkerung/ and "Bevölkerung nach Statistischen Zählbezirken" - https://www.stadt-salzburg.at/fileadmin/landingpages/statistik/einwohner/2020_bevoelkerung_nach_zaehlbezirken.pdf but how do i need to provide this information to abstreet? I may even ask the officials for it.

If i can acquire at least the how many use transit, cars, bike and so on, would it be possible to get Salzburg into abstreet or just if somewhat accurate travel demand data is available?

dabreegster commented 3 years ago

Can you give me a hint on what to search for?

I've only managed to find public data in Seattle, so I'm not sure what to search for. "Travel demand model", "origin/destination table", and "activity model" are some terms.

this but this is for the surrounding and not for the city itself

If I understood the abstract, " This paper covers the integration of tourists in an already existing macroscopic transport model of Salzburg." maybe suggests there's already a model of the city itself. If you can get in touch with the authors, they might be able to help.

but how do i need to provide this information to abstreet?

There's no standard format yet. We started something similar for Berlin -- see https://github.com/dabreegster/abstreet/blob/master/importer/src/berlin.rs. There's one file with a boundary polygon for each planning region, and another CSV file that describes number of people per region, and some code to randomly distribute N people over however many buildings happen to be in that polygon. I haven't run the table PDF through a translator yet, but I'm guessing things like 24 -Äußeres Nonntal / Freisaal are areas. Do these have polygons to bound them?

If i can acquire at least the how many use transit, cars, bike and so on, would it be possible to get Salzburg into abstreet or just if somewhat accurate travel demand data is available?

It recently got a little easier for me to manage more cities in abst, so we could add it in now, and I can maintain the map as the binary format changes. We can keep working on finding input for the travel demand model. How about to start, could you send a geojson.io polygon, or maybe even a few covering different parts of the city? Chopping it up is useful for smaller file sizes. I chopped up Paris arbitrarilyish like this, for example: Screenshot from 2020-11-26 00-41-51

natrius commented 3 years ago

I haven't run the table PDF through a translator yet, but I'm guessing things like 24 -Äußeres Nonntal / Freisaal are areas. Do these have polygons to bound them?

Yes, you are correct, these are areas. There is Nonntal for example https://www.openstreetmap.org/relation/7489976 Guess thats what you mean? I can gather it together so it all fits the polygon.

It recently got a little easier for me to manage more cities in abst, so we could add it in now, and I can maintain the map as the binary format changes.

That would be awesome

We can keep working on finding input for the travel demand model. How about to start, could you send a geojson.io polygon, or maybe even a few covering different parts of the city? Chopping it up is useful for smaller file sizes.

Will do and look it up for you. And yes, i will chop it up, its pretty easy for salzburg as there is the river, the Autobahn and the border to chop it up nicely. Not much entry-points as well. Tell me if this works or if it should overlap more

yellow - North Salzburg green - East Salzburg teal - South Salzburg purple - West Salzburg

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {
        "stroke": "#555555",
        "stroke-width": 2,
        "stroke-opacity": 1,
        "fill": "#ffff80",
        "fill-opacity": 0.5
      },
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              13.02952766418457,
              47.82923348731677
            ],
            [
              13.035364151000977,
              47.81891816173151
            ],
            [
              13.036651611328125,
              47.81050302635426
            ],
            [
              13.036479949951172,
              47.80779375424168
            ],
            [
              13.038883209228514,
              47.80358545562179
            ],
            [
              13.043603897094727,
              47.80099112906964
            ],
            [
              13.0642032623291,
              47.80779375424168
            ],
            [
              13.07192802429199,
              47.81672805230014
            ],
            [
              13.072786331176758,
              47.819148694192286
            ],
            [
              13.059568405151367,
              47.83211449691779
            ],
            [
              13.038454055786133,
              47.830904492365704
            ],
            [
              13.02952766418457,
              47.82923348731677
            ]
          ]
        ]
      }
    },
    {
      "type": "Feature",
      "properties": {
        "stroke": "#555555",
        "stroke-width": 2,
        "stroke-opacity": 1,
        "fill": "#80ff80",
        "fill-opacity": 0.5
      },
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              13.045148849487305,
              47.800702862566204
            ],
            [
              13.053388595581055,
              47.79839667295524
            ],
            [
              13.061628341674805,
              47.794245273679884
            ],
            [
              13.07046890258789,
              47.79666696356607
            ],
            [
              13.081712722778319,
              47.80052990189636
            ],
            [
              13.08222770690918,
              47.81482604021226
            ],
            [
              13.068580627441406,
              47.8142496591576
            ],
            [
              13.042402267456055,
              47.80179826676978
            ],
            [
              13.045148849487305,
              47.800702862566204
            ]
          ]
        ]
      }
    },
    {
      "type": "Feature",
      "properties": {
        "stroke": "#555555",
        "stroke-width": 2,
        "stroke-opacity": 1,
        "fill": "#80ffff",
        "fill-opacity": 0.5
      },
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              13.036994934082031,
              47.80289364787613
            ],
            [
              13.029356002807617,
              47.80127939397355
            ],
            [
              13.020172119140625,
              47.77475232696755
            ],
            [
              13.041114807128906,
              47.77261803978678
            ],
            [
              13.044204711914062,
              47.77411781830723
            ],
            [
              13.060083389282227,
              47.775732916031856
            ],
            [
              13.075790405273438,
              47.77752100142527
            ],
            [
              13.075962066650389,
              47.78219280527603
            ],
            [
              13.074760437011719,
              47.785364778461314
            ],
            [
              13.067636489868164,
              47.79084318534558
            ],
            [
              13.056328296661377,
              47.79705615319922
            ],
            [
              13.052723407745361,
              47.798771435733016
            ],
            [
              13.043968677520752,
              47.801019955632015
            ],
            [
              13.040385246276855,
              47.80257656624696
            ],
            [
              13.036994934082031,
              47.80289364787613
            ]
          ]
        ]
      }
    },
    {
      "type": "Feature",
      "properties": {
        "stroke": "#555555",
        "stroke-width": 2,
        "stroke-opacity": 1,
        "fill": "#ff80ff",
        "fill-opacity": 0.5
      },
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              13.002233505249023,
              47.85360178173402
            ],
            [
              13.001375198364258,
              47.84156308579322
            ],
            [
              12.989187240600584,
              47.83355494174212
            ],
            [
              12.983779907226562,
              47.828714888603244
            ],
            [
              12.972965240478516,
              47.8116558652381
            ],
            [
              12.96180725097656,
              47.79839667295524
            ],
            [
              12.95107841491699,
              47.791592817160414
            ],
            [
              12.948246002197264,
              47.78709486407255
            ],
            [
              12.943696975708008,
              47.78697952682338
            ],
            [
              12.938375473022461,
              47.784269027789286
            ],
            [
              12.93966293334961,
              47.78075093529741
            ],
            [
              12.938804626464844,
              47.77809779004784
            ],
            [
              12.934856414794922,
              47.77665580649395
            ],
            [
              12.929878234863281,
              47.77382940272034
            ],
            [
              12.926273345947266,
              47.76725309331018
            ],
            [
              12.928504943847656,
              47.76529157687734
            ],
            [
              12.967815399169922,
              47.76736847432615
            ],
            [
              12.990045547485352,
              47.775444509403115
            ],
            [
              13.020343780517576,
              47.77342561821119
            ],
            [
              13.022918701171875,
              47.776482765780024
            ],
            [
              13.03105115890503,
              47.800601968912105
            ],
            [
              13.04051399230957,
              47.80207211421171
            ],
            [
              13.037552833557129,
              47.805559939554506
            ],
            [
              13.036072254180908,
              47.808629608585626
            ],
            [
              13.03675889968872,
              47.81426406876196
            ],
            [
              13.035686016082764,
              47.81888934510192
            ],
            [
              13.029892444610596,
              47.829060621654705
            ],
            [
              13.002233505249023,
              47.85360178173402
            ]
          ]
        ]
      }
    }
  ]
}
dabreegster commented 3 years ago

Thanks for the boundaries; they work great! If you're running from git and pull the latest commit, you can use the "load map" control in the game, go to "download more cities", and bring in Salzburg.

@michaelkirk and I are in the process of generalizing the traffic demand generation in #424. The tables you found can ultimately get turned into CensusAreas and plugged into this new approach. It might be a few more days or weeks of churn to get the new approach working. In the meantime, you can use the "home to work" pattern to try things out.

natrius commented 3 years ago

Ah, i'll just wait for the next update :)

So, now i will try to get information about the travel demand data and i will wait for your information on how i can(or should) input the data about how much people live in what district in Salzburg. (and later the travel-demand-model)