I l @ ve RuBoard |
Somewhat unique among popular RDBMSs, PostgreSQL provides an extensive set of geometric-oriented functions. These functions and their associated operators are useful when performing calculations on spatial- related data sets. AREADescriptionThe AREA function computes the area occupied by a given object. InputAREA(obj) ExampleAREA(box '((1,1),(3,3))') 4 BOXDescriptionThere are several versions of the BOX function. Most perform conversions from other geometric types to the box data type. However, if the BOX function is passed two overlapping boxes, the result will be a box that represents where the intersection occurs. InputsBOX(box,box) ”Perform an intersection. BOX(circle) ” Convert a circle to a box. BOX(point,point) ”Convert from points to a box. BOX(polygon) ”Convert from a polygon to a box. ExamplesBOX(box'((1,1),(3,3))', box'((2,2),(4,4))') BOX'(3,3),(2,2)' BOX(circle'(0,0),2') BOX'(1.41, 1.41), (-1.41, -1.41)' BOX(point'(0,0)', point'(1,1)') BOX'(1,1),(0,0)' BOX(polygon'(0,0),(1,1),(1,0)' BOX'(1,1),(0,0)' CENTERDescriptionThe CENTER function returns the center point of the object passed to it. InputCENTER(obj) ExampleCENTER(box'(0,0),(1,1)') point'(.5,.5)' CIRCLEDescriptionThe CIRCLE function converts from box data types to a circle. InputCIRCLE(box) ”Convert from box to circle. ExampleCIRCLE(box'(0,0),(1,1)') CIRCLE'(.5,.5),.707016' DIAMETERDescriptionThe DIAMETER function returns the diameter of a supplied circle. InputDIAMETER(circle) ExampleDIAMETER(circle'((0,0),2)') 4 HEIGHTDescriptionThe HEIGHT function is used to compute the vertical height of a supplied box. InputHEIGHT(box) ExampleHEIGHT(box'(0,0),(3,3)') 3 ISCLOSEDDescriptionThe ISCLOSED function returns a Boolean value that represents whether the supplied path is open or closed. InputISCLOSED(path) ExampleISCLOSED(path'(0,0),(1,1),(1,0),(0,0)') t ISOPENDescriptionThe ISOPEN function returns a Boolean value that represents whether the supplied path is open or closed. InputISOPEN(path) ExampleISOPEN(path'(0,0),(1,1),(1,0),(0,0)') f LENGTHDescriptionThe LENGTH function returns the length of the supplied lseg . InputLENGTH(lseg) ExampleLENGTH(lseg'(0,0),(1,1)' 1.41422135623731 NotesIf the LENGTH function is passed a BOX data type, it will interpret the opposite corners of the box as the lseg to compute. LSEGDescriptionThe LSEG function converts from either a box or a pair of points to an lseg data type. InputsLSEG(box) LSEG(point,point) ExampleLSEG(box'(0,0),(1,1)') LSEG'(1,1),(0,0)' NPOINTSDescriptionThe NPOINTS function returns the number of points that compose the supplied path. InputsNPOINTS(path) NPOINTS(polygon) ExampleNPOINTS(path'(0,0),(1,1)') 2 PATHDescriptionThe PATH function converts from a polygon to a path. InputPATH(polygon) ExamplePATH(polygon'(0,0),(1,1),(1,0)') PATH'((0,0),(1,1),(1,0))' NotesNotice the closed representation "(" in the example provided. For more information on open or closed path representation, refer to the PATH data type. PCLOSEDescriptionThe PCLOSE function converts a path to the closed representation of a path. InputPCLOSE(path) ExamplePCLOSE(path'(0,0),(1,1),(1,0)') PATH'((0,0),(1,1),(1,0))' NotesSee the PATH data type for more information on how paths are represented as being open or closed. POINTDescriptionThe POINT function provides various geometric services, depending on the supplied object type. InputsPOINT(circle) ”Return the center of the supplied circle. POINT(lseg, lseg) ”Return the intersection of the supplied lsegs. POINT( polygon) ”Return the center of the supplied polygon. ExamplesPOINT(circle'((0,0),2)') POINT'(0,0)' POINT(polygon'(0,0),(1,1),(1,0)') POINT'(.66),.33)' POLYGONDescriptionThe POLYGON function converts various geometric types to a polygon. InputsPOLYGON(box) ”Convert a box to a 12-point polygon. POLYGON( circle) ”Convert a circle to a 12-point polygon. POLYGON(n, circle) ”Convert a circle to an n-point polygon. POLYGON(path) ”Convert a path to a polygon. ExamplesPOLYGON(4, circle'((0,0),4)') POLYGON'(-4,0),(2.041,4),(4,-4.0827),(-6.12,-4)' POPENDescriptionThe POPEN function converts a path to an open path. InputPOPEN(path) ExamplePOPEN(path'(0,0),(1,1),(1,0)') PATH'[(0,0),(1,1),(1,0)]' NotesNotice the open representation of the returned path. For more information on open or closed path representations, refer to the PATH data type. RADIUSDescriptionThe RADIUS function returns the radius of a supplied circle. InputRADIUS(circle) ExampleRADIUS(circle'((0,0),2)') 2 WIDTHDescriptionThe WIDTH function returns the horizontal size of a supplied box. InputWIDTH(box) ExampleWIDTH(box'(0,0),(2,2)') 2 |
I l @ ve RuBoard |