[OSM-talk] [Talk-us] NHD Dataset

Christopher Schmidt crschmidt at metacarta.com
Mon Feb 16 19:25:54 GMT 2009

```On Mon, Feb 16, 2009 at 12:55:51PM -0600, Ian Dees wrote:
> It looks like the solution is to use Advanced Multipolygons:
>
>
> Does anyone want to start writing an algorithm to nicely slice up polygons
> into "small enough" chunks?

So, to be clear, what this looks like to me is that for any polygon, you
can take the 'one long way' that would previously have outlined it, and
instead of having that 'one long way', you have as many little ways as
it would take to make up that ring. So, for a 4,005 node way, assuming
a 1,000 node limit, you could have:

* 10 1,000 node ways
* 1 5 node way

and:

<relation id="1">
<tag k="type" v="multipolygon" />
<member type="way" id="1" role="outer" /> <!-- 1-1000 -->
<member type="way" id="2" role="outer" /> <!-- 1001-2000 -->
<member type="way" id="3" role="outer" /> <!-- etc. -->
<member type="way" id="4" role="outer" />
<member type="way" id="5" role="outer" />
</relation>

However, it is not clear that that is what Frederik meant in:

http://lists.openstreetmap.org/pipermail/talk/2009-February/034091.html

He suggested that the ways should be split up into smaller 'ways of
managable size', but from what I've seen, these 'ways of managble size'
are often closed polygons on their own:

http://openstreetmap.org/browse/way/24417625/

Doing the former is easy. Doing the latter is hard, because figuring out
how far you can go before 'drawing a line' to close the polygon is
something I can't understand how to do. Imagine a 'C' shaped lake:

-------
|     |
|  ----
|  |
|  ----
|     |
|------

Creating closed chunks of that polygon, keeping the edges mostly as they
are in the original, is not something I can imagine a way to do
programatically. (I think that tesslating it into a bunch of triangles
would be possible, but  then you're really creating something that
doesn't look at all like the output polygon.)

Maybe Frederik was saying that the former is okay. My curiousity in that
case is just if renderers -- especially Mapnik -- will actually support
these things. (I can't imagine it working for osmarender, but that is
less concenring to me.) If they won't, then adding the data like this
may not be a good idea, simply because people will start doing wacky
things to get data to show up in the map, messing up data...

Is my concern clear? If it's the former, it's pretty easy to add to
polyshp2osm, but the latter is hard...

CCing talk@, since I assume frederik isn't on this list, and he can
probably quickly tell me that I'm wrong in thinkign he might mean the
latter. :)

Regards,
--
Christopher Schmidt
MetaCarta

```