StrandedKitty / streets-gl

🗺 OpenStreetMap 3D renderer powered by WebGL2
http://streets.gl
MIT License
632 stars 48 forks source link

FYI: osm2streets exists #27

Open westnordost opened 1 year ago

westnordost commented 1 year ago

You might be interested in this project: https://github.com/a-b-street/osm2streets

It takes care of all the heavy lifting (logic) of interpreting the layout of roads, including the lanes, the turn lanes, cycle lanes, sidewalks etc., calculating the intersection areas etc.

You got pretty far too, but I expect it to be somewhat of a time sink / can of worms once you get down on the details. So, hopefully this project will help you.

StrandedKitty commented 1 year ago

Hi, thank you for sharing this. I've read some blog posts written by the creator of this project in which he described how he implemented road generation. I've took some ideas from these posts, but I've never seen the code, I didn't even know it was public.

Mostly it looks better that what's implemented in Streets GL. For example, road segments with different number of lanes have some sort of "connectors" that look quite natural.

It's not ideal though, for instance at 47.61646,-122.33807 osm2streets produces bad result, while Streets GL handle it much better:

Screenshot 2023-05-04 at 12 08 04 Screenshot 2023-05-04 at 12 07 47

It's hard to tell if it's worth integrating at this point, because there's already a system that kinda works and handles most cases.

westnordost commented 1 year ago

True, the osm2streets version looks messed up. But the project is not abandoned, so enhancements and fixes are to be expected.

In any case, I have no familiarity with osm2streets so I can't say anything more than what I did about it.

dabreegster commented 1 year ago

Hi, main osm2streets author here! And CC @BudgieInWA, the other. Super excited to discover this project; it's absolutely beautiful.

I've never seen the code, I didn't even know it was public.

https://github.com/a-b-street/osm2streets. https://github.com/a-b-street/osm2streets/blob/main/docs/how_it_works.md is a more up-to-date overview of how things are structured

It's not ideal though, for instance at 47.61646,-122.33807 osm2streets produces bad result, while Streets GL handle it much better:

Totally true. There are so many cases where if you guess a width for a polyline, you wind up with partly overlapping parallel-ish polylines. The intersection geometry procedure blows up badly in this case. I've started looking through your code to see how you approach it and get nicer results.

I've been busy with other projects recently, but osm2streets is definitely still in development. If it gets to a point of polish where you'd like to integrate it, I'd happily support that. If there are smaller chunks that could be helpful in the meantime (such as a method to parse one OSM way's tags into a list of lanes from left-to-right, then I could extract that into a nice TypeScript API in the short term.

StrandedKitty commented 1 year ago

@dabreegster Thank you, I will take a look. If you have any questions about how my implementation works, don't hesitate to ask.