spoly
functions
#
Similar to an spath
(Section 6.7.1),
you can get the count of edges of a spherical polygon using the
function:
npoints( | polygon) ; |
spoly polygon
;Example 6.17. Count of edges of a spherical polygon
sql> SELECT npoints ( spoly '{(0,0),(1,0),(1,1)}' ); npoints --------- 3 (1 row)
pgSphere provides two functions to get points at a path.
spoint( | path, | |
i) ; |
spoly path
;int4 i
;spoly_as_array( | path) ; |
spath path
;Example 6.18. Get by index
sql> SELECT spoint( spoly '{(0,0),(1,0),(1,1)}', 1 ); spoint --------- (0 , 0) (1 row) sql> SELECT spoint( spoly '{(0,0),(1,0),(1,1)}', 2 ); spoint --------- (1 , 0) (1 row) sql> SELECT spoint( spoly '{(0,0),(1,0),(1,1)}', 3 ); spoint --------- (1 , 1) (1 row)
Example 6.19. Represent points as array
sql> SELECT spoly_as_array( spoly '{(0,0),(1,0),(1,1)}' ); spoly_as_array --------------------------------- {"(0 , 0)","(1 , 0)","(1 , 1)"} (1 row)
Returns true if the specified spherical polygon is convex. Returns false otherwise.
spoly_is_convex( | polygon) ; |
spoly polygon
;Example 6.20. Check if polygon is convex
sql> SELECT spoly_is_convex( spoly '{(0,0),(1,0),(1,1),(1,2)}' ); spoly_is_convex ----------------- t (1 row)