Re: [OSM-dev] multipolygon relation and non-closed ways
Well, I care about the mapper who is interested in an agreed final result and doesn't want to spend his time reading the opinion of individual persons. Just for this there's a talk page for each wiki page. When interested you can subscribe to the talk page separately. If the talk page isn't enough additional pages can be easily created. Willi On Monday, October 15, 2012 10:43 AM Pedro Larroy [mailto:pedro.larroy.li...@gmail.com] wrote: Hi Willi. Sorry to read your negative opinion. I think a better and more detailed wiki page helps osm, irrespectively of edit history. I don't see why editing and refining a page is bad. Sure things can always be done better, but the beauty of wikis is that you can update them fast without going through a comitee. Regards. On Oct 14, 2012 4:39 AM, Willi wil...@gmx.de wrote: Imho it's not only bad behavior to change a wiki page 19 times on the same day it's harming OSM. Having the discussion on the OSM-dev list makes this even worse. http://wiki.openstreetmap.org/w/index.php?title=Relation:multipolygonaction =history All changes except minor should be discussed on the Talk page first. Even if you are the expert and are 200% sure that what you are writing is correct it might be misleading or even not understandable to non experts. And imho that's just the case for the new additions. Asking to be involved in discussions but changing the page without discussion is topping this. http://wiki.openstreetmap.org/wiki/Talk:Relation:multipolygon#Recent_change_ about_validity_of_a_multipolygon_relation I'm afraid more mapper will turn away from Wiki pages when they neither can follow nor understand such frequent changes. That's harming OSM. Willi ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] multipolygon relation and non-closed ways
On Mon, Oct 15, 2012 at 08:03:12AM +0300, Jukka Rahkonen wrote: I think that making geometries valid with PostGIS or Spatialite is one step too late. Osmium and ogr2ogr and other converters should be able to send already valid geometries into PostGIS, GML, shapefiles and what ever. Perhaps they already can. Osmium should already only create valid Multipolygons. (It will drop non-valid MPs on the floor, not much else to do.) If you find an invalid MP created by Osmium, thats a bug. Perhaps examples B and F could also contain at least two ways? If there is only one way, why to make a multipolygon relation at all? But of course it is possible to make single way multipolygon relations. I guess that those who make converters would like to have all polygon as relations instead of the current situation with relations and area=yes polygons and those which must be interpreted by the tags like natural=water. Unfortunately thats the current state of the art. There are two ways a polygon can be modelled (closed way and mp relation). And when its a closed way you have to look at all the tags to decide in a somewhat fuzzy way whether thats just a closed linestring or a polygon. We do not want to use mp relations for all those small polygons such as building outlines, that would be overkill. So until we have something better we have to handle that. Also see: http://wiki.openstreetmap.org/wiki/The_Future_of_Areas And something else: Somebody recently started a collection of mp testcases and put it in a github repository. I forgot where that was but maybe somebody can dig that up and join in that work. Jochen -- Jochen Topf joc...@remote.org http://www.remote.org/jochen/ +49-721-388298 ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] multipolygon relation and non-closed ways
2012/10/15 Jukka Rahkonen jukka.rahko...@latuviitta.fi: Perhaps examples B and F could also contain at least two ways? If there is only one way, why to make a multipolygon relation at all? there can be reasons. E.g. you want to distinguish linear features from areas. The way could be tagged barrier=fence/wall/etc. and the area landuse=* (this is a quite common situation). cheers, Martin ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] multipolygon relation and non-closed ways
hi, Perhaps a useless idea from my side. I would also like to hire you for an hour or two for quick reading some other OGC specifications for me. I'm far from an expert for that ;-) Perhaps you mean that the OSM wiki page I've created should be made more explicit for developers (or another page more technically oriented) about this OGC simple feature standard ? I tried ST_MakeValid and it seems to be able to convert also the two touching inner ring case into a valid simple feature (...) GEOMETRYCOLLECTION(POLYGON((-139 420,71 418,59 273,-156 272,-139 420),(-46 312,-5 314,-4 371,-46 370,-89 370,-92 313,-46 312)),LINESTRING(-46 312,-46 370)) The fact that you end with a GEOMETRYCOLLECTION (with a LINESTRING) and not a MULTIPOLYGON after ST_MakeValid express the fact that the touching inner case isn't valid for OGC. But it has always been accepted as the OSM exception to the standard, because it would be more complex for mappers to do it in compliance with OGC standard. Perhaps examples B and F could also contain at least two ways? If there is only one way, why to make a multipolygon relation at all? You are right, both B and F (and 3 and 5) could and should be tagged as a simple closed way without relation at all. But my polygon(s) validity page could also be extended to non-relation polygons as well. 3 and 5, even if tagged without relation should (that's my opinion) still be considered invalid geometries. -- sly qui suis-je : http://sly.letuffe.org email perso : sylvain chez letuffe un point org ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] multipolygon relation and non-closed ways
And something else: Somebody recently started a collection of mp testcases and put it in a github repository. I forgot where that was but maybe somebody can dig that up and join in that work. That would be interesting to include this to my wiki page to display real example cases in the .osm format for developers. Any clues where we can find those mp testcases ? -- sly qui suis-je : http://sly.letuffe.org email perso : sylvain chez letuffe un point org ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] multipolygon relation and non-closed ways
Martin Koppenhoefer wrote: 2012/10/15 Jukka Rahkonen jukka.rahko...@latuviitta.fi: Perhaps examples B and F could also contain at least two ways? If there is only one way, why to make a multipolygon relation at all? there can be reasons. E.g. you want to distinguish linear features from areas. The way could be tagged barrier=fence/wall/etc. and the area landuse=* (this is a quite common situation). Yes, that is understandable situation indeed. What do you think would be the best thing to do if an user wants to re-use a zig-zagging linestring for creating a multipolygon relation? In a raw format with vertices in the same order as they appear in a linestring the resulting polygon will be invalid as OGC polygon because of self-intersections. I guess it is pretty expensive to do topology checks in the main OSM database triggered automatically every time when relations are saved. Other alternatives I can imagine are - Make OSM editor to check the topology of multipolygon relations before saving and warn users about conflicts. - Run some kind of validating bots which harvest areas and multipolygons from OSM database, resolve simple cases and make topology error reports from the remaining. - Do nothing in the OSM db side and trust that programs which consume OSM data and need OGC style validity can resolve the conflicts in a reasonable way. - All of those together. What I have been doing myself in just to accept the results from osm2pgslq and ogr2ogr and in addition delete all the imported features which are reported invalid by IsValid function. -Jukka Rahkonen- ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] multipolygon relation and non-closed ways
I guess it is pretty expensive to do topology checks in the main OSM database triggered automatically every time when relations are saved. I think this is the best way to do it, don't allow crap in the db so that you don't have to correct it later. But it might be unreasonable for performance reasons in which case, I don't know what's the 2nd best. -- sly qui suis-je : http://sly.letuffe.org email perso : sylvain chez letuffe un point org ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] multipolygon relation and non-closed ways
On lundi 15 octobre 2012, Pedro Larroy wrote: I don't see why editing and refining a page is bad. Because in this case, this page is the documentation of how to do things in the OSM db, and if by refining you mean changing the way to do things, then people will map according to what they've read at one point in time leading to different ways of tagging. That's why I think that for those pages, we should first find consensus and discussion before, and, if the current state is worst than changing the page, then we change the page. -- sly qui suis-je : http://sly.letuffe.org email perso : sylvain chez letuffe un point org ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] multipolygon relation and non-closed ways
And something else: Somebody recently started a collection of mp testcases and put it in a github repository. I forgot where that was but maybe somebody can dig that up and join in that work. That would be interesting to include this to my wiki page to display real example cases in the .osm format for developers. Any clues where we can find those mp testcases ? I guess it's that one: https://github.com/nimix/osm_conv_tests mentioned in this thread: http://gis.19327.n5.nabble.com/New-OGR-driver-to-read-OpenStreetMap-osm-pbf-files-tt5715906.html#a5716461 -- Norbert Renner (ikonor) ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] multipolygon relation and non-closed ways
Since he was just trying to clarify the current rules not change them, that obviously doesn't apply. That is also why Willi's reaction is so overblown. On 10/15/2012 05:29 PM, sly (sylvain letuffe) wrote: On lundi 15 octobre 2012, Pedro Larroy wrote: I don't see why editing and refining a page is bad. Because in this case, this page is the documentation of how to do things in the OSM db, and if by refining you mean changing the way to do things, then people will map according to what they've read at one point in time leading to different ways of tagging. That's why I think that for those pages, we should first find consensus and discussion before, and, if the current state is worst than changing the page, then we change the page. -- --- m.v.g., Cartinus ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] multipolygon relation and non-closed ways
Hi, On 14.10.2012 04:37, Willi wrote: Imho it's not only bad behavior to change a wiki page 19 times on the same day it's harming OSM. Having the discussion on the OSM-dev list makes this even worse. Personally, I think it is *good* to have a discussion on the mailing list; if this had been on the Wiki talk page, I would never have noticed it. Bye Frederik -- Frederik Ramm ## eMail frede...@remote.org ## N49°00'09 E008°23'33 ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] multipolygon relation and non-closed ways
Hi, On 14.10.2012 00:36, Pedro Larroy wrote: So for overlapping inner polygons the only way to differentiate them is by tagging as far as I can see. I'm not sure I understand. There must not be any overlapping rings in a multipolyon, no matter what the role is, and inner rings must not touch outer rings either. Touching inner rings are not allowed in simple features but we have chosen to allow them in OSM (for the big forest containing a lake and adjacent meadow type of situation). Otherwise, looking at the Algorithm page that you mentioned, doesn't the step RA-4 become ambiguous? It is indeed not immediately clear which connecting way to choose, and a perfect algorithm would have to be complemented with a backtracking scheme to evaluate several possibilities. But even if one were to include the role in the equation that would not change things: If you have four non-closed ways meeting in one point like this (fixed font, * = meeting point) 11*334 2 24 4 2224 4 222444 and these four ways together form two touching inner rings, then they will *all* have the inner role - so looking at the role won't help! The algorithm that I'm using stores the endpoint on a hash to make the rings, so if there's more than two is not possible to have an clear result. In the above situation, if you mistakenly combine ways 1+3 and ways 2+4 you will not end up with a valid multipolygon, so you have to go back and try the other option which will work. I added a note to the algorithm page explaining that. Am I missing something here? No, you were right in spotting the problem; it is however one that seldom occurs in practice because in most cases, the inner rings are not groups of multiple ways but just a single closed way. Bye Frederik -- Frederik Ramm ## eMail frede...@remote.org ## N49°00'09 E008°23'33 ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] multipolygon relation and non-closed ways
Le samedi 13 octobre 2012 21:49:21, Frederik Ramm a écrit : (Frankly I am surprised that you thought the list was necessary, as I believed everything to be explained properly already.) I'm not surprised, I've been asking for a while what validity means in the context of multipolygon relations in OSM (on tagging list), especially in strange border cases, but I'm still missing answers. I also guess that since changes on the wiki are recurrent about that, I'm not the only one unsure about what is and what isn't valid. But maybe I failed to reach the good list, and dev is better suited for that as the answer is far from trivial, and is indeded more complex that you seam to imply (+include some GIS background needs). But nothing is ever too late isn't it ? I'll come back later with examples as a graphic is far easier to understand than fix font ASCII art As a starting point for the shorter definition of what validity is, I suggest referring to the OGC standard this way : ''' A multipolygon relation in OSM is considered valid if it can be used, without discarding nodes or ways or part of ways to build a valid geometry as define by the OGC Simple Feature standard (http://www.opengeospatial.org/standards/sfs) with the notable exception of touching inner rings (see below). ''' -- sly (sylvain letuffe) ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] multipolygon relation and non-closed ways
Le dimanche 14 octobre 2012 04:37:43, Willi a écrit : Imho it's not only bad behavior to change a wiki page 19 times on the same day it's harming OSM. Agreed. Having the discussion on the OSM-dev list makes this even worse. What about starting here, to reach GIS aware people, then present the final idea on talk (backed up by definition ranging from clear mathish un- understandable by common people definition to clear examples with graphics) ? -- sly (sylvain letuffe) ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] multipolygon relation and non-closed ways
Le dimanche 14 octobre 2012 15:48:08, sly (sylvain letuffe) a écrit : I'll come back later with examples as a graphic is far easier to understand than fix font ASCII art Here is some food for thoughts : http://wiki.openstreetmap.org/wiki/Relation:multipolygon/validity Feel free to add other examples that you think need clarification. And of course comments are welcome. -- sly (sylvain letuffe) ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] multipolygon relation and non-closed ways
Hi, On 14.10.2012 17:21, sly (sylvain letuffe) wrote: Here is some food for thoughts : http://wiki.openstreetmap.org/wiki/Relation:multipolygon/validity I don't think that the touching inner ring issue was ever limited to two or more consecutive points. Your page is the first time I read this. Personally I don't consider the 8 shapes valid - and I don't think there's a difference between the one with a node in the middle and the one without. I don't consider the inner ring touching outer ring in single point case to be valid either. Bye Frederik -- Frederik Ramm ## eMail frede...@remote.org ## N49°00'09 E008°23'33 ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] multipolygon relation and non-closed ways
2012/10/14 Frederik Ramm frede...@remote.org: Personally I don't consider the 8 shapes valid - and I don't think there's a difference between the one with a node in the middle and the one without. I don't consider the inner ring touching outer ring in single point case to be valid either. IMHO the second case would also be bad mapping if it was technically valid. There are no such situations in real life and I cannot imagine a situation where this would not be a bad abstraction. cheers, Martin ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] multipolygon relation and non-closed ways
I don't think that the touching inner ring issue was ever limited to two or more consecutive points. Your page is the first time I read this. As far as I understand the OGC validity of multipolygon, the answer is yes. Because in the first place, OGC standard does not consider touching inner ring by one isolated node to be invalid. Therefore, the deviance to the standard as expressed in the sentence with the notable exception of touching inner rings is only true for two or more consecutive points (Like the example shown here : http://wiki.openstreetmap.org/wiki/File:Multipolygon_Illustration_8.png ) Personally I don't consider the 8 shapes valid And : http://wiki.openstreetmap.org/wiki/File:Multipolygon_Illustration_touching_on_one_point.svg ? Your input is valuable ;-) But for a clarity's sake I think we have to answer those questions : a) Do we need touching outer polygons in OSM b) If yes, can it be allowed as single way in 8 shape or modeled as 2 ways touching at a single point c) If no, the long standing sentence the multipolygon relation can be used to build multipolygons in compliance with the OGC Simple Feature standard should be amended with other exceptions added My proposal for a) is yes we need them (I can show boundary examples on requests) and I don't care if b) is or isn't considered invalid as long as it is written on the wiki - and I don't think there's a difference between the one with a node in the middle and the one without. There isn't if you focus on the OGC MULTIPOLYGON geometry built from this relation (it will be the same in the end), but it might be a computing overhead that we might want to forbid in the first place : at mappers side. I don't consider the inner ring touching outer ring in single point case to be valid either. I also have boundary examples on request to express it is needed, but we can either build those cases with that : http://wiki.openstreetmap.org/wiki/File:Multipolygon_Illustration_self_touching_on_one_point.svg -- sly (sylvain letuffe) ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] multipolygon relation and non-closed ways
Martin Koppenhoefer kirjoitti: 2012/10/14 Frederik Ramm frede...@remote.org: Personally I don't consider the 8 shapes valid - and I don't think there's a difference between the one with a node in the middle and the one without. I don't consider the inner ring touching outer ring in single point case to be valid either. IMHO the second case would also be bad mapping if it was technically valid. There are no such situations in real life and I cannot imagine a situation where this would not be a bad abstraction. Hi, The inner triangle could be a cadastral parcel inside another cadastral parcel sharing only one common landmark. For sure such cases exist in real life. Drawing this as one outer ring touching itself in one point seems to be invalid for JTS (self-intersection) while drawing an inner ring touching outer ring at one point is OK for JTS. OpenJUMP is a good tool for testing what JTS thinks about validity. Set Snap to vertises and Prevent edits leading to invalid geometry options on from the settings and start digitizing. -Jukka Rahkonen- cheers, Martin ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] multipolygon relation and non-closed ways
Jukka Rahkonen kirjoitti: OpenJUMP is a good tool for testing what JTS thinks about validity. Set Snap to vertises and Prevent edits leading to invalid geometry options on from the settings and start digitizing. After playing a little bit more with OpenJUMP I noticed that it is not so simple to use as I supposed. Snapping to vertices does not work for the vertisces of the feature that is under construction. Therefore one must digitise the vertices first as point features for making the snapping to work. It is also possible to create invalid multipolygons so that OpenJUMP does not warn about it with some tools. For example I managed to create this MULTIPOLYGON (((52 453, 52 369, 122 392, 111 447, 52 453)), ((2 455, 75 416, 4 347, -18 406, 2 455))) even the parts are overlapping. By the way, perhaps there could be WKT presentations about what would be the simple feature solutions of the examples on page http://wiki.openstreetmap.org/wiki/Relation:multipolygon/validity. I also notised some more complications with converting OSM polygons and multipolygons into OGC simple features. Example http://wiki.openstreetmap.org/wiki/File:Multipolygon_Illustration_8_shape_with_intesection_point.svg is hard to convert into a valid simple feature if it is drawn as one way ABCDEBF. It can be wrongly interpreted as a single ring polygon with self-intersection. However, it could be transformed into a valid OGC MultiPolygon with two parts ABF and BCDE. This is ten years old publication and it handles only polygons, not multipolygons, but it is still amusing reading http://www.gdmc.nl/publications/2003/Polygons.pdf -Jukka Rahkonen- ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] multipolygon relation and non-closed ways
Drawing this as one outer ring touching itself in one point seems to be invalid for JTS (self-intersection) while drawing an inner ring touching outer ring at one point is OK for JTS. I don't know JTS, but as you describe it, it implements validity as define by the OGC for this case. See here, the banana polygon : http://workshops.opengeo.org/postgis-intro/validity.html But it shouldn't be forgotten that multipolygons in OSM are not OGC multipolygons. The sentence used on the wiki since the beginning was : multipolygon relation can be used to build multipolygons in compliance with the OGC In the case http://wiki.openstreetmap.org/wiki/Relation:multipolygon/validity#F_- _Polygon_self_touching_on_one_node A valid OGC can still be constructed as you described it (one outer and one inner touching on one point) -- sly (sylvain letuffe) ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] multipolygon relation and non-closed ways
By the way, perhaps there could be WKT presentations about what would be the simple feature solutions of the examples on page http://wiki.openstreetmap.org/wiki/Relation:multipolygon/validity. Only if OSM multipolygons are still intended to be considered valid if one valid OGC WKT representing them exists, else it doesn't matter anymore to know the WKT presentation. Also I probably wont take the time to do it (unless really wanted ?) since WKT is really technically oriented and not for the usual contributorx. And for developers, in such simple examples, a quick read of the OGC specification should give them easily a valid WKT prestentation if it exists. Example http://wiki.openstreetmap.org/wiki/File:Multipolygon_Illustration_8_shape_w ith_intesection_point.svg is hard to convert into a valid simple feature if it is drawn as one way ABCDEBF. It really depends how you are defining hard ;-) Maybe if you intend to code the algorithm from scratch in C yes, but if you have access to postgis 2.0 it is as simple as : SELECT ST_AsText(ST_MakeValid(' POLYGON((-1 -1, -1 0, 1 0, 1 1, 0 1, 0 -1, -1 -1))' )); http://blog.opengeo.org/2012/03/23/postgis-2-0-new-features-st_makevalid/ It can be wrongly interpreted as a single ring polygon with self-intersection. However, it could be transformed into a valid OGC MultiPolygon with two parts ABF and BCDE. correct. -- sly (sylvain letuffe) ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] multipolygon relation and non-closed ways
On Sunday, October 14, 2012 8:52 PM sly (sylvain letuffe) [mailto:li...@letuffe.org] wrote: What about starting here, to reach GIS aware people, then present the final idea on talk (backed up by definition ranging from clear mathish un- understandable by common people definition to clear examples with graphics) ? Good idea. And also the drafts for discussion on a separate wiki page http://wiki.openstreetmap.org/wiki/Relation:multipolygon/validity I'm looking forward to read and comment the final result. Willi ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] multipolygon relation and non-closed ways
Hi Willi. Sorry to read your negative opinion. I think a better and more detailed wiki page helps osm, irrespectively of edit history. I don't see why editing and refining a page is bad. Sure things can always be done better, but the beauty of wikis is that you can update them fast without going through a comitee. Regards. On Oct 14, 2012 4:39 AM, Willi wil...@gmx.de wrote: Imho it's not only bad behavior to change a wiki page 19 times on the same day it's harming OSM. Having the discussion on the OSM-dev list makes this even worse. http://wiki.openstreetmap.org/w/index.php?title=Relation:multipolygonaction =history All changes except minor should be discussed on the Talk page first. Even if you are the expert and are 200% sure that what you are writing is correct it might be misleading or even not understandable to non experts. And imho that's just the case for the new additions. Asking to be involved in discussions but changing the page without discussion is topping this. http://wiki.openstreetmap.org/wiki/Talk:Relation:multipolygon#Recent_change_ about_validity_of_a_multipolygon_relation I'm afraid more mapper will turn away from Wiki pages when they neither can follow nor understand such frequent changes. That's harming OSM. Willi ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] multipolygon relation and non-closed ways
sly (sylvain letuffe) wrote: By the way, perhaps there could be WKT presentations about what would be the simple feature solutions of the examples on page http://wiki.openstreetmap.org/wiki/Relation:multipolygon/validity. Only if OSM multipolygons are still intended to be considered valid if one valid OGC WKT representing them exists, else it doesn't matter anymore to know the WKT presentation. Also I probably wont take the time to do it (unless really wanted ?) since WKT is really technically oriented and not for the usual contributorx. And for developers, in such simple examples, a quick read of the OGC specification should give them easily a valid WKT prestentation if it exists. Perhaps a useless idea from my side. I would also like to hire you for an hour or two for quick reading some other OGC specifications for me. Example http://wiki.openstreetmap.org/wiki/File:Multipolygon_Illustration_8_shape_w ith_intesection_point.svg is hard to convert into a valid simple feature if it is drawn as one way ABCDEBF. It really depends how you are defining hard ;-) Maybe if you intend to code the algorithm from scratch in C yes, but if you have access to postgis 2.0 it is as simple as : SELECT ST_AsText(ST_MakeValid(' POLYGON((-1 -1, -1 0, 1 0, 1 1, 0 1, 0 -1, -1 -1))' )); http://blog.opengeo.org/2012/03/23/postgis-2-0-new-features-st_makevalid/ I think that making geometries valid with PostGIS or Spatialite is one step too late. Osmium and ogr2ogr and other converters should be able to send already valid geometries into PostGIS, GML, shapefiles and what ever. Perhaps they already can. I tried ST_MakeValid and it seems to be able to convert also the two touching inner ring case into a valid simple feature select ST_AsText (ST_MakeValid(' POLYGON (( -139 420, 71 418, 59 273, -156 272, -139 420 ), ( -89 370, -92 313, -46 312, -46 370, -89 370 ), ( -46 370, -46 312, -5 314, -4 371, -46 370 ))' )); Result is: GEOMETRYCOLLECTION(POLYGON((-139 420,71 418,59 273,-156 272,-139 420),(-46 312,-5 314,-4 371,-46 370,-89 370,-92 313,-46 312)),LINESTRING(-46 312,-46 370)) It can be wrongly interpreted as a single ring polygon with self-intersection. However, it could be transformed into a valid OGC MultiPolygon with two parts ABF and BCDE. correct. Perhaps examples B and F could also contain at least two ways? If there is only one way, why to make a multipolygon relation at all? But of course it is possible to make single way multipolygon relations. I guess that those who make converters would like to have all polygon as relations instead of the current situation with relations and area=yes polygons and those which must be interpreted by the tags like natural=water. -Jukka Rahkonen- ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
[OSM-dev] multipolygon relation and non-closed ways
On Mon, Oct 8, 2012 at 1:10 AM, Martin Koppenhoefer dieterdre...@gmail.com wrote: 2012/10/7 Pedro Larroy pedro.larroy.li...@gmail.com: Looks like multipolygon relations can be more complex that what I was assuming. I will fix my code. Looking carefully I see that there is no contradiction. I was assuming member ways had to be closed. don't know in which language you are coding but there is the Osmium framework which does multipolygon processing out of the box: http://wiki.openstreetmap.org/wiki/Osmium cheers, Martin Thanks for the link. I have updated the wiki with requirements for valid multipolygon relations: http://wiki.openstreetmap.org/wiki/Relation:multipolygon#Valid_Multipolygon_conditions Pedro. ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] multipolygon relation and non-closed ways
Hi, On 13.10.2012 21:35, Pedro Larroy wrote: Thanks for the link. I have updated the wiki with requirements for valid multipolygon relations: http://wiki.openstreetmap.org/wiki/Relation:multipolygon#Valid_Multipolygon_conditions I made a few changes to your list in the Wiki. (Frankly I am surprised that you thought the list was necessary, as I believed everything to be explained properly already.) First of all, the role is not actually required to determine validity, and I have removed your references of ... belonging to the same role. The algorithm laid out on the multipolygon page takes care of any valid multipolygon whatever the role; and algorithms relying on the role are broken. The use of the inner/outer roles is recommended because it adds redundancy and will often make it clearer what the mapper intended to do, but these roles are not a condition for validity. Also, the ways in a mutlipolygon relation do not have to form a closed chain (your words) but one or more closed chains. You wrote that inner polygons should not overlap with outers; I changed that to must because the polygon is invalid otherwise. Also, your rule that no more than two unclosed ways may meet in a point is not correct in the case of touching inner rings, where any even number of unclosed ways might touch in one point. Bye Frederik -- Frederik Ramm ## eMail frede...@remote.org ## N49°00'09 E008°23'33 ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] multipolygon relation and non-closed ways
On 10/13/2012 09:49 PM, Frederik Ramm wrote: Hi, On 13.10.2012 21:35, Pedro Larroy wrote: Thanks for the link. I have updated the wiki with requirements for valid multipolygon relations: http://wiki.openstreetmap.org/wiki/Relation:multipolygon#Valid_Multipolygon_conditions I made a few changes to your list in the Wiki. And I reverted your related change to the riverbank page. It looks like you misunderstood the picture. Area 2 is modeled as a (simple) polygon, so indeed way 3 has to be closed. Area 1 is modeled as a multipolygon, so way 1 can actually consist of multiple ways. -- --- m.v.g., Cartinus ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] multipolygon relation and non-closed ways
I see, thanks. On Sat, Oct 13, 2012 at 10:11 PM, Cartinus carti...@xs4all.nl wrote: On 10/13/2012 09:49 PM, Frederik Ramm wrote: Hi, On 13.10.2012 21:35, Pedro Larroy wrote: Thanks for the link. I have updated the wiki with requirements for valid multipolygon relations: http://wiki.openstreetmap.org/wiki/Relation:multipolygon#Valid_Multipolygon_conditions I made a few changes to your list in the Wiki. And I reverted your related change to the riverbank page. It looks like you misunderstood the picture. Area 2 is modeled as a (simple) polygon, so indeed way 3 has to be closed. Area 1 is modeled as a multipolygon, so way 1 can actually consist of multiple ways. -- --- m.v.g., Cartinus ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] multipolygon relation and non-closed ways
Hi Thanks for you edits. So for overlapping inner polygons the only way to differentiate them is by tagging as far as I can see. From the link you posted, in case#9 you need to use the role to build the polygons for example: http://postgis.refractions.net/docs/images/st_isvalid09.png Otherwise, looking at the Algorithm page that you mentioned, doesn't the step RA-4 become ambiguous? In this particular case there would be 3 ways that start at one of the nodes where the inner polygon is touching the outer thus several ring possibilities depending on which way is choosen. I was looking also at complete_ring in osmium's builder.hpp, and seems to me that it just chooses the first suitable. The algorithm that I'm using stores the endpoint on a hash to make the rings, so if there's more than two is not possible to have an clear result. Am I missing something here? Pedro. On Sat, Oct 13, 2012 at 9:49 PM, Frederik Ramm frede...@remote.org wrote: Hi, On 13.10.2012 21:35, Pedro Larroy wrote: Thanks for the link. I have updated the wiki with requirements for valid multipolygon relations: http://wiki.openstreetmap.org/wiki/Relation:multipolygon#Valid_Multipolygon_conditions I made a few changes to your list in the Wiki. (Frankly I am surprised that you thought the list was necessary, as I believed everything to be explained properly already.) First of all, the role is not actually required to determine validity, and I have removed your references of ... belonging to the same role. The algorithm laid out on the multipolygon page takes care of any valid multipolygon whatever the role; and algorithms relying on the role are broken. The use of the inner/outer roles is recommended because it adds redundancy and will often make it clearer what the mapper intended to do, but these roles are not a condition for validity. Also, the ways in a mutlipolygon relation do not have to form a closed chain (your words) but one or more closed chains. You wrote that inner polygons should not overlap with outers; I changed that to must because the polygon is invalid otherwise. Also, your rule that no more than two unclosed ways may meet in a point is not correct in the case of touching inner rings, where any even number of unclosed ways might touch in one point. Bye Frederik -- Frederik Ramm ## eMail frede...@remote.org ## N49°00'09 E008°23'33 ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] multipolygon relation and non-closed ways
Imho it's not only bad behavior to change a wiki page 19 times on the same day it's harming OSM. Having the discussion on the OSM-dev list makes this even worse. http://wiki.openstreetmap.org/w/index.php?title=Relation:multipolygonaction =history All changes except minor should be discussed on the Talk page first. Even if you are the expert and are 200% sure that what you are writing is correct it might be misleading or even not understandable to non experts. And imho that's just the case for the new additions. Asking to be involved in discussions but changing the page without discussion is topping this. http://wiki.openstreetmap.org/wiki/Talk:Relation:multipolygon#Recent_change_ about_validity_of_a_multipolygon_relation I'm afraid more mapper will turn away from Wiki pages when they neither can follow nor understand such frequent changes. That's harming OSM. Willi ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
[OSM-dev] multipolygon relation and non-closed ways
Hi I'm processing multipolygon relations and finding a lot of unclosed ways while processing spain. The wiki says ways in multipolygon relations are closed. http://wiki.openstreetmap.org/wiki/Relation:multipolygon For example, way 157464286 of rio Mino which is unclosed ( member of multipolygon relation id 2909). Many multipolygon relations has a mixture of closed and unclosed ways. Is this expected or are errors in the data? Pedro. ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] multipolygon relation and non-closed ways
That page is the definition of a multypolygon relation. If you are asking if that page is contradicting itself, then you have to provide more details about where on the page it is doing so in your opinion. On 10/07/2012 10:12 PM, Pedro Larroy wrote: You are right, but doesn't this way to encode riverbanks contradict the definition of multipolygon relation? Pedro. On Sun, Oct 7, 2012 at 10:07 PM, Cartinus carti...@xs4all.nl wrote: On 10/07/2012 09:59 PM, Pedro Larroy wrote: I'm processing multipolygon relations and finding a lot of unclosed ways while processing spain. The wiki says ways in multipolygon relations are closed. http://wiki.openstreetmap.org/wiki/Relation:multipolygon That page doesn't say the ways have to be closed. Look at figures 3, 5 and 6. -- --- m.v.g., Cartinus ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] multipolygon relation and non-closed ways
The point I wanted to make is that when encoding riverbanks with a multipolygon relation in which the ways are parts of the riverbank such as http://www.openstreetmap.org/browse/way/75367154 contradicts the definition of multipolygon relation http://wiki.openstreetmap.org/wiki/Relation:multipolygon which says that member ways are closed. I see that these ways have to be stitched toghether to form a propper closed polygon. Perhaps a new relation type would be better? Pedro. On Sun, Oct 7, 2012 at 10:23 PM, Cartinus carti...@xs4all.nl wrote: That page is the definition of a multypolygon relation. If you are asking if that page is contradicting itself, then you have to provide more details about where on the page it is doing so in your opinion. On 10/07/2012 10:12 PM, Pedro Larroy wrote: You are right, but doesn't this way to encode riverbanks contradict the definition of multipolygon relation? Pedro. On Sun, Oct 7, 2012 at 10:07 PM, Cartinus carti...@xs4all.nl wrote: On 10/07/2012 09:59 PM, Pedro Larroy wrote: I'm processing multipolygon relations and finding a lot of unclosed ways while processing spain. The wiki says ways in multipolygon relations are closed. http://wiki.openstreetmap.org/wiki/Relation:multipolygon That page doesn't say the ways have to be closed. Look at figures 3, 5 and 6. -- --- m.v.g., Cartinus ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] multipolygon relation and non-closed ways
On 10/07/2012 10:39 PM, Pedro Larroy wrote: The point I wanted to make ... contradicts the definition of multipolygon relation http://wiki.openstreetmap.org/wiki/Relation:multipolygon which says that member ways are closed. That is a page with a lot of text. I already pointed out where on the page it says that the ways don't have to be closed. Namely figures 3, 5 and 6, plus the text next to them. Now please tell use _where_ on that page you think it contradicts that. -- --- m.v.g., Cartinus ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] multipolygon relation and non-closed ways
2012/10/7 Pedro Larroy pedro.larroy.li...@gmail.com: Looks like multipolygon relations can be more complex that what I was assuming. I will fix my code. Looking carefully I see that there is no contradiction. I was assuming member ways had to be closed. don't know in which language you are coding but there is the Osmium framework which does multipolygon processing out of the box: http://wiki.openstreetmap.org/wiki/Osmium cheers, Martin ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev