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 <rdmaili...@duif.net>
Sent: Tuesday, June 16, 2020 12:10 PM
To: Tudorache, Marian <marian.tudora...@navcanada.ca>; 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

Reply via email to