Giter Site home page Giter Site logo

"Flooded" map about abstreet HOT 7 OPEN

a-b-street avatar a-b-street commented on May 3, 2024 1
"Flooded" map

from abstreet.

Comments (7)

dabreegster avatar dabreegster commented on May 3, 2024

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.

dabreegster avatar dabreegster commented on May 3, 2024

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.

dabreegster avatar dabreegster commented on May 3, 2024

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.

matkoniecz avatar matkoniecz commented on May 3, 2024

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.

dabreegster avatar dabreegster commented on May 3, 2024

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.

dabreegster avatar dabreegster commented on May 3, 2024

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:
Screenshot from 2021-11-19 10-13-31
Screenshot from 2021-11-19 10-13-28

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.

Darellur avatar Darellur commented on May 3, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.