[Qgis-user] bounding box algorithm

Thayer Young thayeray at yahoo.com
Thu Oct 8 12:57:59 PDT 2020


 OK, so forget what I said about geometry specific, I think you want to look in the other direction, go up not down:
QgsRectangle QgsAbstractGeometryV2::calculateBoundingBox() const

https://qgis.org/api/2.18/qgsabstractgeometryv2_8cpp_source.html#l00111



    On Thursday, October 8, 2020, 03:28:59 PM EDT, Thayer Young <thayeray at yahoo.com> wrote:  
 
  Hi Marian,
I think you are looking at an abstract method, that is implemented differently for each type of geometry.So you need to dig deeper into the code to find the specific implementation of the bounding box or boundary method for polygons.The link below at line 138 gives the boundary method for the multipolygonv2 geometry.https://qgis.org/api/2.18/qgsmultipolygonv2_8cpp_source.html#l00138

This may not specifically be what you are looking for, but hopefully it will help you find it.
-Thayer


Message: 3
Date: Thu, 8 Oct 2020 18:17:25 +0000
From: "Tudorache, Marian" <Marian.Tudorache at navcanada.ca>
To: "qgis-user at lists.osgeo.org" <qgis-user at lists.osgeo.org>,
    "Qgis-user <qgis-user-bounces at lists.osgeo.org>
    (qgis-user-bounces at lists.osgeo.org)"
    <qgis-user-bounces at lists.osgeo.org>,
    "qgis-user-request at lists.osgeo.org"
    <qgis-user-request at lists.osgeo.org>
Subject: [Qgis-user] bounding box algorithm
Message-ID:
    <YTBPR01MB36777A269FA5AB1C954B8F23E60B0 at YTBPR01MB3677.CANPRD01.PROD.OUTLOOK.COM>
    
Content-Type: text/plain; charset="utf-8"

Hi,

The question is for the developers of QGIS.
In my python classes I use a lot the boundingBox function for QgsGeometry class.
I would like to know if it is possible to see the algorithm for this function.

I found this but it is not really the algorithm

  858<https://qgis.org/api/2.18/classQgsGeometry.html#adfc04c94b51cdeb55942b699fdd4d564> QgsRectangle<https://qgis.org/api/2.18/classQgsRectangle.html> QgsGeometry::boundingBox<https://qgis.org/api/2.18/classQgsGeometry.html#adfc04c94b51cdeb55942b699fdd4d564>() const
  859 {
  860  if ( d->geometry<https://qgis.org/api/2.18/structQgsGeometryPrivate.html#ac49a8dd9cb78a9d041d1a46ac6a7ef15> )
  861  {
  862  return d->geometry<https://qgis.org/api/2.18/structQgsGeometryPrivate.html#ac49a8dd9cb78a9d041d1a46ac6a7ef15>->boundingBox<https://qgis.org/api/2.18/classQgsAbstractGeometryV2.html#ac6806e752aeda4f347741a0c7eb37167>();
  863  }
  864  return QgsRectangle<https://qgis.org/api/2.18/classQgsRectangle.html>();
  865 }
  866
Where
I create some polygons with QGIS which are exported to another system which use a bounding box formula that gives infinity.
The other system includes a check of the South Pole in the bounding box it also takes in consideration the orientation of the polygon coordinates.
It seems in one of the orientation the South Pole is inside the bounding box and if I switch the orientation the South Pole is not anymore inside.
QGIS seems to be immune of how the coordinates are oriented. Regardless of the order QGIS gives a finite bounding box without having a South Pole inside.

Can someone help me?
Thank you,
Marian
Anyone can help me?

________________________________    
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20201008/9eacc90e/attachment.html>


More information about the Qgis-user mailing list