Apostila de PostGIS Básico
March 30, 2023 | Author: Anonymous | Category: N/A
Short Description
Download Apostila de PostGIS Básico...
Description
Curso sobre PostGIS básico
Instrutor: Jairo de Almeida Revisão 03/04/0!4
Sumário
" #ue $ o PostGIS%&&&&&&&&&& PostGIS%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&' &&&&&&&&&&&&&&&&&&&&&&&&' Instalando o Post(reS)* com PostGIS +uncionalidade&&&&&&&&&&&&&&&& +uncionalidade&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&, &&, Criando um banco de dados es-acial&&&&&&&&&& es-acial&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&!3 !3 Carre(ando dados de GIS no banco de dados&&&&&&&& dados&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&!. &&&&&&!. "bter os dados&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& dados&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&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&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&3 &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&3 "btendo dist>ncia minima e utili8an1ao da un1ão S9ncia de um outro ob2eto&&&&&&&&4 9area PostGIS&&&&&&&&&&&& PostGIS&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&& ;6ercBcios -odem ser eitos com dados im-ortados do IG; -ara o banco Post(reS)* D PostGIS PostGIS ReerEncias&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ReerEncias&&&&&& &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&. .
Conceitos SIG (Sistema de informaçõe informaçõess geográfico) Anatomia SIG, Boas práticas
SIG Sistema de inorma1ão (eo(ráico5 Permitem aos usuários criar consultas interativasF analisar inorma1ão es-aciaisF editar dados carto(ráicos& A-resentar A-resentar os resultados visualmentema-as5 em todas essas o-era1es&
O que são camadas Camadas
Camadas são ormas de -odermos or(ani8ar dados em um SIGF essas camadas são deinidas -ara cada tema -ro-ostoF e -ara esses temas teremos as res-ectivas camadas necessá necessárias rias -ara trabalar com dados carto(ráicos ;6em-lo: H idro(raia ?eio ambiente5 H RodoviasF Ruas 9rans-orte5 H onaF SetorF 9ales A(ricultura5 H SetorF )uadraF *otes Gestão Gestão munici-al5 H GasodutosF 7álvulas Redes Gás5 H +ibra K-tica 9elecomunica1es5 H Redes de á(ua e es(oto Saneamento asino5
O que uma feições
+ei1ão -ode ser considerada a orma de re-resenta1ão de ob2etos do um mundo realF -ara um ambiente com-utacionalF um con2unto de ei1es do mesmo ti-o -ode ser considerado uma camada& )ue -or sua ve8 -ode ser do ti-o PontoF *inaF PolB(ono &&&&
!epresentações geomtricas
As re-resenta1es (eom$tricas mais comuns são as listadas abai6oF essas re-resenta1es -odem ser -ara #ual#uer camada camada #ue estive estiverr contida em no nosso sso SIG& H Point& Pontual5 H *ineStrin(& *inear5 H *inearRin(& *inear Com-osta5 H PolL(on Mit oles5& PolB(onos5 H ?ultiPoint&Pontual Com-osta5 H ?ulti*ineStrin(&*inear Com-osta5 H ?ultiPolL(on& Poli(onal Com-osta5 H GeometrLCollection& +ei1es ?istas5
!epresentação em "#$
;sta re-resenta1ão (eom$trica tamb$m -ode ser eita na orma de marca1ão "GC mais comum NO9Nell OnoM 9e6t5 #ue a2uda bastante com-reender como os ob2etos (em$tricos de um SIG são re-resentados& H P"I9 !00 3005 H *I;S9RIG 0 3'0F .0 340F !0 340F !.0 '05 H P"*QG" 40 30F .0 3'0F !0 3'0F !.0 300F !00 .0F 40 305 5 H ?=*9IP"I940 300F '0 340F !0 '05 H ?=*9I*I;S9RIG 0 3.0F .0 3'0F !00 340F !.0 3.05F40 '0F '0 300F !00 '0F !.0 30055 H ?=*9IP"*QG" '0 30F .0 .0F !00 '0F'0 305F !00 340F !40 3.0F !40 300F !00 340555
!epresentação do mundo rea%
Como or(ani8ar camadas em um -adrão ade#uado -ara um SIG Sistema de inorma1es (eo(ráico5
Como organi&ar camadas em um padrão adequado para um SIG (Sitema de informações geográfico
oas -ráticasF " ormato ;SRI sa-eile& Como e6em-lo de ar#uivo de e6-orta1ão temos o ar#uivo Sa-eileF esse ar#uivo $ um -adrão de e6-orta1ão do SIG ArcGIS da ;SRI #ue oi mundialmente usado -ara trabalo com dados carto(ráicos em todo o mundoF o2e em dia os ormatos mais usados são os -adres abertos da "GCF mas clientes&s-F clientes&s6F clientes&db ruas&s-F ruas&s6F ruas&db lotes&s-F lotes&s6F lotes&db elevacao&s-F elevacao&s6F elevacao&db usoncia e ca-acidade de instalar com e6tensesF vocE -recisa ,&!& PortantoF use ,& de -reerEncia& A Ass o-1es abai6o se(ue a se#uEncia básica do instalador instalador do N NindoMs indoMs Post(reS Post(reS)*& )*& &Inicie &e6e -ara instalar o Post(reS)* 3&Se vocE dese2a acessar este servidor #ue não se2a o -rK-rio servidor& ?ar#ue a o-1ão VAceitar cone6ão em todos os endere1osF e não a-enas localostV& "9A: 7ocE -ode alterar isso mais tarde editando o -ost(res#l&con TW listen, C)O44')/0O>, !6;4/0#PO0>/, !6;4/0#40>'1/0>(, 6;4/0);' or !6;4/0#PO4C(O>, PO4CE'-A41;A)' Otherwise, return >;44.
1/_(eometry/ype 2 mm 3d ! !g g
eturn the g geometry eometry type of the 1/_(eometry alue.
1/_0nterioring>mm 3d !a_polygon, n#
eturn the >th interior linestring ring o off the polygon geometry geometry.. eturn >;44 if the geometry is not a polygon or the gien > is out of range.
1/_0s)losed2 mm 3d !g#
eturns / /;' ;' if the 40>'1/0>(Bs star startt and en end d points are coincident. or Polyhedral
surface is closed !olumetric#.
1/_0s)ollection3d !g#
eturns /;' if tthe he argument is a collection !6;4 !6;4/0F, /0F, ('O6'/ ('O6'/C)O44')/0O>, C)O44')/0O>, ...#
mm !geomA# !geomA# eturns tr true ue if this (eometry is an empty geom geometrycollection, etrycollection, polygon, point etc. 1/_0s'mptymm 40>'1/0>( ( is b both oth closed and simple. 1/_0singmm !g# eturns /;' if this 40>'1/0>
1/_0s1implemm 3d !geomA#
eturns !/ !/;'# ;'# if th this is (eometry h has as no anoma anomalous lous geometric po points, ints, such as self
intersection or self tangency.
1/_0salidmm g3.3
eturns true if tthe he 1/_(eometry 1/_(eometry is w well ell form formed. ed.
1. g 2. g6 +l +l"g "gs s
1/_0salideason & g3.3
eturns text stating if a geometry is alid or not and if not alid, a reason why.
1. geo eoA A 2. geo geoA6 A6 +l +l"gs "gs
1/_0salid-etail & g3.3
eturns a alid_detail !alid,reason,location# row stating if a geo geometry metry is alid or not and if not alid, a reason why and a location where.
1. geo 2. geo geo6 6 +l +l"g "gs s
1/_6mm 3d !a_point# 1/_>-ims3d !g
eturn the 6 coordinate of the point, or >;44 if not aailable. 0nput must be a point. eturns coordinate dimension of the geometry as a small int. alues are 2,3 or 8.
1/_>Points2 3d !g
eturn th the e number of points !ertexes# in a geometry geometry..
1/_>ings3d !geomA#
0f the geometry is a polygon or multipolygon returns the number of rings.
mm 3d !geom# 3d !geom# 0f geometry is a ('O6'/ ('O6'/C)O44')/0O> C)O44')/0O> !!or or 6;4 6;4/0F# /0F# return the number of 1/_>um(eometries2 mm geometries, for single geometries will return &, otherwise return >;44.
1/_>um0nterioringsmm !a_polygon#
eturn the number of interior rings of the fir first st polygon in the geometry geometry.. /his will wor+ with both PO4 P O4C(O> C(O> and 6;4/0PO4 6;4/0PO4C(O> C(O> types but only loo+s at the first polygon. eturn >;44 if there is no polygon in the geometry geometry..
1/_>um0nterioringmm !a_polygon#
eturn the number of interior rings of the first polygon in the geometry geometry..
1ynonym to 1/_>um0nteriorings.
1/_>umPatches& mm 3d !g
eturn the number of faces on a Polyhedral 1urface. umPointsmm !g
eturn th the e number of points in an 1/_4ine1tring o orr 1/_)ircular 1/_)ircular1tring 1tring alue.
1/_Patch>& mm 3d !geomA, n#
eturn the & &based based >th geometr geometry y !face# if the g geometry eometry is a PO4 PO4CE'-A41; CE'-A41;A)', A)', PO4CE'-A41; PO4 CE'-A41;A)'6. A)'6. Otherwise, return >;44.
1/_Point>mm 3d !a_linestring, n# n#
eturn the >th point in the first linestring or cir circular cular linestring in the geometry geometry.. eturn >;44 if there is no linestring in the geometry.
1/_10-mm !g
eturns the spatial reference identifier for the 1/_(eometry as defined in spatial_ref_sys table.
1/_1tartPointmm 3d !geomA# 1/_1ummary(
eturns the first point o off a 40>'1/ 40>'1/0>( 0>( geometry as a PO0>/.
eturns a text summary of the contents of the geometr geometry. y.
1. g 2. g
1/_5mm 3d !a_point#
eturn the 5 coordinate of the p point, oint, or > >;44 ;44 if not aailable. 0npu 0nputt must be a point.
!a(eomor*ox2-or*ox3-# r*ox3-# 1/_56ax3d !a(eomor*ox2-o !a(eomor*ox2-or*ox3-# x3-# 1/_56in3d !a(eomor*ox2-or*o
1/_Cmm 3d !a_point#
eturns 5 maxima of a bounding box 2d or 3d or a geometry geometry.. eturns 5 minima of a bounding box 2d or 3 3d d or a geometry geometry..
eturn the C coordinate of the point, or >;44 if not aailable. 0npu 0nputt must be a po point. int.
3d !a(eomor*ox2-or*ox3-# r*ox3-# 1/_C6ax3d !a(eomor*ox2-o !a(eomor*ox2-or*ox3-# x3-# 1/_C6in !a(eomor*ox2-or*o
1/_@mm 3d !a_point#
eturns C maxima of a bounding box 2d or 3d or a geometry geometry.. eturns C minima of a bounding box 2d or 3d o orr a geo geometry. metry.
eturn the @ coordinate of the point, or >;44 if not aailable. 0nput must be a point point..
!a(eomor*ox2-or*ox3-# x2-or*ox3-# 1/_@6ax3d !a(eomor*o
1/_@mflag3d !geomA#
eturns @ minima of a bounding b box ox 2d or 3d or a geometry geometry..
eturns @6 !d !dimension imension semantic# flag of the geometries as a small int. alues alues are G:2d, &:3dm,
2:3dz, 3:8d.
1/_@6in3d !a(eomor*o !a(eomor*ox2-or*ox3-# x2-or*ox3-#
eturns @ minima of a bounding b box ox 2d or 3d or a geometry geometry..
Geometr9 'ditors
1/_AddPoint3d
Adds a point to a 4ine1tr 4ine1tring ing before point !Gba !Gbased sed index#.
1. li&e li&estri stri&g6 &g6 poi& poi&t t 2. li&e li&estri stri&g6 &g6 poi poi&t6 &t6 pos positio itio& &
1/_Affine2 3d
Applies a 3d af affine fine transformation to the geometry to do things li+e tr translate, anslate, rotate, scale in one step.
1. geoA6 "6 =6 c6 d6 e6 +6 g6 h h6 6 i6 ?o++6 ,o++6 o++ 2. geo geoA6 A6 "6 = =6 6 d6 e6 ?o ?o++6 ++6 ,o ,o++ ++
1/_orce_2-2 3d !geomA#
orces the geometries into a H2dimensional m modeH odeH so th that at all output representations w will ill
only hae the 5 and C coordinates.
1/_orce_3-2 3d !geomA#
orces the geometries into 5C@ mode. /his is an alias for 1/_ 1/_orce_3-@. orce_3-@.
1/_orce_3-@2 3d !geomA# orces the geometries into 5C@ mode. /his is a synonym for 1/_orce_3-. 1/_orce_3-6 !geomA# orces the geometries into 5C6 mode. 3d !geomA# orces the geometries into 5C@6 mode. 1/_orce_8-3d !geomA# eomA# )onerts the geometry into a ('O6 ('O6'/C)O44')/0O>. '/C)O44')/0O>. 1/_orce_)ollection2 3d !g
1/_orceE2 3d !g# orces the orientation of the ertices in a polygon to follow the ightEandule. formed by sewing together a 6;4 6;4/040>'1/0>(. /040>'1/0>(. 1/_4ine6erge !amultilinestring# eturns a !set of# 4ine1tring!s# formed !multi#geometry,, returns a !multi#geo !multi#geometry metry consisting only of 1/_)ollection'xtract !collection, type# (ien a !multi#geometry elements of the specified type.
1/_)ollectionEomogenize& !collection#
(ien a geometry c collection, ollection, return returns s the HsimplestH rep representation resentation of the
contents.
1/_6ulti !g
eturns the geo geometry metry as a 6;4 6;4/0F /0F geometry geometry.. 0f the geometry is already a 6;4 6;4/0F, /0F, it is returned unchanged.
pointt from a linestring. Offset is Gbased. 1/_emoePoint3d !linestring, offset# emoes poin 1/_eerse !g !g eturns the geometry with ertex o order rder reersed.
1/_otate2 3d
otate a geo geometry metry rotadians countercloc+wise about an origin.
1. geo geoA6 A6 rotR rotR"di" "di"&s &s 2. geo geoA6 A6 ro rotR"d tR"di"&s i"&s6 6 ?06 ,0 3. geo geoA6 A6 rotR"d rotR"di"&s i"&s6 6 poi&tOr poi&tOrigi& igi&
1/_otate52 3d !geom !geomA, A, rotad rotadians# ians#
otate a geometry rotadians about the 5 axis.
!geomA, A, rotad rotadians# ians# 1/_otateC2 3d !geom
otate a geometry rotadians about the C a axis. xis.
1/_otate@2 3d !ge !geomA, omA, ro rotadians# tadians#
otate a geome geometry try rot rotadians adians about the @ axis.
1/_1cale2 3d
1cales the geo geometry metry to a new size b by y multiplying the ordinates with the parameter parameters. s. 0e 1/ 1/_1cale!geom, _1cale!geom, 5factor, Cfactor, @factor#.
1. geo geoA6 A6 XB"c XB"ctor6 tor6 B" B"ctor ctor6 6 B"ct B"ctor or 2. geo geoA6 A6 XB XB"cto "ctor6 r6 B B"cto "ctor r max_length# x_length# eturn a modified geome geometry try haing no segmen segmentt longer than the gien distance. 1/_1egmentize !geomA, ma -istance computation is performed in 2d only.
1/_1etPoint3d !linestring, zerobasedposition, point#
eplace point > of linestring with gien point. 0ndex is Gbased.
1/_1et10- !geom, srid# 1/_1nap/o(rid3d 1. 2. 3. 9.
geoA6 geo geoA6 A6 geo geoA6 A6 geoA6
1ets the 10- o on n a geometry to a particular integer alue.
1nap all points of the input geometry to a regular grid.
origi&X6 origi&6 sieX6 sie sie sieX6 X6 sie sie s si ie e p poi&tOrigi oi&tOrigi&6 &6 sieX6 sie6 s sie6 ie6 si sie e
1/_1nap& g3.3 !input, reference, reference, tolerance#
1nap segments and ertices o off input geo geometry metry to er ertices tices of a reference
geometry.
srid# 1/_/ransform 2 mm !g&, srid#
eturns a new geometry with its coord coordinates inates transformed to the 1 100- referenced by the
integer parameter parameter..
1/_/ranslate 3d
/ranslates the geometry to a n new ew location using the numeric parameters as offsets. 0e 1/_/ranslate!geom, 5, C# or 1/_/ranslate!geom, 5, C,@#.
1. g16 delt delt"?6 "?6 delt delt", ", 2. g16 de delt"? lt"?6 6 delt delt",6 ",6 de delt" lt" deltaC,, 5actor 5actor,, Cactor# 1/_/rans1cale 3d !geomA, delta5, deltaC
/ranslates th the e geometry using the delta5 and deltaC args, then scales it using the 5actor, Cactor args, wor+ing in 2- only.
Geometr9 Outputs
1/_As*inary2 mm ( 3d
eturn the the (I);'-PO4C(O> '-PO4C(O> to a 40>'1/0>(IPO4 40>'1/0>(IPO4C(O> C(O>
1. c#r c#re8 e8eo eo 2. c#re8eo c#re8eo6 6 sege&ts*per*)tr*ci sege&ts*per*)tr*circle rcle geom*# 1/_-ifferencemm 3d !geomA, geom*#
eturns a geo geometry metry that repre represents sents that part of geometry A that does not
intersect with geometry *.
1/_-ump2 3d !g
eturns a set of ge geometry_dump ometry_dump !geo !geom,path# m,path# rows, that ma+e up a geome geometry try g&.
1/_-umpPoints2 3d !geom# 1/_-umpings3d !a_polygon#
eturns a set o off geometry_dump !!geom,path# geom,path# rows o off all points that m ma+e a+e up a geometr geometry. y. eturns a set of ge geometry_dump ometry_dump row rows, s, representing the exterior and interior rings of a
polygon.
1/_lip)oordinates& 3d !geom#
eturns a ersion of the gien geometry with 5 and C axis flipped. ;seful for pe people ople who hae built latitudeIlongitude features and need to fix them.
1/_0ntersectionmm (
!/# eturns eturns a geome geometry try that rrepresents epresents the sha shared red portion of geomA and geom*. /he geography implementation does a transform to geometry to do the intersection and then transform bac+ to o !geomA>oncircular# ncircular#
)onerts a 40>'1/0>(IPO4 40>'1/0>(IPO4C(O> C(O> to a )0);4 )0);4A1/0>(, A1/0>(, ) );';'-
PO4C(O>
1/_6a+ealid& 3d !input#
Attempts to ma+e an inalid geometry alid wIout loosing ertices.
1/_;nion, _;nion, only m memoryfriendly emoryfriendly !uses less memory an and d more processor time#. 1/_6em;nion3d !geomfield# 1ame as 1/ circle cle polygon that c can an 1/_6inimum*ounding)ircle !geomA, num_segs_per_9t_circ:8D# eturns the smallest cir fully contain a geometry. -efault uses 8D segments per 9uarter circle.
1/_Polygonize
Aggregate. )reates a (eometry)ollection con containing taining possible polygons formed from th the e constituent linewor+ of a set of geometries.
1. geo geo+i +iel eld d 2. geo geo*" *"rr rr", ",
1/_>ode& g3.3 3d !geom#
>ode a set of linestrings.
style_parameters:BB# meters:BB# 1/_Offset)ure& g3.3 !line, signed_distance, style_para
eturn an offset line at a gien distance and side
from an input line. ;seful for computing parallel lines about a center line !geom## 1/_emoeepeatedPoints& 3d !geom
eturns a er ersion sion of the gien geometry with duplicated points
remoed.
1/_1haredPaths& g3.3 !lineal&, lineal2#
eturns a collection containing paths shared by the two input
linestringsImultilinestrings.
1/_1hift_4ongitude2 3d !geomA#
eads eery pointIertex in e eery ery component of eery fea feature ture in a geometry geometry,, and if the longitude coordinate is G, adds 3MG to it. /he result would be a G3MG ersion of the data to be plotted in a &DG centric map
1/_1implify !geomA, tolerance#
eturns a HsimplifiedH ersion of the gien geometr geometry y using the -ouglasPeuc+er
algorithm.
1/_1implifyPresere/opology !geomA, tolerance# tolerance#
eturns a HsimplifiedH ersion of the gien geometry using the -ouglasPeuc+er algorithm. (1 and 6;4/040>'1/0>(1 6;4 /040>'1/0>(1 are supported. point# 1/_0nterpolatePoint& 3d !line, point#
eturn the alue of th the e measure dimension of a geometry at the point closed to
the proided point. !geom_mline, mline, measure_start, measure_end# 1/_Add6easure3d !geom_
eturn a deried geome geometry try with measure element elements s linearly interpolated between the start and end points. 0f the geometry has no measure dimension, one is added. 0f the geometry has a measure dimension, it is oerwritten with new alues. Only 40>'1/0>(1 and 6;4/040>'1/0>(1 6;4/040>'1/0>(1 are supported.
ong $ransactions Support
AddAuth !auth_to+en# Add an authorization to+en to be used in current trtransaction. ansaction. table ble to pre preentIallow entIallow updates and deletes o off rows based on authorization to+en. )hec+Auth )reates trigger on a ta 1. "*sche"* "*sche"*&"e6 &"e6 "*t"=le*& "*t"=le*&"e6 "e6 "*'e,*col# "*'e,*col#&*&"e &*&"e 2. "*t" "*t"=le* =le*&"e &"e6 6 "*'e "*'e,*co ,*col#& l#&*&" *&"e e
-isable4ong/ransactions !#
-isable long transaction support support.. /his function remo remoes es the long transaction support metadata tables, and drops all triggers attached to loc+chec+ed tables.
'nable4ong/ransactions !#
'nable long transaction suppor support. t. /his function creates the re9u re9uired ired metadata tables, needs to be called once before using the other functions in this section. )alling it twice is harmless.
4oc+ow
1et loc+Iauthorization for specific row in table
1. "*sche"* "*sche"*&"e6 &"e6 "*t"=le "*t"=le*&"e6 *&"e6 "*roG* "*roG*'e,6 'e,6 "&*"#th* "&*"#th*to'e&6 to'e&6 e?pire e?pire*dt *dt 2. "*t"=le*& "*t"=le*&"e6 "e6 "*r "*roG*'e,6 oG*'e,6 " "&*"#th*to &*"#th*to'e&6 'e&6 e?p e?pire*dt ire*dt 3. "*t"=le*& "*t"=le*&"e6 "e6 "*roG*'e,6 "&*"#th*t "&*"#th*to'e& o'e&
;nloc+ows !auth_to+en#
emoe all lo loc+s c+s held by specified authorization id id.. eturns the number of loc+s released.
7isce%%aneous -unctions !geomfield# geomfield# 1/_Accum 2 3d !
*ox2-2 !geomA#
Aggregate. )onstructs an a array rray of geometries. geometries.
eturns a *O52- repr representing esenting the maximum e extents xtents of the geometr geometry. y.
*ox3-2 3d !geomA# eturns a *O53- repre representing senting the maximum extents of the geometry geometry.. 1/_'stimated_'xtent eturn the BestimatedB extent ooff the gien spatial table. /he estimated is ta+en from the geometry columnBs statistics. /he current schema will be used if not specified.
1. sche"*&" sche"*&"e6 e6 t"=le*&" t"=le*&"e6 e6 geocol#& geocol#&*&"e *&"e 2. t"=l t"=le*&" e*&"e6 e6 geoco geocol#& l#&*&" *&"e e
1/_'xpand2
eturns bounding box expanded in all directions from the bounding box of th the e input geom geometry. etry. ;ses
doubleprecision
1. g16 #&it #&its*to s*to*e?p *e?p"&d "&d 2. g16 #&it #&its*to s*to*e?p *e?p"&d "&d 3. g16 #&it #&its*to s*to*e?p *e?p"&d "&d
1/_'xtent2 !geomfield#
an aggregate function that returns the bounding box th that at bounds rows of ge geometries. ometries.
1/_3-'xtent2 3d !geomfield#
an aggregate function that returns the box3- bounding box that bo bounds unds rows o off
geometries.
ind_10- !a_ !a_schema_name, schema_name, a a_table_name, _table_name, a_geomfield_name# /he syntax is find_srid!db_schema, table,column# and the function returns the integer 10- of the specified column by searching through the ('O6'/C_)O4;6>1 table. 1/_6em_1ize3d !geomA# eturns the amount of space !in bytes# the geometry ta ta+es. +es. center_x, center_y center_y,, radius# 0s the point geometr geometry y insert circle defined by center_x, 1/_Point_0nside_)ircle !a_point, center_x, center_y, radius
'1ceptiona% -unctions
Post(01_Add**ox !geomA# !geomA# geomA# Post(01_-rop**ox ! Post(01_Eas**ox !geomA# otherwise.
Add bounding box to the geometry geometry.. -rop the bounding box cache from the geome geometry. try. eturns /;' if the bbox of this geometry is cached, A41' A41'
$arefa *ostGIS ;6ercBcios -odem ser eitos com dados im-ortados do IG; -ara o banco Post(reS)* D PostGIS Camadas im-ortadas em aula: mala
View more...
Comments