Re: [Qgis-user] How to determine the inner surface on a sphere or ellipsoid

2020-06-18 Thread Tudorache, Marian
I think I found a solution for this problem.
Instead of do the analysis over the entire polygon on the surface, I will do it 
over the three consecutive points from polygon vertices not colinear and the 
middle point is either most East, South, West or North.
detO = (bPoint.x() - aPoint.x()) * (cPoint.y() - aPoint.y()) - (cPoint.x() - 
aPoint.x()) * (bPoint.y() - aPoint.y())
The sign of the determinant will tell me the direction of the three points 
which coincides with the direction of the polygon.
In this way I can force the orientation of the polygon to match the one 
required by Intermaphics.

Thanks,
marian

-Original Message-
From: Nyall Dawson 
Sent: Tuesday, June 16, 2020 6:21 PM
To: Richard Duivenvoorde 
Cc: Tudorache, Marian ; qgis-user@lists.osgeo.org
Subject: [EXT] Re: [Qgis-user] How to determine the inner surface on a sphere 
or ellipsoid

On Wed, 17 Jun 2020 at 02:10, Richard Duivenvoorde  wrote:
>
> On 6/16/20 4:17 PM, Tudorache, Marian wrote:
> > Hi everyone,
> >
> > I have a list of polygons given by a list of points.
> > The polygons are properly drawn on QGIS canvas by creating the geometries, 
> > the each geometry is used to create a Qgsfeature which are saved on a 
> > shapefile.
> > The problem appears in detecting if a point on the Earth is inside or 
> > outside the polygon.
> > Using pyqgis QgsGeometry intersects function returns proper value.
> > However when I export the polygon to intermaphics from Kongsberg Geospatial 
> > (former Gallium) sometime the point is inside other time is outside the 
> > polygon.
> > I tried to switch the order of the points is QGIS ,but the intersects 
> > function always give me the same result regardless of the order of the 
> > points.
> > In intermaphics the intersection between a polygon and a point varies with 
> > the order of the points which define a polygon.
> > I talked to people from gallium and they confirmed the order of the points 
> > is important.
> > In one direction a inner area of the polygon is the small surface and if I 
> > switch the order the inner area is the outside and it wraps the Earth on 
> > the opposite side.
> >
> > Does QGIS or pyqgis has a similar mechanism to determine which is the inner 
> > part of the polygon on a sphere or ellipsoid?
>
> Hi Marian,
>
> are'nt we here talking about the so called Right Hand Rule?

That's just a convention -- it doesn't change what the boundary actually 
represents.

If you want to do analysis based on points which fall outside a digitized 
polygon, you should use a "disjoint" relationship. The alternative is to do 
what Nicolas suggested and make a polygon which covers the globe minus a small 
hole, but you'll get terrible performance with any analysis using that 
approach...!

Nyall



This electronic message, as well as any transmitted files included in the 
electronic message, may contain privileged or confidential information and is 
intended solely for the use of the individual(s) or entity to which it is 
addressed. If you have received this electronic message in error please notify 
the sender immediately and delete the electronic message. Any unauthorized 
copying, disclosure or distribution of the electronic message is strictly 
forbidden. NAV CANADA accepts no liability for any damage caused by any virus 
and/or other malicious code transmitted by this electronic communication.

Le présent message électronique et tout fichier qui peut y être joint peuvent 
contenir des renseignements privilégiés ou confidentiels destinés à l’usage 
exclusif des personnes ou des organismes à qui ils s’adressent. Si vous avez 
reçu ce message électronique par erreur, veuillez en informer l’expéditeur 
immédiatement et supprimez le. Toute reproduction, divulgation ou distribution 
du présent message électronique est strictement interdite. NAV CANADA n’assume 
aucune responsabilité en cas de dommage causé par tout virus ou autre programme 
malveillant transmis par ce message électronique.
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Re: [Qgis-user] How to determine the inner surface on a sphere or ellipsoid

2020-06-17 Thread Nyall Dawson
On Wed, 17 Jun 2020 at 20:27, Nicolas Cadieux
 wrote:
>
> Hi Nyall,
>
> Just out of curiosity, would a very large polygon slow down a spatial query 
> or would just a complex one?

That's an open question. It depends on lots of different factors,
including crucially what you're comparing the large polygon against.
But a general answer would be "yes": a large but simple polygon does
have the potential to result in a worse query vs a smaller polygon
using a disjoint relationship.

> My testing with using shapefiles to reclassify LiDAR data did show that 
> things could be sped up by splitting large polygons with a smaller grid but I 
> had attributed this to the complexity of the polygons and not the size.  Was 
> this a wrong assumptions?

I think in general you'll find that polygon complexity is a much more
significant factor vs the actual size, so your conclusion is fine. (My
hint: using the QGIS Processing "subdivide" or PostGIS' st_subdivide
tools are perfect to help in this situation)

Nyall



>
> Nicolas Cadieux
> Ça va bien aller!
>
> > Le 16 juin 2020 à 18:21, Nyall Dawson  a écrit :
> >
> > On Wed, 17 Jun 2020 at 02:10, Richard Duivenvoorde  
> > wrote:
> >>
> >>> On 6/16/20 4:17 PM, Tudorache, Marian wrote:
> >>> Hi everyone,
> >>>
> >>> I have a list of polygons given by a list of points.
> >>> The polygons are properly drawn on QGIS canvas by creating the 
> >>> geometries, the each geometry is used to create a Qgsfeature which are 
> >>> saved on a shapefile.
> >>> The problem appears in detecting if a point on the Earth is inside or 
> >>> outside the polygon.
> >>> Using pyqgis QgsGeometry intersects function returns proper value.
> >>> However when I export the polygon to intermaphics from Kongsberg 
> >>> Geospatial (former Gallium) sometime the point is inside other time is 
> >>> outside the polygon.
> >>> I tried to switch the order of the points is QGIS ,but the intersects 
> >>> function always give me the same result regardless of the order of the 
> >>> points.
> >>> In intermaphics the intersection between a polygon and a point varies 
> >>> with the order of the points which define a polygon.
> >>> I talked to people from gallium and they confirmed the order of the 
> >>> points is important.
> >>> In one direction a inner area of the polygon is the small surface and if 
> >>> I switch the order the inner area is the outside and it wraps the Earth 
> >>> on the opposite side.
> >>>
> >>> Does QGIS or pyqgis has a similar mechanism to determine which is the 
> >>> inner part of the polygon on a sphere or ellipsoid?
> >>
> >> Hi Marian,
> >>
> >> are'nt we here talking about the so called Right Hand Rule?
> >
> > That's just a convention -- it doesn't change what the boundary
> > actually represents.
> >
> > If you want to do analysis based on points which fall outside a
> > digitized polygon, you should use a "disjoint" relationship. The
> > alternative is to do what Nicolas suggested and make a polygon which
> > covers the globe minus a small hole, but you'll get terrible
> > performance with any analysis using that approach...!
> >
> > Nyall
> > ___
> > Qgis-user mailing list
> > Qgis-user@lists.osgeo.org
> > List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Re: [Qgis-user] How to determine the inner surface on a sphere or ellipsoid

2020-06-17 Thread Nicolas Cadieux
Hi Nyall,

Just out of curiosity, would a very large polygon slow down a spatial query or 
would just a complex one? My testing with using shapefiles to reclassify LiDAR 
data did show that things could be sped up by splitting large polygons with a 
smaller grid but I had attributed this to the complexity of the polygons and 
not the size.  Was this a wrong assumptions?

Nicolas Cadieux
Ça va bien aller!

> Le 16 juin 2020 à 18:21, Nyall Dawson  a écrit :
> 
> On Wed, 17 Jun 2020 at 02:10, Richard Duivenvoorde  
> wrote:
>> 
>>> On 6/16/20 4:17 PM, Tudorache, Marian wrote:
>>> Hi everyone,
>>> 
>>> I have a list of polygons given by a list of points.
>>> The polygons are properly drawn on QGIS canvas by creating the geometries, 
>>> the each geometry is used to create a Qgsfeature which are saved on a 
>>> shapefile.
>>> The problem appears in detecting if a point on the Earth is inside or 
>>> outside the polygon.
>>> Using pyqgis QgsGeometry intersects function returns proper value.
>>> However when I export the polygon to intermaphics from Kongsberg Geospatial 
>>> (former Gallium) sometime the point is inside other time is outside the 
>>> polygon.
>>> I tried to switch the order of the points is QGIS ,but the intersects 
>>> function always give me the same result regardless of the order of the 
>>> points.
>>> In intermaphics the intersection between a polygon and a point varies with 
>>> the order of the points which define a polygon.
>>> I talked to people from gallium and they confirmed the order of the points 
>>> is important.
>>> In one direction a inner area of the polygon is the small surface and if I 
>>> switch the order the inner area is the outside and it wraps the Earth on 
>>> the opposite side.
>>> 
>>> Does QGIS or pyqgis has a similar mechanism to determine which is the inner 
>>> part of the polygon on a sphere or ellipsoid?
>> 
>> Hi Marian,
>> 
>> are'nt we here talking about the so called Right Hand Rule?
> 
> That's just a convention -- it doesn't change what the boundary
> actually represents.
> 
> If you want to do analysis based on points which fall outside a
> digitized polygon, you should use a "disjoint" relationship. The
> alternative is to do what Nicolas suggested and make a polygon which
> covers the globe minus a small hole, but you'll get terrible
> performance with any analysis using that approach...!
> 
> Nyall
> ___
> Qgis-user mailing list
> Qgis-user@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Re: [Qgis-user] How to determine the inner surface on a sphere or ellipsoid

2020-06-16 Thread Nyall Dawson
On Wed, 17 Jun 2020 at 02:10, Richard Duivenvoorde  wrote:
>
> On 6/16/20 4:17 PM, Tudorache, Marian wrote:
> > Hi everyone,
> >
> > I have a list of polygons given by a list of points.
> > The polygons are properly drawn on QGIS canvas by creating the geometries, 
> > the each geometry is used to create a Qgsfeature which are saved on a 
> > shapefile.
> > The problem appears in detecting if a point on the Earth is inside or 
> > outside the polygon.
> > Using pyqgis QgsGeometry intersects function returns proper value.
> > However when I export the polygon to intermaphics from Kongsberg Geospatial 
> > (former Gallium) sometime the point is inside other time is outside the 
> > polygon.
> > I tried to switch the order of the points is QGIS ,but the intersects 
> > function always give me the same result regardless of the order of the 
> > points.
> > In intermaphics the intersection between a polygon and a point varies with 
> > the order of the points which define a polygon.
> > I talked to people from gallium and they confirmed the order of the points 
> > is important.
> > In one direction a inner area of the polygon is the small surface and if I 
> > switch the order the inner area is the outside and it wraps the Earth on 
> > the opposite side.
> >
> > Does QGIS or pyqgis has a similar mechanism to determine which is the inner 
> > part of the polygon on a sphere or ellipsoid?
>
> Hi Marian,
>
> are'nt we here talking about the so called Right Hand Rule?

That's just a convention -- it doesn't change what the boundary
actually represents.

If you want to do analysis based on points which fall outside a
digitized polygon, you should use a "disjoint" relationship. The
alternative is to do what Nicolas suggested and make a polygon which
covers the globe minus a small hole, but you'll get terrible
performance with any analysis using that approach...!

Nyall
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Re: [Qgis-user] How to determine the inner surface on a sphere or ellipsoid

2020-06-16 Thread Richard Duivenvoorde
On 6/16/20 6:29 PM, Tudorache, Marian wrote:
> This might help, however  I forgot to mention that I am using QGIS 2.18.
> The QgsGeometry Class that you sent me is for QGIS 3.
> 
> Do you know something similar on QGIS 2.18?

Hi Marian,

Not that I could quickly find.

But please, please upgrade to at least 3.10 :-)

Else: maybe you can install a local Postgis database and do this in the
database?

Regards,

Richard Duivenvoorde
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Re: [Qgis-user] How to determine the inner surface on a sphere or ellipsoid

2020-06-16 Thread Tudorache, Marian
This might help, however  I forgot to mention that I am using QGIS 2.18.
The QgsGeometry Class that you sent me is for QGIS 3.

Do you know something similar on QGIS 2.18?

Thanks,
Marian

-Original Message-
From: Richard Duivenvoorde 
Sent: Tuesday, June 16, 2020 12:10 PM
To: Tudorache, Marian ; qgis-user@lists.osgeo.org
Subject: [EXT] Re: [Qgis-user] How to determine the inner surface on a sphere 
or ellipsoid

On 6/16/20 4:17 PM, Tudorache, Marian wrote:
> Hi everyone,
>
> I have a list of polygons given by a list of points.
> The polygons are properly drawn on QGIS canvas by creating the geometries, 
> the each geometry is used to create a Qgsfeature which are saved on a 
> shapefile.
> The problem appears in detecting if a point on the Earth is inside or outside 
> the polygon.
> Using pyqgis QgsGeometry intersects function returns proper value.
> However when I export the polygon to intermaphics from Kongsberg Geospatial 
> (former Gallium) sometime the point is inside other time is outside the 
> polygon.
> I tried to switch the order of the points is QGIS ,but the intersects 
> function always give me the same result regardless of the order of the points.
> In intermaphics the intersection between a polygon and a point varies with 
> the order of the points which define a polygon.
> I talked to people from gallium and they confirmed the order of the points is 
> important.
> In one direction a inner area of the polygon is the small surface and if I 
> switch the order the inner area is the outside and it wraps the Earth on the 
> opposite side.
>
> Does QGIS or pyqgis has a similar mechanism to determine which is the inner 
> part of the polygon on a sphere or ellipsoid?

Hi Marian,

are'nt we here talking about the so called Right Hand Rule?

https://urldefense.com/v3/__https://postgis.net/docs/ST_ForceRHR.html__;!!P0kg3YazkQ!SxE0ZFgaBrgWRAqxjyrcC27wO_4FSfOZJ6YSW3RdPYb1VIj6V3RbX2nWprVt5PDgB1KFJfl8$
says:

In particular, the exterior ring is orientated in a clockwise direction and the 
interior rings in a counter-clockwise direction.

QGIS has this also:

https://urldefense.com/v3/__https://github.com/qgis/QGIS/blob/master/src/core/geometry/qgsgeometry.cpp*L2651__;Iw!!P0kg3YazkQ!SxE0ZFgaBrgWRAqxjyrcC27wO_4FSfOZJ6YSW3RdPYb1VIj6V3RbX2nWprVt5PDgB0hgkj92$

With pyqgis you can als use forceRHR:

https://urldefense.com/v3/__https://qgis.org/pyqgis/3.12/core/QgsGeometry.html?highlight=qgsgeometry*qgis.core.QgsGeometry.forceRHR__;Iw!!P0kg3YazkQ!SxE0ZFgaBrgWRAqxjyrcC27wO_4FSfOZJ6YSW3RdPYb1VIj6V3RbX2nWprVt5PDgBwHQeTsL$

I do know that QGIS is not so good when a geometry crosses the world-dateline 
though... but I do not think that is your case is it?

Or do I misunderstand you question?

Regards,

Richard Duivenvoorde









This electronic message, as well as any transmitted files included in the 
electronic message, may contain privileged or confidential information and is 
intended solely for the use of the individual(s) or entity to which it is 
addressed. If you have received this electronic message in error please notify 
the sender immediately and delete the electronic message. Any unauthorized 
copying, disclosure or distribution of the electronic message is strictly 
forbidden. NAV CANADA accepts no liability for any damage caused by any virus 
and/or other malicious code transmitted by this electronic communication.

Le présent message électronique et tout fichier qui peut y être joint peuvent 
contenir des renseignements privilégiés ou confidentiels destinés à l’usage 
exclusif des personnes ou des organismes à qui ils s’adressent. Si vous avez 
reçu ce message électronique par erreur, veuillez en informer l’expéditeur 
immédiatement et supprimez le. Toute reproduction, divulgation ou distribution 
du présent message électronique est strictement interdite. NAV CANADA n’assume 
aucune responsabilité en cas de dommage causé par tout virus ou autre programme 
malveillant transmis par ce message électronique.
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Re: [Qgis-user] How to determine the inner surface on a sphere or ellipsoid

2020-06-16 Thread Richard Duivenvoorde
On 6/16/20 4:17 PM, Tudorache, Marian wrote:
> Hi everyone,
> 
> I have a list of polygons given by a list of points.
> The polygons are properly drawn on QGIS canvas by creating the geometries, 
> the each geometry is used to create a Qgsfeature which are saved on a 
> shapefile.
> The problem appears in detecting if a point on the Earth is inside or outside 
> the polygon.
> Using pyqgis QgsGeometry intersects function returns proper value.
> However when I export the polygon to intermaphics from Kongsberg Geospatial 
> (former Gallium) sometime the point is inside other time is outside the 
> polygon.
> I tried to switch the order of the points is QGIS ,but the intersects 
> function always give me the same result regardless of the order of the points.
> In intermaphics the intersection between a polygon and a point varies with 
> the order of the points which define a polygon.
> I talked to people from gallium and they confirmed the order of the points is 
> important.
> In one direction a inner area of the polygon is the small surface and if I 
> switch the order the inner area is the outside and it wraps the Earth on the 
> opposite side.
> 
> Does QGIS or pyqgis has a similar mechanism to determine which is the inner 
> part of the polygon on a sphere or ellipsoid?

Hi Marian,

are'nt we here talking about the so called Right Hand Rule?

https://postgis.net/docs/ST_ForceRHR.html
says:

In particular, the exterior ring is orientated in a clockwise direction
and the interior rings in a counter-clockwise direction.

QGIS has this also:

https://github.com/qgis/QGIS/blob/master/src/core/geometry/qgsgeometry.cpp#L2651

With pyqgis you can als use forceRHR:

https://qgis.org/pyqgis/3.12/core/QgsGeometry.html?highlight=qgsgeometry#qgis.core.QgsGeometry.forceRHR

I do know that QGIS is not so good when a geometry crosses the
world-dateline though... but I do not think that is your case is it?

Or do I misunderstand you question?

Regards,

Richard Duivenvoorde






___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Re: [Qgis-user] How to determine the inner surface on a sphere or ellipsoid

2020-06-16 Thread Nicolas Cadieux
Hi,

To my knowledge no.  The second option would be a polygone that covers the 
earth but that has a hole in it.  That is the Generally accepted topology in 
GIS.  

Nicolas Cadieux
Ça va bien aller!

> Le 16 juin 2020 à 10:28, Tudorache, Marian  a 
> écrit :
> 
> Hi everyone,
> 
> I have a list of polygons given by a list of points.
> The polygons are properly drawn on QGIS canvas by creating the geometries, 
> the each geometry is used to create a Qgsfeature which are saved on a 
> shapefile.
> The problem appears in detecting if a point on the Earth is inside or outside 
> the polygon.
> Using pyqgis QgsGeometry intersects function returns proper value.
> However when I export the polygon to intermaphics from Kongsberg Geospatial 
> (former Gallium) sometime the point is inside other time is outside the 
> polygon.
> I tried to switch the order of the points is QGIS ,but the intersects 
> function always give me the same result regardless of the order of the points.
> In intermaphics the intersection between a polygon and a point varies with 
> the order of the points which define a polygon.
> I talked to people from gallium and they confirmed the order of the points is 
> important.
> In one direction a inner area of the polygon is the small surface and if I 
> switch the order the inner area is the outside and it wraps the Earth on the 
> opposite side.
> 
> Does QGIS or pyqgis has a similar mechanism to determine which is the inner 
> part of the polygon on a sphere or ellipsoid?
> 
> Thanks,
> Marian
> 
> 
> 
> This electronic message, as well as any transmitted files included in the 
> electronic message, may contain privileged or confidential information and is 
> intended solely for the use of the individual(s) or entity to which it is 
> addressed. If you have received this electronic message in error please 
> notify the sender immediately and delete the electronic message. Any 
> unauthorized copying, disclosure or distribution of the electronic message is 
> strictly forbidden. NAV CANADA accepts no liability for any damage caused by 
> any virus and/or other malicious code transmitted by this electronic 
> communication.
> 
> Le présent message électronique et tout fichier qui peut y être joint peuvent 
> contenir des renseignements privilégiés ou confidentiels destinés à l’usage 
> exclusif des personnes ou des organismes à qui ils s’adressent. Si vous avez 
> reçu ce message électronique par erreur, veuillez en informer l’expéditeur 
> immédiatement et supprimez le. Toute reproduction, divulgation ou 
> distribution du prése
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

[Qgis-user] How to determine the inner surface on a sphere or ellipsoid

2020-06-16 Thread Tudorache, Marian
Hi everyone,

I have a list of polygons given by a list of points.
The polygons are properly drawn on QGIS canvas by creating the geometries, the 
each geometry is used to create a Qgsfeature which are saved on a shapefile.
The problem appears in detecting if a point on the Earth is inside or outside 
the polygon.
Using pyqgis QgsGeometry intersects function returns proper value.
However when I export the polygon to intermaphics from Kongsberg Geospatial 
(former Gallium) sometime the point is inside other time is outside the polygon.
I tried to switch the order of the points is QGIS ,but the intersects function 
always give me the same result regardless of the order of the points.
In intermaphics the intersection between a polygon and a point varies with the 
order of the points which define a polygon.
I talked to people from gallium and they confirmed the order of the points is 
important.
In one direction a inner area of the polygon is the small surface and if I 
switch the order the inner area is the outside and it wraps the Earth on the 
opposite side.

Does QGIS or pyqgis has a similar mechanism to determine which is the inner 
part of the polygon on a sphere or ellipsoid?

Thanks,
Marian



This electronic message, as well as any transmitted files included in the 
electronic message, may contain privileged or confidential information and is 
intended solely for the use of the individual(s) or entity to which it is 
addressed. If you have received this electronic message in error please notify 
the sender immediately and delete the electronic message. Any unauthorized 
copying, disclosure or distribution of the electronic message is strictly 
forbidden. NAV CANADA accepts no liability for any damage caused by any virus 
and/or other malicious code transmitted by this electronic communication.

Le présent message électronique et tout fichier qui peut y être joint peuvent 
contenir des renseignements privilégiés ou confidentiels destinés à l’usage 
exclusif des personnes ou des organismes à qui ils s’adressent. Si vous avez 
reçu ce message électronique par erreur, veuillez en informer l’expéditeur 
immédiatement et supprimez le. Toute reproduction, divulgation ou distribution 
du présent message électronique est strictement interdite. NAV CANADA n’assume 
aucune responsabilité en cas de dommage causé par tout virus ou autre programme 
malveillant transmis par ce message électronique.
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user