Re: [gdal-dev] S57 dataset boundary issue

2012-10-11 Thread s duclos
Nikhil,



>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)

OGR is modelled on the OpenGIS simple features data model,

http://www.gdal.org/ogr/ogr_arch.html

In this model there is no notion of edge like in S-57

You did use the OGR internal representation using RETURN_LINKAGES=ON
But that is for debugging .. it's not part of OGR official interface as I can 
see.

But RETURN_LINKAGES=ON give you a fighting chance if you need to find edge
and also to will need to hack the source code of OGR as it limit the output to 
80 char.



rgds,

Sylvain.




>
> From: Nikhil Sai Parupalli 
>To: s duclos  
>Cc: "gdal-dev@lists.osgeo.org"  
>Sent: Thursday, October 11, 2012 1:26:47 AM
>Subject: RE: [gdal-dev] S57 dataset boundary issue
> 
>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 
>> To: s duclos ; Frank Warmerdam 
>> 
>> Cc: "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 
>>>  To: s duclos ; Frank Warmerdam
>> 
>>>  Cc: "gdal-dev@lists.osgeo.org" 
>>>  Sent: Wednesday, October 10, 2012 9:40:54 AM
>>>  Subject: RE: [gdal-dev] S57 dataset boundary issue
>>>
>&g

Re: [gdal-dev] S57 dataset boundary issue

2012-10-10 Thread Nikhil Sai Parupalli
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:


guintnRingCount = 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 
> To: s duclos ; Frank Warmerdam 
> Cc: "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 
>>  To: s duclos ; Frank Warmerdam
> 
>>  Cc: "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
> 
>>>   To: s duclos ; Frank Warmerdam
>>  
>>>   Cc: "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
>

Re: [gdal-dev] S57 dataset boundary issue

2012-10-10 Thread s duclos
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 
> To: s duclos ; Frank Warmerdam 
> Cc: "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 
>>  To: s duclos ; Frank Warmerdam 
> 
>>  Cc: "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 
> 
>>>   To: s duclos ; Frank Warmerdam
>>  
>>>   Cc: "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);
>>>                             

Re: [gdal-dev] S57 dataset boundary issue

2012-10-10 Thread Nikhil Sai Parupalli
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 
> To: s duclos ; Frank Warmerdam 
> Cc: "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 
>>  To: s duclos ; Frank Warmerdam
> 
>>  Cc: "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>  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 

Re: [gdal-dev] S57 dataset boundary issue

2012-10-10 Thread s duclos
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 
> To: s duclos ; Frank Warmerdam 
> Cc: "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 
>>  To: s duclos ; Frank Warmerdam 
> 
>>  Cc: "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>                      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 ..
>> 

Re: [gdal-dev] S57 dataset boundary issue

2012-10-10 Thread s duclos
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 
> To: s duclos ; Frank Warmerdam 
> Cc: "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                     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 
>> To: Nikhil Sai Parupalli 
>> Cc: "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 
>  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 identi

Re: [gdal-dev] S57 dataset boundary issue

2012-10-09 Thread s duclos
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 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 
>To: Nikhil Sai Parupalli  
>Cc: "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 
> 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


Re: [gdal-dev] S57 dataset boundary issue

2012-10-09 Thread Frank Warmerdam
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] S57 dataset boundary issue

2012-10-08 Thread Nikhil Sai Parupalli
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 don't know why you don't see it.  I see it fine on the "Edge"
layer which contains the linestring vector objects.

eg.

  OGRFeature(Edge):18
   RCNM (Integer) = 130
   RCID (Integer) = 19
   RVER (Integer) = 1
   RUIN (Integer) = 1
   NAME_RCNM_0 (Integer) = 120
   NAME_RCID_0 (Integer) = 21
   ORNT_0 (Integer) = 255
   USAG_0 (Integer) = 255
   TOPI_0 (Integer) = 1
   MASK_0 (Integer) = 255
   NAME_RCNM_1 (Integer) = 120
   NAME_RCID_1 (Integer) = 20
   ORNT_1 (Integer) = 255
   USAG_1 (Integer) = 255
   TOPI_1 (Integer) = 2
   MASK_1 (Integer) = 255
   LINESTRING (60.775 -32.6249972)

> I have one more question:
> How do we find  area outer boundaries are encoded clockwise based
> on Orientation or USAG.
> here when I retrieve S57 dataset I get multiple ORNT values for a single 
> object.

I am not aware of any definition of outer ring winding direction.
I think the ORNT field values you see on polygons are indicating
which direction the edges were used in when composing the ring(s)
of the polygon.


   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)

So in the above feature, RCID 691 is used with orientation "2",
usage "1" and mask "255".

Best regards,





Thanks and Regards
Nikhil Sai Parupalli



Note: Do not print this email until and unless it is really required. Save 
paper , stay Green
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev