## Area measurement

Discuss the drawing application

### Area measurement

is there a way to draw something and measure:
a) length
b) area
c) angle

thank you very much!
David openoffice 3.1.0 on windows vista
Ing. David

Posts: 2
Joined: Tue Feb 09, 2010 4:24 am

### Re: area measurement

Not really, although you can get some of those values, with some restrictions.

If you want to describe a specific situation, maybe we can make some specific suggestions.
AOO4/LO5 • Linux • Fedora 23

acknak
Moderator

Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

### Re: Area measurement

autocad has a measure area measure length measure angle feature
is there a way to maybe transform drawing to .dwg and measureitwith the autocad reader?
blau azotea trasera.odg
David openoffice 3.1.0 on windows vista
Ing. David

Posts: 2
Joined: Tue Feb 09, 2010 4:24 am

### Re: Area measurement

Ok; thanks for the sample.

Draw is really not good for CAD or engineering drawing. I would consider any sort of analysis done with it as "approximate". It just isn't designed for that kind of work and there are still problems with its coordinate system and scaling that can give incorrect values.

That said, it is possible to do some simple calculations on Draw figures, as you've done, or using extensions that are available. Here's one that I've heard of, but not tried myself:

You may also want to look at these previous threads:
viewtopic.php?f=11&t=21044
viewtopic.php?f=11&t=24101

There's another extension linked there that allows you to extract information from Draw into a spreadsheet, where you can do whatever calculations you want.

BTW, in your diagram, are you interested in the entire area of the large, 4-sided shape, or of (some subset of) the smaller colored polygons within the larger one? I find an area of about 117 m^2 for the large area.
AOO4/LO5 • Linux • Fedora 23

acknak
Moderator

Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

### Re: Area measurement

I can offer the procedure for area measurement of polypolygon (i use it in OpenOffice Draw):
Lubos Raus

Code: Select all   Expand viewCollapse view
`Option Explicit' Copyleft 2019 Lubos Raus' Procedure is based on https://forum.openoffice.org/en/forum/viewtopic.php?f=11&t=86532Sub PolygonAreaDim oDoc As Object, PolyPolygonShape As ObjectDim StartPoint As New com.sun.star.awt.PointDim Value as Long, PointsNumber as integer, i as Integer, InputStr as String   oDoc = ThisComponent   If IsNull(oDoc) Then      Exit Sub   EndIf   PolyPolygonShape = MyGetCurrentlySelectedSingleShape(oDoc, False)   If IsNull(PolyPolygonShape) then      exit sub   End if      If PolyPolygonShape.getShapeType() <> "com.sun.star.drawing.PolyPolygonShape" Then      MsgBox "Selected shape is not PolyPolygonShape", 48, "Info"      exit sub   End if      PointsNumber = UBound(PolyPolygonShape.PolyPolygon(0))   Dim Points(PointsNumber) As New com.sun.star.awt.PointDim Coordinates(0 to PointsNumber, 0 to 1) as Long   Array(Points()) = PolyPolygonShape.PolyPolygon   For i= 0 to PointsNumber     Coordinates(i,0) = PolyPolygonShape.PolyPolygon(0)(i).x     Coordinates(i,1) = PolyPolygonShape.PolyPolygon(0)(i).y   next i   Dim x(PointsNumber) as Double, y(PointsNumber) as Double, Area as Double   Area = 0   For i= 0 to PointsNumber     x(i) = Coordinates(i,0)/1000     y(i) = Coordinates(i,1)/1000   next i   For i= 0 to PointsNumber-1              ' algortimus based on mathworld.wolfram.com/PolygonArea.html     Area = Area + x(i)*y(i+1)-x(i+1)*y(i) ' (CRC Standard Mathematical Tables and Formulas 33E (2018).pdf pg. 212)   next i   Area = Area/2   MsgBox "Polygon Area is:   " & Area & " cm².",0 , "Polygon Area"End sub'___________________________________________________________________________________________________________________'**************************************************************************************' Next functions based on Danny B's macro collection downloaded from the old oooForum.' a version of the original code is available from this topic of the AOO forum:' https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=15217&start=0' and on this place:' http://nab.pcug.org.au/20090204_bas_source/dannyb.bas'**************************************************************************************Function MyDrawingGetSelection(ByVal oDrawDocCtrl as object) as objectDim oSelectedShapes as objectDim oDrawDocCtrl2 as object   If Not HasUnoInterfaces( oDrawDocCtrl, "com.sun.star.frame.XController" ) Then      'xray oDrawDocCtrl             oDrawDocCtrl2 = MyGetDocumentController( oDrawDocCtrl )   else      oDrawDocCtrl2 = oDrawDocCtrl   EndIf   If IsEmpty( oDrawDocCtrl2.getSelection() ) Then      oSelectedShapes = createUnoService( "com.sun.star.drawing.ShapeCollection" )   else      oSelectedShapes = oDrawDocCtrl2.getSelection()   EndIf   MyDrawingGetSelection() = oSelectedShapesEnd Function'___________________________________________________________________________________________________________________Function MyGetCurrentlySelectedSingleShape(ByVal oDrawDoc, Optional bSilent ) As ObjectDim oSelectedShapes as objectDim oSingleSelectedShape as object   If IsMissing( bSilent ) Then      bSilent = False   EndIf      oSelectedShapes = MyDrawingGetSelection(oDrawDoc)   If oSelectedShapes.getCount() <= 0 Then      If Not bSilent Then         MsgBox "There is not object selected", 48, "Info"         Exit Function      EndIf      ElseIf oSelectedShapes.getCount() > 1 Then      If Not bSilent Then         MsgBox "Please select one shape only", 48, "Info"         Exit Function      EndIf      Else      oSingleSelectedShape = oSelectedShapes.getByIndex(0)            myGetCurrentlySelectedSingleShape() = oSingleSelectedShape   EndIfEnd Function'___________________________________________________________________________________________________________________Function MyGetDocumentController( oDoc As Object ) As ObjectDim oCtrl As Object      If oDoc.supportsService( "com.sun.star.document.OfficeDocument" ) Then      oCtrl = oDoc.getCurrentController()   ElseIf HasUnoInterfaces( oDoc, "com.sun.star.frame.XController" ) Then      oCtrl = oDoc   ElseIf HasUnoInterfaces( oDoc, "com.sun.star.frame.XFrame" ) Then      oFrame = oDoc      oCtrl = oFrame.getController()   Else      MsgBox( "GetDocController called with incorrect parameter." )   EndIf   MyGetDocumentController() = oCtrlEnd Function`
OpenOffice.org 3.3
Lubos Raus

Posts: 1
Joined: Wed Jan 23, 2019 11:38 am

### Re: Area measurement

There are many free CAD packages which will calculate areas. Google for them.

See How to measure areas in map [using LibreCAD] - export an image and insert it into LibreCAD.

If you can break the area into triangles you can calculate it easily. If the sides are a, b and c, calculate S = (a+b+c)/2. The area is now sqrt[s * (s-a) * (s-b) * (s-c)]. See Heron's Formula.

area triangle.ods

Showing that a problem has been solved helps others searching so, if your problem is now solved, please view your first post in this thread and click the Edit button (top right in the post) and add [Solved] in front of the subject.
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
John_Ha
Volunteer

Posts: 7766
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

### Re: Area measurement

I would not resort to Heron's formula here. In the context of drawing software e.g. polygons will next to always be described by coordinates of points and/or vectors, and next to never by side lengths (and angles). This should even hold for software accepting angles an lengths for input as soon as the input is processed.
Sticking to 2D the oriented area of a triangle is half the determinant of the 2 x 2 matrix formed by the 2 (column-) vectors describing two sides of the triangle in ordinary succession. For polygons without any pair of intersecting edges you don't need a triangulation at all.
See attached example. (Disclaimer: Errors expected.)
Attachments
aoo27311AreaOfPolygon_1.ods
On Windows 10: LibreOffice 7.0 and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München

Lupp
Volunteer

Posts: 2894
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany