Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WFS returns incomplete geometry when inner ring touches outer ring #5299

Closed
priskahaller opened this issue Jun 30, 2016 · 13 comments
Closed
Assignees
Milestone

Comments

@priskahaller
Copy link

priskahaller commented Jun 30, 2016

Inner ring is missing in WFS GetFeature result, when geometries of inner and outer ring touch.

WKT-Geometry in PostGIS with inner ring:

MULTIPOLYGON(((676881.746 253159.65,676952.5 253142.812,676984.539
 253076.568,676992.16 253047.552,676907.575 252978.182,676793.971
 252977.057,676763.746 253101.446,676881.746 253159.65),(676881.746
 253159.65,676835.762 253108.566,676841.704 253079.649,676870.271
 253078.765,676924.143 253120.438,676881.746 253159.65)))

WFS GetFeature request returns outer ring only:

<ms:geometry>
  <gml:MultiPolygon srsName="EPSG:21781">
    <gml:polygonMember>
      <gml:Polygon>
        <gml:outerBoundaryIs>
          <gml:LinearRing>
            <gml:coordinates>
              676881.746000,253159.650000 676952.500000,253142.812000 676984.539000,253076.568000 676992.160000,253047.552000 676907.575000,252978.182000 676793.971000,252977.057000 676763.746000,253101.446000 676881.746000,253159.650000 
            </gml:coordinates>
          </gml:LinearRing>
        </gml:outerBoundaryIs>
      </gml:Polygon>
    </gml:polygonMember>
  </gml:MultiPolygon>
</ms:geometry>

Mapserver Version: 6.4.2
PostGIS Version: 2.2.2 r14797

@priskahaller
Copy link
Author

Has anyone encountered this problem and know how to fix it?

@aperi2007
Copy link

Perhaps a geometry from an shapefile created using arcgis ?
There is an incompatibilità between the arcgis shapefile and the ogc
software.
When the hole touch the outer ring.

I suspect the issue is with the arcgis shapefile.

Andrea.
Il 07 lug 2016 14:18, "priskahaller" notifications@github.com ha scritto:

Has anyone encountered this problem and know how to fix it?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#5299 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ACCabAfjuPaK5z9B-dyfjlClZqtjWd1Pks5qTO6ygaJpZM4JCQ3q
.

@rouault
Copy link
Contributor

rouault commented Jul 7, 2016

Found in http://toblerity.org/shapely/manual.html, an inner ring touching the outer ring at at most one point is OK, and ST_IsValid() on this geometry confirms it. So I guess that the msGetInnerList() function used to distinguish inner from outer rings should be improved to deal with that use case. Currently it must work only for inner rings that are strictly inside the outer ring

@aperi2007
Copy link

aperi2007 commented Jul 7, 2016

It is ok, but is definited differently is the shapefile come from an esri product or from a OGC product.

Infact for esri this kind of situation is resolved defining in the geometry of the feature (in the shapefile) a self-intersecting external ring.
Instead in a shapefile from an OGC product (like qgis) it is resolved defning in the structure of geometry an hole in touch with the external ring.

Something is explained in this command of postgis (see the "esri flag").

http://postgis.net/docs/manual-2.2/ST_IsValidDetail.html

Consider self-intersecting rings forming holes as valid. This is also know as "the ESRI flag". Note that this is against the OGC model.

@priskahaller
Copy link
Author

Thank you for your answers.
In this particular case there's no esri software involved, the geometry was imported to PostGIS by FME from Oracle Spatial and it is valid either way (ST_IsValidDetail() returns (t,,) with or wihout esri flag).
Oracle geom.get_wkt() returns a compoundcurve:
CURVEPOLYGON (COMPOUNDCURVE ((676992.16 253047.552, 676984.539 253076.568, 676952.5 253142.812, 676881.746 253159.65, 676924.143 253120.438, 676870.271 253078.765, 676841.704 253079.649, 676835.762 253108.566, 676881.746 253159.65, 676763.746 253101.446, 676793.971 252977.057, 676907.575 252978.182, 676992.16 253047.552)))

@priskahaller
Copy link
Author

Has anyone an idea how to fix it?

@aperi2007
Copy link

Have you tried an

Update table set geometry=st_makevalid(geometry) where
st_isvalid(geometry)=false;

?

Il 29 ago 2016 9:58 AM, "priskahaller" notifications@github.com ha
scritto:

Has anyone an idea how to fix it?


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#5299 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACCabJhz3b5knTxA_8Ns1N-MyCW6y5ylks5qkpEygaJpZM4JCQ3q
.

@nischmi1
Copy link

It seems (from looking at msGetInnerList()) that everything that is not an outer ring will be an inner ring. There is no test procedure for inner rings. But the test procedure for outer rings msIsOuterRing() is probably not suitable to distinguish the special case which causes problems here.
I am pretty conviced that the problem lies in the code and not in the data, as @aperi2007 suggests... while I think I can see the problem, I have no idea as to what the solution would be.

@priskahaller
Copy link
Author

@aperi2007: All geometries are valid

@rouault rouault self-assigned this Sep 8, 2016
rouault added a commit to rouault/mapserver that referenced this issue Sep 8, 2016
MapServer#5299)

Currently the behaviour was undefined if the first point of the inner
ring touched its outer ring.
rouault added a commit to rouault/mapserver that referenced this issue Sep 8, 2016
MapServer#5299)

Currently the behaviour was undefined if the first point of the inner
ring touched its outer ring.
@rouault rouault added this to the 7.0.2 Release milestone Sep 8, 2016
@rouault
Copy link
Contributor

rouault commented Sep 8, 2016

Fixed in branch-7-0 and in master

@rouault rouault closed this as completed Sep 8, 2016
@priskahaller
Copy link
Author

Great, thank you!

@priskahaller
Copy link
Author

@rouault: When is the next mapserver package release (that incudes this bug fix) planned?

@rouault
Copy link
Contributor

rouault commented Sep 19, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants