Hey Sylvain, Thanks for your inputs, we have successfully implemented the same in our project . I have one more question i.e If I have a polygon how to find out edges of it programmatic do we have any function to get all the edges of polygon(area)
Thanks and Regards Nikhil Sai Parupalli Note: Do not print this email until and unless it is really required. Save paper , stay Green ________________________________________ From: Nikhil Sai Parupalli Sent: Wednesday, October 10, 2012 9:07 PM To: s duclos Subject: RE: [gdal-dev] S57 dataset boundary issue Thanks and Regards Nikhil Sai Parupalli Note: Do not print this email until and unless it is really required. Save paper , stay Green ________________________________________ From: s duclos [sylvain_duc...@yahoo.com] Sent: Wednesday, October 10, 2012 8:43 PM To: Nikhil Sai Parupalli; Frank Warmerdam Cc: gdal-dev@lists.osgeo.org Subject: Re: [gdal-dev] S57 dataset boundary issue Hi Nikhil, > Based on the code which you have sent we could find out CW and CCW, but not > outer/inner The outer ring of OGRGeometryH poly is the ring 0 (zero). In C code the OGR call: guint nRingCount = OGR_G_GetGeometryCount(hGeom); will give you the number of rings in a poly. Say there is 2 rings for this hGeom. Then the outer ring is OGRGeometryH *hGeomRef_outter = OGR_G_GetGeometryRef(hGeom, 0); and the inner ring is OGRGeometryH *hGeomRef_inner = OGR_G_GetGeometryRef(hGeom, 1); > Please have a look at that data set once and let me know. There is nothing in attachment rgds, Sylvain. ----- Original Message ----- > From: Nikhil Sai Parupalli <nikhil.parupa...@iictechnologies.com> > To: s duclos <sylvain_duc...@yahoo.com>; Frank Warmerdam <warmer...@pobox.com> > Cc: "gdal-dev@lists.osgeo.org" <gdal-dev@lists.osgeo.org> > Sent: Wednesday, October 10, 2012 10:40:27 AM > Subject: RE: [gdal-dev] S57 dataset boundary issue > > Hey Sylvain, > > Thanks for trying the data which I have sent. > > Could you be helping me how this works like outer boundary and inner boundary. > > > > Based on the code which you have sent we could find out CW and CCW, but not > outer/inner > Please have a look at that data set once and let me know. > Or if you have any sample data with simple representation of outer and inner > boundaries please do share with me. > > > > > Thanks and Regards > Nikhil Sai Parupalli > > > > Note: Do not print this email until and unless it is really required. Save > paper > , stay Green > > ________________________________________ > From: s duclos [sylvain_duc...@yahoo.com] > Sent: Wednesday, October 10, 2012 7:59 PM > To: Nikhil Sai Parupalli; Frank Warmerdam > Cc: gdal-dev@lists.osgeo.org > Subject: Re: [gdal-dev] S57 dataset boundary issue > > Hi Nikhil, > > I loaded US1GC09M//US1GC09M.000 .. it's huge :) > > It's the Gulf of Mexico .. now where should I look ? > > > > About the inner / outer ring. As I said before, I just assume that OGR > send me the outer ring first. And, up to now, my code is working fine. > > > rgds, > > Sylvain. > > > > > ----- Original Message ----- >> From: Nikhil Sai Parupalli <nikhil.parupa...@iictechnologies.com> >> To: s duclos <sylvain_duc...@yahoo.com>; Frank Warmerdam > <warmer...@pobox.com> >> Cc: "gdal-dev@lists.osgeo.org" <gdal-dev@lists.osgeo.org> >> Sent: Wednesday, October 10, 2012 9:40:54 AM >> Subject: RE: [gdal-dev] S57 dataset boundary issue >> >> Could you try on this data set please >> >> Thanks and Regards >> Nikhil Sai Parupalli >> >> >> >> Note: Do not print this email until and unless it is really required. Save > paper >> , stay Green >> >> ________________________________________ >> From: s duclos [sylvain_duc...@yahoo.com] >> Sent: Wednesday, October 10, 2012 7:02 PM >> To: Nikhil Sai Parupalli; Frank Warmerdam >> Cc: gdal-dev@lists.osgeo.org >> Subject: Re: [gdal-dev] S57 dataset boundary issue >> >> Nikhil, >> >> I loaded your ENC. >> >> I see a number of depth area (DEPARE) and anchor zone area (ACHARE). >> >> But no inner ring! >> >> Is there an inner rings somewhere I should see? >> >> >> >> rgds, >> >> Sylvain. >> >> >> >> ----- Original Message ----- >>> From: Nikhil Sai Parupalli > <nikhil.parupa...@iictechnologies.com> >>> To: s duclos <sylvain_duc...@yahoo.com>; Frank Warmerdam >> <warmer...@pobox.com> >>> Cc: "gdal-dev@lists.osgeo.org" > <gdal-dev@lists.osgeo.org> >>> Sent: Wednesday, October 10, 2012 8:00:41 AM >>> Subject: RE: [gdal-dev] S57 dataset boundary issue >>> >>> Duclos, >>> >>> Please see this sample data attached. >>> So as per the code given by you we have tried and got result i.e able > to >> find >>> out area >>> >>> some times it shows area<0 and some times area>0 hence we get > CW and >> CCW. >>> But how do we classify in layer which is outer boundary and which is > inner >>> boundary >>> >>> >>> >>> >>> Geometry testgeo = geomLAKARE.GetBoundary(); >>> double area = 0; >>> for (int l = 0; l < >>> testgeo.GetPointCount() - 1; l++) >>> { >>> double x1 = testgeo.GetX(l); >>> double y1 = testgeo.GetY(l); >>> double x2 = testgeo.GetX(l + > 1); >>> double y2 = testgeo.GetY(l + > 1); >>> area += (x1 * y2) - (x2 * y1); >>> } >>> >>> Thanks and Regards >>> Nikhil Sai Parupalli >>> >>> >>> >>> Note: Do not print this email until and unless it is really required. > Save >> paper >>> , stay Green >>> >>> ________________________________________ >>> From: s duclos [sylvain_duc...@yahoo.com] >>> Sent: Tuesday, October 09, 2012 11:58 PM >>> To: Frank Warmerdam; Nikhil Sai Parupalli >>> Cc: gdal-dev@lists.osgeo.org >>> Subject: Re: [gdal-dev] S57 dataset boundary issue >>> >>> Frank & Nikhil, >>> >>> >>> Frank asked: >>> >>>> are, I'm not sure what I or others can do about >>>> the performance cost of checking. >>> >>> >>> If I understand the problem, then it cost nothing! >>> >>> You have to check the winding while loading a OGRGeometryH >>> like so: >>> double area = 0; >>> for (unsigned int i=0; i<vert_count-1; i++) { >>> double x1 = OGR_G_GetX(hRing, i); >>> double y1 = OGR_G_GetY(hRing, i); >>> double x2 = OGR_G_GetX(hRing, i+1); >>> double y2 = OGR_G_GetY(hRing, i+1); >>> area += (x1*y2) - (x2*y1); >>> } >>> >>> >>> If the area < 0 then it is CW (clockwise) and > 0 is CCW > (Counter >> CW). >>> >>> Note that in S57 the exterior ring must be CW and >>> interior ring are CCW. >>> >>> But in S57 there is no order between rings. So interior ring >>> might come first. I think WKT fix this. In my code I assume >>> that OGR place the exterior ring first. >>> >>> >>> We have been trough this before. At the time the question >>> >>> was if S57 allow for many exterior ring for the same poly. >>> >>> I guess it all depend on HO and how they encode the data. >>> >>> I'm using mostly Canadian ENC and found no problem. >>> >>> But other HO might encode ENC differently .. >>> >>> >>> >>> >>> rdgs, >>> >>> >>> Sylvain Duclos. >>> >>> >>> >>> >>> >>> >>> >>>> ________________________________ >>>> From: Frank Warmerdam <warmer...@pobox.com> >>>> To: Nikhil Sai Parupalli > <nikhil.parupa...@iictechnologies.com> >>>> Cc: "gdal-dev@lists.osgeo.org" >> <gdal-dev@lists.osgeo.org> >>>> Sent: Tuesday, October 9, 2012 12:25:29 PM >>>> Subject: Re: [gdal-dev] S57 dataset boundary issue >>>> >>>> >>>> >>>> >>>> >>>> On Mon, Oct 8, 2012 at 10:28 PM, Nikhil Sai Parupalli >>> <nikhil.parupa...@iictechnologies.com> wrote: >>>> >>>> HI All, >>>>> , >>>>> >>>>> Thanks for the reply in below data >>>>> >>>>> NAME_RCNM (IntegerList) = (7:130,130,130,130,130,130,130) >>>>> NAME_RCID (IntegerList) = (7:691,391,690,52,1336,1503,1512) >>>>> ORNT (IntegerList) = (7:2,2,2,2,1,1,1) >>>>> USAG (IntegerList) = (7:1,1,1,1,1,1,1) >>>>> MASK (IntegerList) = (7:255,255,255,255,255,255,255) >>>>> >>>>> RCID 691 ORNT has 2 and USAG is 1 based on this data we > could >> identify >>> that RCID 691 is of exterior boundary with reverse direction. >>>>> >>>>> So if I have 1000 RCID in NAME_RCID which is vise versa for > the >> above >>> condition I need to display that RCIDS list as errors. >>>>> So it makes 1000 conditional checks hence reducing > performance. >>>>> >>>>> Please let us know further. >>>> >>>> >>>> Nikhil, >>>> >>>> >>>> I'm afraid I don't follow your point. Are you trying to >>>> do some sort of ring orientation validation and identify >>>> ones that don't match your expectations? And you >>>> are concerned about the performance cost? >>>> >>>> >>>> I don't know why you are doing this, and if you >>>> are, I'm not sure what I or others can do about >>>> the performance cost of checking. >>>> >>>> >>>> Best regards,-- >>>> >> > ---------------------------------------+-------------------------------------- >>>> I set the clouds in motion - turn up | Frank Warmerdam, >>> warmer...@pobox.com >>>> light and sound - activate the windows | > http://pobox.com/~warmerdam >>>> and watch the world go round - Rush | Geospatial Software > Developer >>>> >>>> >>>> _______________________________________________ >>>> gdal-dev mailing list >>>> gdal-dev@lists.osgeo.org >>>> http://lists.osgeo.org/mailman/listinfo/gdal-dev >>>> >>>> >>> >> > _______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev