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.75k stars 345 forks source link

Estimate offstreet parking better #175

Open dabreegster opened 4 years ago

dabreegster commented 4 years ago

https://library.municode.com/wa/seattle/codes/municipal_code?nodeId=TIT23LAUSCO_SUBTITLE_IIILAUSRE_CH23.54QUDESTACOREPASOWAST

matkoniecz commented 4 years ago

Maybe boost number of spots for buildings with amenity=parking_entrance inside/on their outer way/very close? It indicates (likely unmapped) underground parking.

https://github.com/dabreegster/abstreet/issues/154#issuecomment-660726825

Happen to know if there are standards in Krakow for number of private parking spots for different types of houses, apartments, offices?

I can search for that. But even if there is this kind of car-promoting regulation then it is not applying retroactively to older buildings. And current city center map has mostly old or very old buildings.

n8bot commented 3 years ago

Would it be possible to provide the functionality to manually specify the number of private parking spots in a building?

I'm trying to create an approximation of downtown Vancouver, BC, but the parking numbers are just too far off to make any useful scenarios.

I think a huge step forward in this regard would be to allow the user to edit the number of private spots for a building in-game. It's not a perfect solution, but an easy first step.

dabreegster commented 3 years ago

The implementation would be fairly straightforward. The JSON map edits could have a new command to override the number of spots for a building.

What should the editing UI look like? Click a building to open the info panel, click a button to edit the number of spots? That seems like it would be extremely tedious to do manually. And hard to check your work and see which buildings are left to tag.

If Vancouver happens to have open data for this in the form of a shapefile, kml, geojson, etc, we can import it and snap to the nearest building.

n8bot commented 3 years ago

I just did a quick search for any easily-available public data on private parking, and I can't find anything. I guess it would certainly be tedious to manually enter all this information.

We need some way to be able to add parking spots manually. Whether in a building/underground, or simply surface lots that are not included in the OSM data.

matkoniecz commented 3 years ago

We need some way to be able to add parking spots manually (...) or simply surface lots that are not included in the OSM data.

at risk of stating obvious - this can be relatively easily mapped in OSM (though "relatively easily" applies to mapping individual ones, getting all in a big city will take a lot of effort)

dabreegster commented 3 years ago

Yeah, I would vote for contributing this data upstream to OSM instead of coming up with a new way of mapping it just for A/B Street. Is the issue that you would be making very rough estimates on the capacity and don't feel it's appropriate to tag those guesses?

The side-input used in Seattle comes from https://data-seattlecitygis.opendata.arcgis.com/datasets/public-garages-or-parking-lots/explore?location=47.625550%2C-122.335750%2C12.21, by the way. If you want to keep estimates out of OSM, there's probably another way to use QGIS or something to tag some points/quickly drawn areas with capacity estimates. Then we can do something like https://github.com/a-b-street/abstreet/blob/a12ceac38bc78e9de5e9ff75b14e08bca6b53111/importer/src/seattle.rs#L141 to import this in A/B Street.

Also, I'm curious to hear about your use case in Vancouver. Calibrating the traffic simulation is tremendously hard, depending what you want to do with it. If you have a particular goal or area you want to edit and compare, there's usually a way to simplify the scope of things.

n8bot commented 3 years ago

Yeah, including the real-world data in OSM would be nice. Though, I could still see there being some use in modifying the numbers in-game, as a means of making proposals showing how things would be with fewer or more spots, etc.

I'm very new to all this so I'd be willing to take any and all direction/advice.

I'm just trying to make a somewhat close to real model of the downtown core of Vancouver, so that I can play around with radical proposals (removing all traffic lanes in the core? Forcing the cars to park on the outskirts and walk/bike/transit into the city? It's nothing very serious that I'm doing. It's just for fun and learning.

dabreegster commented 3 years ago

How about this for a short-term plan:

Option 1, tag capacity in OSM directly. https://wiki.openstreetmap.org/wiki/Tag:amenity%3Dparking and the capacity tag are most relevant. Then TODO on the A/B Street side, interpret this tag for parking lots and garages.

Option 2, create a separate file with estimates for capacity. If you're going to make up estimates and it's not appropriate to tag that in OSM, you can use a tool like http://geojson.io/#map=14/49.2623/-123.1179. You would drop a pin on a lot/garage, click it, then add a row with something like capacity = 30. You can manage this like a normal file. Then TODO on A/B Street side, add support for reading in that extra file and matching it to the nearest building/lot, like we do already for the King County shapefile.

A longer-term plan would be to edit parking directly in A/B Street. This would be a much easier user experience, and also allow A/B testing situations where there's more or less off-street parking.

radical proposals (removing all traffic lanes in the core? Forcing the cars to park on the outskirts and walk/bike/transit into the city?

These are neat ideas, hopefully ones that A/B Street could help explore one day. There are plenty of bugs and missing features you'll hit trying to do this, but one of the best ways forward is to uncover the easiest next steps to work on that would have high impact. So thanks for the feedback, and keep it coming! I'm not likely to have time to work on editing parking directly anytime soon, but I'll keep it in mind.

n8bot commented 3 years ago

I like all those options. I'm patient, and I see how A/B Street needs attention in other areas, too.

In the meantime, I'm going to learn a bit about rust and see if I can begin to understand how things work. I'm no software engineer, but I've tinkered with open source c++ software before, and had some luck tracking down bugs so perhaps I can end up being helpful.

dabreegster commented 3 years ago

Hopefully picking up some Rust is easier than C++! If you'd like to potentially work on this feature of editing parking directly in A/B Street as a learning project, I'd be happy to give some guidance through the process. Let me know if so. The starter would be building from source (https://a-b-street.github.io/docs//tech/dev/index.html). Then there's two directions you could tackle this feature.

1) Make the UI changes. If we're doing this the simplest possible way, we could add an "edit parking" action on buildings, similar to how you click a lane today and can "edit lane." https://github.com/a-b-street/abstreet/blob/a12ceac38bc78e9de5e9ff75b14e08bca6b53111/game/src/sandbox/mod.rs#L324 and https://github.com/a-b-street/abstreet/blob/a12ceac38bc78e9de5e9ff75b14e08bca6b53111/game/src/sandbox/mod.rs#L378 are where that action is triggered. Then you need to create a new State with some kind of widgets for changing the parking. For the moment, clicking "Apply changes" there could just have no effect.

2) https://github.com/a-b-street/abstreet/blob/a12ceac38bc78e9de5e9ff75b14e08bca6b53111/map_model/src/edits/mod.rs#L188 Following the example of ChangeRouteSchedule, make a new edit command to change the offstreet parking per building

ticklepoke commented 1 year ago

I'm gonna take a stab at this, if there is still a need to edit offstreet parking. Here is my rough thought process:

  1. We need something like fn can_edit_building_parking(app: &App, b: BuildingID) -> bool to check if the building has parking (OffStreetParking::Private(0, false) represents no parking for the building) before we can add an edit key for buildings. Should we allow users to mutate OffstreetParking::Private(0, false) to something else?
  2. We need to create a BuildingEditor, similar to RoadEditor for transitions.
  3. Add a EditCmd::ChangeBuildingParking variant.

Did I miss out anything?

dabreegster commented 1 year ago

Hi @ticklepoke, it'd be great to see this implemented! Your plan sounds good to me.

Should we allow users to mutate OffstreetParking::Private(0, false) to something else?

Probably so. Most buildings in most imported maps will have 3 private spots by default. (See private_offstreet_parking in importer/src/map_config.rs) Letting the user swap between public garage and private and modifying the number of spots both seem useful to me!

We need to create a BuildingEditor, similar to RoadEditor for transitions.

This will be the hard part, IMO. Something simple would let you click a building and fill out a little form to change it. But ideally this UI would nicely show the current numbers per building, maybe with coloring. And depending what people want to use this for, maybe make it convenient to edit a bunch of buildings at once -- widegtry::tools::Lasso or something like that could be helpful? But feel free to keep it simple to start and don't let scope creep stop you -- we can always iterate on things in smaller steps later.

Add a EditCmd::ChangeBuildingParking variant.

Along with this, we'll need a new PermanentEditCmd case. EditCmd is used while the app is running and can use map_model::BuildingID directly. When we save the edits to a file and load them, we have to refer to building IDs in a more stable way. The other enum cases there right now use OSM IDs, but this has proven to be a bad idea (#995). I'd recommend using the building's centroid (building.poygon.center() or polylabel()) and storing as a gps::LonLat in PermanentEditCmd. And for loading, snapping to the nearest building. Since OSM IDs can change over time, just looking for the closest match is probably more robust, and for the case of building centers, it should be pretty simple.

Feel free to reach out if you hit any snags on this. Excited to see it!