Let's say I got nearby buildings colored with blue. I need to get a polygon shape in pink like on the picture below:
Please advise how to achieve this.
Geometries are:
0103000020E6100000010000002A00000028901661FC0C54C00467145790D5394086BC9B37FC0C54C0EFDFE94E90D539402F57250FFC0C54C02BB8C82C90D5394040C0EFE8FB0C54C02A38CAF18FD539403D1623C6FB0C54C042D1B19F8FD539402EA3C7A7FB0C54C0416C05398FD539409466D28EFB0C54C009DAD5C08ED539402D77FF7BFB0C54C001D3BE3A8ED53940924DE56FFB0C54C0A9E9EDAA8DD5394034B9DA6AFB0C54C08D949E158DD5394097560C2AFA0C54C0DC5DCB7526D5394027CC4937FA0C54C0C17B2DA225D53940C242754DFA0C54C0ACE895D824D53940F2D4036CFA0C54C0753AF11D24D53940C1593B92FA0C54C01AD9C37623D53940BED126BFFA0C54C013A118E722D53940A54DB4F1FA0C54C0EB6A7D7222D53940A991A328FB0C54C0521DBA1B22D5394022EAA562FB0C54C0D7E0F6E421D53940E1D74B9EFB0C54C079AB76CF21D539405A32AC54020D54C09D3C037921D53940C6B62D88020D54C04BF1518621D53940234F4BBA020D54C0589273B321D53940530487E9020D54C0D2F6FEFE21D5394080057A14030D54C0367DC86622D539401332E139030D54C074F4ADE722D539401B3E9958030D54C01C7BE67D23D53940AB74C06F030D54C05C7F022524D539404564A47E030D54C04A9500D824D539405F29D584030D54C0AEDC999125D53940B1E1988F040D54C06C7B40E68BD53940EEE7778D040D54C0AB00548C8CD5394099839F83040D54C0316FBA2E8DD539402E035972040D54C0AB3EC2C88DD53940C494275A040D54C0B51422568ED5394032D7B83B040D54C0DCF3A1D28ED539404E76EF17040D54C0A364C53A8FD53940D716CAEF030D54C05A5E978B8FD53940EA9777C4030D54C0D02AB8C28FD53940C6743197030D54C0FFCCA9DE8FD539405D7C4369030D54C0128C8ADE8FD5394028901661FC0C54C00467145790D53940
0103000020E6100000010000002B000000E96360FDD70C54C0AB73C8970DD639408644D3CED70C54C05B7EDB8E0DD6394005686AA1D70C54C005A1F1680DD6394068307D76D70C54C0129C27270DD63940212D5E4FD70C54C0937C71CB0CD63940B67C352DD70C54C04C159E580CD6394008570D11D70C54C01DCC30D20BD6394096B0C0FBD60C54C02318233C0BD63940F78BF2EDD60C54C0F3DEF59A0AD63940611E0AE8D60C54C0752599F309D639403A89E3ACD50C54C0CAC5D5B4A2D53940FC8204AFD50C54C05D956A0DA2D53940B5AB19B9D50C54C009C8C469A1D5394061EBD3CAD50C54C0862FF0CEA0D539402A38ACE3D50C54C0A62E7141A0D539406E84E502D60C54C065F5A5C59FD539409CC78B27D60C54C062993B5F9FD53940B2368950D60C54C01F0735119FD53940C27AA07CD60C54C0DCCA06DE9ED5394036F280AAD60C54C0EAFD20C79ED539409F76F4A0E20C54C035C5E4D29CD53940DD3C84D7E20C54C05ADB46DB9CD53940AF75DC0CE30C54C08B07D1059DD53940B1795B3FE30C54C059EA35519DD539409DBE776DE30C54C082B123BB9DD53940554FCE95E30C54C055EE58409ED53940709E27B7E30C54C05A09EADC9ED53940742B81D0E30C54C0892B0D8C9FD53940955512E1E30C54C035017848A0D539404EB85DE8E30C54C0EAB95F0CA1D53940BFF52A27E50C54C00D145F1C08D6394065B31125E50C54C0F5F7C9CE08D63940935E941AE50C54C03B55427D09D639401FFD0308E50C54C022F4B1220AD639406162EDEDE40C54C05D9744BA0AD63940BE6E12CDE40C54C09267723F0BD639403DF46CA6E40C54C0412068AE0BD6394050751A7BE40C54C08672D6030CD639400EDC634CE40C54C0DCE2413D0CD63940E841A81BE40C54C0DBD7FB580CD639405F4A53EAE30C54C0D71226560CD639400D2CDCB9E30C54C07F3FEA340CD63940E96360FDD70C54C0AB73C8970DD63940
0103000020E6100000010000002D0000005750B23EF20C54C08EF3260092D53940F44D5409F20C54C01E1BEEF391D53940DC5257D5F10C54C0D601DEC691D5394004443BA4F10C54C03523367A91D5394064068077F10C54C0026D3A1091D53940449F6B50F10C54C0FC77178C90D5394081C93030F10C54C03270AEF18FD5394044DFBA17F10C54C0EF9C91458FD5394017DCC807F10C54C0E148D08C8ED539402A76CF00F10C54C03458ECCC8DD539404C7B54B5EF0C54C05878CA2528D5394006D1FEB6EF0C54C014A6317027D53940A34184C0EF0C54C065D9CFBD26D5394062E4ABD1EF0C54C0E5A3141326D53940F5F002EAEF0C54C0CB06387425D5394087D3F508F00C54C08A8F2CE524D539408806B92DF00C54C0659D7C6924D539406B0B6557F00C54C033614A0424D53940007DF484F00C54C0ACF006B823D53940A23340B5F00C54C0FBE3A28623D539404C6217E7F00C54C0FF3E5A7123D539401B227415F70C54C0CA9251A522D53940DEE5DD4CF70C54C06EE997AD22D53940E7833B83F70C54C002AF30D522D53940CB633BB7F70C54C082611E1B23D53940BBC88FE7F70C54C0F48D9D7D23D53940C3DC0813F80C54C092F451FA23D539407DA79538F80C54C0A1C12A8E24D5394050174357F80C54C081F76C3525D53940911E546EF80C54C0ACE3F8EB25D53940E3E93B7DF80C54C0986D62AD26D5394038569183F80C54C087B9DF7427D53940A810ED8FF90C54C0EA000AB68DD53940D8A40E8EF90C54C0DA15A9528ED53940B31B2F85F90C54C00A9F14EC8ED539408E308C75F90C54C0FCB5487E8FD5394048F4905FF90C54C032D1520590D53940AEF1D143F90C54C02100B37D90D539403F240E23F90C54C01DC62EE490D53940596E22FEF80C54C03E230C3691D539404BC604D6F80C54C0945C2D7191D539403200CAABF80C54C0B641EE9391D53940257A9380F80C54C03E1A6D9D91D53940AFC87C55F80C54C021F9608D91D539405750B23EF20C54C08EF3260092D53940
0103000020E6100000010000002B0000001E502FF5040D54C03D4E5C9C07D63940C3197DEAFD0C54C01F64164008D63940ADDFFDBAFD0C54C090B8883508D639405157B28CFD0C54C0EFF0D70D08D639404AACF760FD0C54C0CFF70BCA07D63940EDEC1239FD0C54C0FFA1346C07D63940870A3116FD0C54C0ABDE12F706D6394006465BF9FC0C54C0DB3D156E06D6394009AF69E3FC0C54C0C3A13FD505D63940002D02D5FC0C54C033E2193105D63940CCC790CEFC0C54C061C3748604D63940A9DF4D6AFC0C54C07718EB35E6D53940C762F36BFC0C54C005ADC777E5D539408C08E075FC0C54C0E19EECBCE4D53940C31ED587FC0C54C00849200AE4D539405F015CA1FC0C54C0C5AED563E3D539405080D6C1FC0C54C0296E33CEE2D53940D8796EE8FC0C54C03146104DE2D5394070EE2E14FD0C54C0D9CD98E3E1D539407A37FE43FD0C54C094118094E1D5394054B5A676FD0C54C0A91FBA61E1D53940BC6BE1AAFD0C54C0C056944CE1D5394010F1EE6C040D54C0CFFF8082E0D5394045AE139E040D54C061840599E0D53940AF158ECD040D54C069DC17CCE0D539409EEB1DFA040D54C0FA216E1AE1D5394015639222050D54C0FA13EE81E1D539400DA8D645050D54C03EC2D6FFE1D539409584FB62050D54C0C254DC90E2D539409A333C79050D54C08E440C31E3D53940AA57FF87050D54C0EE8835DCE3D539406FA0E08E050D54C05ACFCC8DE4D53940E56EF705060D54C098ED1E6903D6394038C8DD04060D54C0DC079D0B04D639403C02A8FC050D54C0CC076FAB04D63940736984ED050D54C017BC784405D63940F929DBD7050D54C0FEEDDFD205D63940673236BC050D54C099F6015306D63940AFB44E9B050D54C06DFF92C106D639404B24F275050D54C0AFA0CE1B07D639405D531A4D050D54C093915F5F07D63940C682D021050D54C09438978A07D639401E502FF5040D54C03D4E5C9C07D63940
0103000020E6100000010000002C000000BCE149D3E70C54C07D603C6DC2D539405D4998A6E70C54C0B1505765C2D53940481FEB7AE70C54C0737BD741C2D53940E3F29451E70C54C0C7CBC403C2D53940D26CCA2BE70C54C0377AFEACC1D5394055FDAA0AE70C54C08CD91440C1D53940AF882EEFE60C54C0FC8034C0C0D53940C1392ADAE60C54C06BC52931C0D539408B403CCCE60C54C074FF3D97BFD5394078EDC8C5E60C54C08617F2F6BED539400B7C514CE60C54C083BF2425A1D5394026CD3D4DE60C54C059C5BA70A0D53940CF951656E60C54C0950A2ABF9FD53940E3359B66E60C54C05800F0149FD53940206F657EE60C54C08D5D67769ED539406808D89CE60C54C091168DE79DD539407B2A30C1E60C54C0B9C70A6C9DD53940789F7EEAE60C54C0EA9009079DD53940ED65B317E70C54C037E20BBB9CD53940CE28AC47E70C54C0DB35108A9CD53940D46C2F79E70C54C06E154F759CD5394047D0EE5AEE0C54C0591C319D9BD53940AE68A087EE0C54C0A9454AA59BD539407AED43B3EE0C54C05D210CC99BD53940977490DCEE0C54C0EC5864079CD5394099704E02EF0C54C00AA57A5E9CD53940D4B95623EF0C54C08C38BBCB9CD53940CF50B43EEF0C54C0C696EB4B9DD5394076EF9453EF0C54C0650C2EDB9DD53940D26E5961EF0C54C0162347759ED5394082879C67EF0C54C0F7FEAE159FD53940FB5AFFDCEF0C54C0FC1EB3C2BCD53940A33D6ADBEF0C54C04D013484BDD53940673CFFD0EF0C54C02D470B42BED5394069780CBEEF0C54C068D114F7BED5394041E91AA3EF0C54C01FDE3D9EBFD53940FDC9E280EF0C54C0061AFB32C0D539404A2C5758EF0C54C0755F29B1C0D539406C89962AEF0C54C063876415C1D539402A1DE1F8EE0C54C05F6EC55CC1D53940A2D39AC4EE0C54C0D4547085C1D5394046502F8FEE0C54C0047A488EC1D53940599C1A5AEE0C54C0110DF776C1D53940BCE149D3E70C54C07D603C6DC2D53940
0103000020E6100000010000007E000000DAA2E6B1F30C54C030037CD509D63940917A6B7FF30C54C092A284CC09D639405028204EF30C54C0416D4CA409D63940F406781FF30C54C065EB0B5E09D639409902D7F4F20C54C0F778CFFB08D63940B13281CFF20C54C088948F8008D639409B1095B0F20C54C0EE6BEBEF07D63940F02CF898F20C54C004552C4E07D6394089A76589F20C54C0DD7E2DA006D639402C7F4A82F20C54C0659A08EB05D63940AF39BE07F20C54C032D9706BE7D53940037B11F6F10C54C07AA5B4B2E5D53940E4B98ECFF10C54C05386BD0BE4D53940C6026095F10C54C01B344F83E2D53940A6D14649F10C54C098A15225E1D539408F5195EDF00C54C0604771FCDFD539404FAC0A85F00C54C0D9B48D11DFD53940F7CAD912F00C54C019EDD46BDED539401C6D709AEF0C54C03DEA3D10DED53940A50D7A1FEF0C54C00D739E01DED53940B8DC1238E80C54C050042E5ADFD5394011AF290FE80C54C0D4DDC956DFD53940F671E5E6E70C54C01CAD253CDFD53940968A4BC0E70C54C0897EF90ADFD53940B81C4D9CE70C54C0ACF66FC4DED53940D3A6D17BE70C54C093695A6ADED53940689CA65FE70C54C0D8FBE0FEDDD53940D0657F48E70C54C094C7AF84DDD5394009A0EE36E70C54C08571ECFEDCD53940902E642BE70C54C03690C370DCD53940C7562A26E70C54C00E45DBDDDBD53940D9705CF0E60C54C045021A88CCD53940A1B9D1F1E60C54C0B6FD6FE3CBD5394001D06BFAE60C54C0B6BE9B41CBD53940DE0AEB09E70C54C01995ABA6CAD5394052E3F01FE70C54C073C77216CAD53940B158F53BE70C54C034FF9394C9D53940F2383F5DE70C54C0A3EF2D24C9D53940E82BFE82E70C54C0B6CA20C8C8D5394061E045ACE70C54C0AF12A682C8D53940A4270BD8E70C54C057388155C8D5394039003E05E80C54C0AB91C441C8D539402A988544EF0C54C0591B841EC7D53940DBCDE4B1EF0C54C05A49EFE8C6D539401BA30D1BF00C54C08704B86FC6D53940F7B8D97CF00C54C0038A76B6C5D53940140F4FD4F00C54C05582C8C2C4D53940103ED01EF10C54C03CA9FD9BC3D5394099771C5AF10C54C03EEA094BC2D53940016D6D84F10C54C01A6B01DAC0D53940A66A749CF10C54C04E131554BFD53940B7DA82A1F10C54C05447F6C4BDD539404AACC845F10C54C0F0052B879FD539400B764B47F10C54C0247871DD9ED53940AE3E2450F10C54C0EFF1AC369ED539407F141B60F10C54C0839A00979DD53940AB79D076F10C54C01F6669029DD5394060DAB093F10C54C032FF897C9CD539400732FEB5F10C54C05FAAB8089CD539403316EADCF10C54C09BF7E6A99BD5394025E27507F20C54C007C75F629BD539405E829334F20C54C0FE1EDC339BD539403D622763F20C54C018E6A51F9BD5394083BCD477F80C54C05773EE509AD539404D1780AFF80C54C0D5A63D5B9AD539406ABEDCE5F80C54C0F431D4879AD53940F0CA4F19F90C54C07C664CD59AD5394068186048F90C54C0D22B77419BD5394031F1A371F90C54C06E9A0FC99BD539408EA3E793F90C54C0870C31689CD53940A1782EAEF90C54C00A81261A9DD53940E5F3ABBFF90C54C01596ACD99DD53940E1B9E1C7F90C54C00A6841A19ED5394004DD644DFA0C54C0CD3CFEE0BBD5394027B8A15EFA0C54C01784087BBDD5394075811E83FA0C54C08DE42B04BFD539403089C2B9FA0C54C0D7EBBD70C0D53940F830EB00FB0C54C06842C5B5C1D53940A1487D56FB0C54C0356999C9C2D53940F3FBE6B7FB0C54C0EC15F4A3C3D5394084CB3B22FC0C54C04553603EC4D539403A465792FC0C54C0B5222994C4D53940A748D604FD0C54C00A16CCA2C4D5394009A51634040D54C04EEE2747C3D5394040407C5D040D54C0490B104BC3D53940FA692F86040D54C0958F8B66C3D53940B1982EAD040D54C0BFF5DE98C3D539406E0C7ED1040D54C0A5A6D8E0C3D5394067223AF2040D54C09CD4A33CC4D53940CDAF8D0E050D54C048A0F5A9C4D539406B70C125050D54C0A30A1426C5D53940039A4737050D54C00D6ED9ADC5D539406276AB42050D54C0F6F1F93DC6D539404CC9A147050D54C08D09C5D2C6D53940F9FCC477050D54C0D49B478BD6D5394044A5FF75050D54C079806737D7D5394087AEA36C050D54C03BDB53E0D7D5394017D4EE5B050D54C06A8CA781D8D5394073F05144050D54C0348B3117D9D53940EF606626050D54C073EE2F9DD9D539408FD8F202050D54C0EF5C1810DAD53940C9D5DEDA040D54C077A50A6DDAD539406C8735AF040D54C0F74B8BB1DAD53940F0781381040D54C01C2FEFDBDAD53940E149AE51040D54C01DAA0BEBDAD53940D96759EFFC0C54C0CDDC3237DBD53940516EF075FC0C54C0B7E647F8DBD5394005DD9506FC0C54C0552B14FDDCD5394021972BA4FB0C54C0ED5BCF3EDED5394007023451FB0C54C0AC6D52B5DFD53940720ED10FFB0C54C0CBC40257E1D539401612ADE1FA0C54C0FEA71719E3D53940539100C8FA0C54C015D90CF0E4D539404AC568C3FA0C54C029BACFCFE6D5394056CE7C26FB0C54C01A09159D04D6394017A07C24FB0C54C06328235005D639403D4BFF19FB0C54C0F4B245FF05D6394095424A07FB0C54C003D335A506D63940D010F2ECFA0C54C0819FF53C07D639404617C6CBFA0C54C0DCD5F2C107D63940624CBCA4FA0C54C0EC1A263008D63940BD580979FA0C54C0626E588408D639406D1DF749FA0C54C0DC8CF2BB08D639409C19F518FA0C54C0035649D508D63940F88C79E7F90C54C0DAD996CF08D63940DAA2E6B1F30C54C030037CD509D63940
0103000020E6100000010000002D000000C7E35E01FD0C54C035402CD6BED539404B7616D0FC0C54C00556BACBBED53940067B08A0FC0C54C0D0FAC9A2BED539402971A472FC0C54C061C58C5CBED53940ECD53E49FC0C54C00C542EFBBDD539400CDC1825FC0C54C0587B7D81BDD53940CB724407FC0C54C067D623F3BCD539402858A2F0FB0C54C0D9F54E54BCD539405958DBE1FB0C54C0E827CCA9BBD5394039FC68DBFB0C54C0CCC3A3F8BAD5394076961B83FB0C54C0875B6A209ED5394059FEC384FB0C54C0B622327F9DD53940A58C6C8DFB0C54C0A378EBE09CD539402D19E39CFB0C54C0AB5193499CD53940FC92BCB2FB0C54C0F58AF2BC9BD539402CDE73CEFB0C54C0339C853E9BD53940679B54EFFB0C54C0276D91D19AD53940D8A88814FC0C54C0C035B4789AD539400888283DFC0C54C024C83F369AD539401B012A68FC0C54C0E47EC30B9AD53940E9367994FC0C54C09A8666FA99D539403AF0E799030D54C014CFD34699D53940DC4AAACA030D54C0AFA5115199D5394088D83BFA030D54C01D7A4D7999D5394072C83527040D54C0EC494BBE99D5394019824650040D54C0E78C131E9AD53940D65C3974040D54C0D488C9959AD539400B3C0192040D54C005B8F7219BD53940944FBFA8040D54C04F8870BE9BD5394076EFC6B7040D54C02C0FB3669CD539401426AABE040D54C014E6BD159DD53940484C1A32050D54C05F0B5050BAD53940BCB7FE30050D54C0353B51E7BAD539402835F828050D54C064008E7BBBD539405AB63E1A050D54C0D134E308BCD53940515E3B05050D54C089505E8BBCD53940939386EA040D54C0648071FFBCD539401288D9CA040D54C0BF72CD61BDD5394062C31AA7040D54C01D94C2AFBDD5394065FC4680040D54C0F2E813E7BDD5394034107257040D54C0BFDF4D06BED53940C141C02D040D54C018DC800CBED539409DAF5904040D54C036B97FF9BDD539406E8165DC030D54C0B042E3CDBDD53940C7E35E01FD0C54C035402CD6BED53940
0103000020E6100000010000002C000000C36BE5E6E80C54C0B47FF1B00BD63940EF577DB7E80C54C0FD1CEBAD0BD63940DB5AD188E80C54C017DFDB8F0BD63940198A0A5CE80C54C0F3D17B570BD6394008684632E80C54C05DFF41060BD6394027FF930CE80C54C06A66299E0AD639400E61E6EBE70C54C04D2ED7210AD63940470A0AD1E70C54C035086A9409D639409587AEBCE70C54C032C56FF908D639400C1056AFE70C54C0C6A9BB5408D639403A7C56A9E70C54C0FFBC7EAA07D63940B9449D4DE70C54C09FD5A67AE9D53940F167834FE70C54C08E0DCDCBE8D539401F210159E70C54C0D1373120E8D539406775DF69E70C54C0DD81317CE7D539404881AE81E70C54C04B97EDE3E6D539407DF9D29FE70C54C015E8235BE6D5394061D98EC3E70C54C0C8704DE5E5D5394097ABF9EBE70C54C068465885E5D539406BD41318E80C54C0A10FAB3DE5D539408DDABE46E80C54C093991A10E5D53940639FD276E80C54C03102D5FDE4D53940940B9755EF0C54C013C20A46E4D5394084F97582EF0C54C040C3324FE4D53940226E36AEEF0C54C09A524C74E4D53940D0BE88D7EF0C54C030A141B4E4D53940E0B82BFDEF0C54C0C7271B0DE5D5394006ECFF1DF00C54C04CBE337CE5D53940CCCE0339F00C54C0E1B62AFEE5D53940A6E46A4DF00C54C095D9258FE6D539409806965AF00C54C01631AB2AE7D539407CFF1D60F00C54C05F2A10CCE7D539405E91FBADF00C54C05F9D791F06D63940324776ABF00C54C067986ECA06D63940730612A1F00C54C0E90C717107D639401BDE1E8FF00C54C05F85C80F08D63940F7561676F00C54C0E66A0CA108D63940B27EB556F00C54C0969A192109D639407625DB31F00C54C063D8578C09D639406CA78D08F00C54C002D0B9DF09D63940B1ECFADBEF0C54C0AE2AF1180AD63940E61566ADEF0C54C0B72464360AD63940F1FA197EEF0C54C0AD7F34370AD63940C36BE5E6E80C54C0B47FF1B00BD63940
0103000020E6100000010000002A000000A02CDD25E70C54C0C2326A6993D53940D7CFEEF8E60C54C0343DFE5D93D53940A11236CDE60C54C026FEF33693D539407003F8A3E60C54C02CB06BF592D539408F266D7EE60C54C05354609B92D539409C19B05DE60C54C06A30692B92D53940EBC0B842E60C54C0F396D5A891D539404CC64E2EE60C54C069C27F1791D53940C9591021E60C54C0E585B47B90D539400CE75E1BE60C54C0A944F8D98FD539401A2EF7F4E40C54C03C7C830329D5394080D598F6E40C54C08B99D75D28D53940D3EF68FFE40C54C0A11E32BB27D53940A4B82A0FE50C54C07A03901F27D539402CB27E25E50C54C04D86CB8E26D539406B2DD441E50C54C04A478E0C26D53940F5CA7663E50C54C0744D0F9C25D53940F95F9189E50C54C05AEA204025D53940E2E32FB3E50C54C08E9503FB24D53940A2034BDFE50C54C00DC27ACE24D5394052FDCB0CE60C54C0A7E38ABB24D53940DCD6170BED0C54C0704C58DD23D53940A0093639ED0C54C0290EA9E523D5394097833C66ED0C54C0DF36D40A24D539400D10CF90ED0C54C0EA7CC04B24D53940A21F9BB7ED0C54C0F8065EA624D5394096817AD9ED0C54C06B13121825D53940361061F5ED0C54C00F6D3D9D25D53940C2B2770AEE0C54C07A6AFB3126D53940815D1C18EE0C54C010CEB2D126D53940DC23E01DEE0C54C00043967727D53940FA5AC93CEF0C54C0C39A7F648ED539404BF6CE3AEF0C54C092383F0D8FD53940E3090531EF0C54C0AC0E6AB28FD539409F1AAF1FEF0C54C0D445364F90D53940D8714D07EF0C54C0ECBB3EDF90D539403F9C8FE8EE0C54C06F49605E91D5394067215CC4EE0C54C016CBF4C891D53940A778B69BEE0C54C02DE9EE1B92D5394064A5C96FEE0C54C0D9EDEE5492D5394065E3D541EE0C54C0BF7E657292D53940A02CDD25E70C54C0C2326A6993D53940
You can use ST_ConvexHull
SELECT building_group_id,
ST_ConvexHull(
ST_Collect(geom))
FROM mylayer
GROUP BY building_group_id;
I ran st_concavehull:
SELECT
ST_ConcaveHull(ST_union(thegeom), 0.5) As geom
FROM buildings As d
which gave me this:
You can play with the "shrink factor", the smaller you make the number the more it will shrink but will take a lot longer to process...
For reference, st_convexhull gave me this:
Related
I'm not sure if this is a geometry problem or a normal problem but I am having a hard time combining meshes without leaving a "seam" or visible discontinuity. In the example below I have a simple example with two sphere polygons with matching divisions. I have done a union and merged nearby vertices. I then tried to do a little manual adjustment to smooth it, but as you can see the result is not good.
I know that I can use the smooth tool to smooth it by adding new geometry, but I feel like given that the vertices match perfectly here I should be able to fix this through some other means. I've played with "soften edge normals" but I don't see any effect from that. I've tried averaging vertices but that doesn't seem to do much. I've gone to the sculpting tools and using the relax and smooth tools there... No matter how correct the geometry looks to me it still appears discontinuous unless I use the add-geometry smoothing tool.
What is the correct way to merge geometry like this?
thanks.
UPDATE:
I'm going to mark the answer below correct even thought it is basically one of the procedures I tried before. I think the real answer is that I just wasn't performing the merge very well (cutting the geometry and merging the edges in the cleanest way possible) prior to softening the edge.
Here is how to merge geometry and get rid of unpleasant seam from scratch:
a) Delete a history for each object (Edit–>DeleteByType–>History)
b) Combine a mesh (Mesh–>Combine)
c) Merge the edges, controlling a tolerance (EditMesh–>Merge)
d) Soften the edges, controlling an angle (MeshDisplay–>SoftenEdge)
Remember, Angle parameter makes the edge hard/soft.
Here are MEL equivalents:
// Deleting a history
DeleteHistory;
// Combining a mesh
polyUnite;
// Merge border edges within a given threshold
polySewEdge;
// Softening the edge (angle = 0...180)
polySoftEdge;
MEL example for softening the edge:
select -r pSphere2.e[35:54];
polySoftEdge -a 180;
I would like to plot the locus of a particle in two dimensional space.
My data is a sequence of X,Y coordinates and I would like to plot these.
Would appreciate any pointers to examples that show how to do this.
An example of a locus plot can be seen below:
Note: I'd like to show the path as a continuous line with arrows showing the direction of motion.
Thanks.
ChartFactory.createScatterPlot(), illustrated here, might be a good starting point.
FastScatterPlot, cited here and illustrated here, may be required for larger datasets.
Addendum: Looking at your revised question, I've not seen a renderer like that. You might look at a org.jfree.chart.annotations such as XYShapeAnnotation using a GeneralPath. These ArcTest variations may offer guidance. See also PointyThing.
I want to know certain method so that i can tell if a pixel is inside a 4-point polygon or quadrilateral figure (not necessarily to be rectangle) given the 4 co-ordinates of that polygon.
I tried several methods, but none of them worked really well.
Thanx and Regards
Uday Gupta
A simple method is to use areas : You first decompose your polygon into two triangles ABC and CDA, and check whether the point is in either triangle.
For that, assuming the triangle ABC for example and your point to test is M, you can test whether the area of the triangle ABC is equal to the sum of the areas of ABM + BCM + CAM.
Computing the area of a triangle is done using half the norm of the cross product.
Another solution that directly uses cross products can be found here:
http://www.blackpawn.com/texts/pointinpoly/default.html
I am now working on an eye tracking project. In this project I am tracking eyes in a webcam video (resolution if 640X480).
I can locate and track the eye in every frame, but I need to locate the pupil. I read a lot of papers and most of them refer to Alan Yuille's deformable template method to extract and track the eye features. Can anyone help me with the code of this method in any languages (matlab/OpenCV)?
I have tried with different thresholds, but due to the low resolution in the eye regions, it does not work very well. I will really appreciate any kind of help regarding finding pupil or even iris in the video.
What you need to do is to convert your webcam to a Near-Infrared Cam. There are plenty of tutorials online for that. Try this.
A Image taken from an NIR cam will look something like this -
You can use OpenCV then to threshold.
Then use the Erode function.
After this fill the image with some color takeing a corner as the seed point.
Eliminate the holes and invert the image.
Use the distance transform to the nearest non-zero value.
Find the max-value's coordinate and draw a circle.
If you're still working on this, check out my OptimEyes project: https://github.com/LukeAllen/optimeyes
It uses Python with OpenCV, and works fairly well with images from a 640x480 webcam. You can check out the "Theory Paper" and demo video on that page also. (It was a class project at Stanford earlier this year; it's not very polished but we made some attempts to comment the code.)
Depending on the application for tracking the pupil I would find a bounding box for the eyes and then find the darkest pixel within that box.
Some psuedocode:
box left_location = findlefteye()
box right_location = findrighteye()
image_matrix left = image[left_location]
image_matrix right = image[right_location]
image_matrix average = left + right
pixel min = min(average)
pixel left_pupil = left_location.corner + min
pixel right_pupil = right_location.corner + min
In the first answer suggested by Anirudth...
Just apply the HoughCirles function after thresholding function (2nd step).
Then you can directly draw the circles around the pupil and using radius(r) and center of eye(x,y) you can easily find out the Center of Eye..
I'm trying to run a distance transform on a thresholded binary image in
order to assist anomaly detection (my hope is that I can detect large
changes around the edges of the object), however for some reason, upon
running my Distance Transform script, I'm getting a strange banding type of
effect. I tested something similar in the Distance Transform demo script in
the samples directory, with the same results. One possible reason I came up
with was that the distance was going beyond the 0-255 scale and therefore
essentially being modulus'ed to keep it within the boundaries. Has anyone
had any experience with this that could advise?
I have posted images and code on my blog if that helps
Thanks in advance,
Ian
One quick way to test your theory: try with a grey scale image that's muted (all values v --> 128+(v-128)/32 or something) and see if that makes the bands much wider or eliminates them completely.
It's always a good idea to nail down what the problem is first, and then try to fix it.
I can't help with the code, but I'd like to point out that the expected result on your blog is probably incorrect as well: look at the sharp black-gray border in the bottom part of the large object: it should not be there, as the maximum difference between two adjacent pixels should be 1.