Comments (7)
Guess it's a flood simulator now. >_< Turning clipped OSM data into water polygons is a bit hard. https://github.com/dabreegster/abstreet/blob/9aa4fda837ab813fd2e6d7e4381208ee03ab55c2/convert_osm/src/osm_reader.rs#L347 is the relevant code. This roughly follows https://wiki.openstreetmap.org/wiki/Relation:multipolygon/Algorithm, then tries to deal with disconnected ends by finding a spot where the half-formed ring intersects the boundary polygon, and tracing along it.
I think the problem here is that when tracing along the boundary polygon, little bits of land reappear, and the code doesn't deal with that case yet. I don't know if I'll be able to look at this soon, but if you want to try to tackle it, run with --dev
and then enter debug mode with control+D. You can select the water polygons and press x or F2 to look at the points and triangles.
from abstreet.
I happened to hit this problem in Manhattan and found a possible workaround -- flip the order at https://github.com/dabreegster/abstreet/blob/41e80b48a16c624eda533de21131f2b8fb947407/geom/src/ring.rs#L94 to get the inverse polygon. Always picking the shorter connection doesn't make sense. There might be a way to decide automatically whether to pick the shorter or longer connection.
from abstreet.
Stumbled across https://github.com/QwantResearch/osm_boundaries_utils_rs/blob/master/src/boundaries.rs, which could be the start to something more robust
from abstreet.
I had similar issues - maybe process water area data by some external software such as mapshaper and load already clipped water polygons? ( https://github.com/mbloch/mapshaper )
from abstreet.
I had looked around a while ago for existing water polygons and didn't find much. I missed mapshaper; I'll see if it could be an easier option. Thanks!
from abstreet.
Another case that we need to handle is gluing two pieces of coastline together that're expressed in different ways. In Lisbon we have a natural=coastline
way (https://www.openstreetmap.org/way/975228400) that ends right where a natural=water, type=multipolygon
(https://www.openstreetmap.org/relation/2805665) begins:
But maybe not... I also see another section of natural=coastline
that seems connected: https://www.openstreetmap.org/way/692883618. And it seems to keep going. Need to dig into glue_multipolygon
to see what's happening here. The multipolygon is a red herring maybe.
from abstreet.
From https://wiki.openstreetmap.org/wiki/Tag:natural%3Dcoastline
"The direction the ways are drawn is very important! They must be drawn so that the land is on the left side and water on the right side"
Has this been considered?
from abstreet.
Related Issues (20)
- Impossible/impracticable to undo automated filter placement in Design LTN tool HOT 2
- Crash when clicking on a parking lot HOT 3
- Trying to load Camden data to test low traffic neighbourhoods HOT 6
- Boolean ops crash in WASM only HOT 4
- Mac builds broken HOT 9
- Switching maps doesn't clear proposal URL
- Missing crosswalks in LTN "crossing" feature HOT 1
- 15 min neighborhood routing issues HOT 2
- cant parse hebrew HOT 6
- Draw routes more clearly when unzoomed on large maps HOT 5
- Grid2Demand agent file fails to load.
- Crash when launching traffic sandbox HOT 1
- Crash when changing one-way direction
- Print / export map HOT 1
- App crashed when trying to load San Francisco map HOT 1
- LTN traffic prediction is too accurate HOT 1
- Import a new map HOT 3
- Crash while simulating traffic. HOT 1
- Location names in Cyrillic do not load HOT 3
- Traffic lights ? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from abstreet.