ST_Perimeter — Returns the length of the boundary of a polygonal geometry or geography.
float ST_Perimeter(
geometry g1)
;
float ST_Perimeter(
geography geog, boolean use_spheroid = true)
;
Retorna o perímetro 2D da geometria/geografia se for uma ST_Surface, ST_MultiSurface (Polygon, MultiPolygon). Retorna 0 para geometrias não areais. Para geometrias lineares, use ST_Length. Para tipos de geometria, unidades para medição de perímetro estão especificadas pelo sistema de referência espacial da geometria.
For geography types, the calculations are performed using the inverse geodesic problem, where perimeter units are in meters. If PostGIS is compiled with PROJ version 4.8.0 or later, the spheroid is specified by the SRID, otherwise it is exclusive to WGS84. If use_spheroid = false
, then calculations will approximate a sphere instead of a spheroid.
No momento isto é um heterônimo para ST_Perimeter2D, mas pode ser alterado para suportar dimensões maiores.
This method implements the OGC Simple Features Implementation Specification for SQL 1.1. s2.1.5.1
This method implements the SQL/MM specification. SQL-MM 3: 8.1.3, 9.5.4
Disponibilidade 2.0.0: Suporte para geografia foi introduzido
Retorna o perímetro em pés para Polígono e Multipolígono. Note que é em pés, porque EPSG:2249 é Massachusetts State Plane Feet
SELECT ST_Perimeter(ST_GeomFromText('POLYGON((743238 2967416,743238 2967450,743265 2967450, 743265.625 2967416,743238 2967416))', 2249)); st_perimeter --------- 122.630744000095 (1 row) SELECT ST_Perimeter(ST_GeomFromText('MULTIPOLYGON(((763104.471273676 2949418.44119003, 763104.477769673 2949418.42538203, 763104.189609677 2949418.22343004,763104.471273676 2949418.44119003)), ((763104.471273676 2949418.44119003,763095.804579742 2949436.33850239, 763086.132105649 2949451.46730207,763078.452329651 2949462.11549407, 763075.354136904 2949466.17407812,763064.362142565 2949477.64291974, 763059.953961626 2949481.28983009,762994.637609571 2949532.04103014, 762990.568508415 2949535.06640477,762986.710889563 2949539.61421415, 763117.237897679 2949709.50493431,763235.236617789 2949617.95619822, 763287.718121842 2949562.20592617,763111.553321674 2949423.91664605, 763104.471273676 2949418.44119003)))', 2249)); st_perimeter --------- 845.227713366825 (1 row)
Retorna perímetro em metros e pés para Polígono e MultiPolígono. Note que isso é geografia (WGS 84 long lat)
SELECT ST_Perimeter(geog) As per_meters, ST_Perimeter(geog)/0.3048 As per_ft FROM ST_GeogFromText('POLYGON((-71.1776848522251 42.3902896512902,-71.1776843766326 42.3903829478009, -71.1775844305465 42.3903826677917,-71.1775825927231 42.3902893647987,-71.1776848522251 42.3902896512902))') As geog; per_meters | per_ft -----------------+------------------ 37.3790462565251 | 122.634666195949 -- MultiPolygon example -- SELECT ST_Perimeter(geog) As per_meters, ST_Perimeter(geog,false) As per_sphere_meters, ST_Perimeter(geog)/0.3048 As per_ft FROM ST_GeogFromText('MULTIPOLYGON(((-71.1044543107478 42.340674480411,-71.1044542869917 42.3406744369506, -71.1044553562977 42.340673886454,-71.1044543107478 42.340674480411)), ((-71.1044543107478 42.340674480411,-71.1044860600303 42.3407237015564,-71.1045215770124 42.3407653385914, -71.1045498002983 42.3407946553165,-71.1045611902745 42.3408058316308,-71.1046016507427 42.340837442371, -71.104617893173 42.3408475056957,-71.1048586153981 42.3409875993595,-71.1048736143677 42.3409959528211, -71.1048878050242 42.3410084812078,-71.1044020965803 42.3414730072048, -71.1039672113619 42.3412202916693,-71.1037740497748 42.3410666421308, -71.1044280218456 42.3406894151355,-71.1044543107478 42.340674480411)))') As geog; per_meters | per_sphere_meters | per_ft ------------------+-------------------+------------------ 257.634283683311 | 257.412311446337 | 845.256836231335