OK, with luck you won't have precision issues. (please note that the only good way to do this is to use postgis_topology and faces.)
So here is one idea to do it : table1 : first image, very big shape table 2 : second image, smal rectangular shape table 3 third image , mdium irregular shape 1.) convert poly from table 1 and table 3 to linestring. (i called these lines dumped_lines for the following) You can do it manually or use the function I wrote (beta) https://github.com/Remi-C/PPPP_utilities/blob/master/postgis/rc_DumpLines.sql 2.) split poly from table 2 by the dumped_lines from table 1 ( http://postgis.net/docs/ST_Split.html) . The result are polygons 3.) Split the result from 2. by dumpl_lines from table 3. The result are polygons. 3. is what you want geometrically. I'll call it splited_polygons for the following Now you want to get, for each splitted_polygons, the id of polygons of table 1, and 3 which overlaps. You already have id from table 2 because you can keep it during computing of 2. and 3. you can do it sequentially : SELECT DISTINCT ON (sp.geom) sp.geom, aray_agg(id) AS id_table1 FROM splited_polygons AS sp, table_1 WHERE ST_Overlaps(sp.geom, table_1.geom)=TRUE , then the same type of query on result, with table 3 Cheers, Rémi-C 2013/12/12 <[email protected]> > I want to create little pieces of multipolygons from these 3 shapes (A,B > and C)=result , result with all the sections formed with the intersection > from the 3 shapes together, come on tell me , do you understand now what i > want > thanks > > no never mind am not offended, am trying that you understand Ok, here >> are png of my 3 multipolygon shapes, what else do you need >> >> "Rémi Cura" <[email protected]> escribió: >> >> Sorry I'm not trying to offend you. >>> >>> For example in this thread >>> https://groups.google.com/forum/#!topic/postgis-users/9pozIoUAZuI >>> The asker posted an image to explain better. >>> >>> Cheers, >>> Rémi-C >>> >>> >>> 2013/12/12 <[email protected]> >>> >>> no is not dificult to understand, what ever you want i'll give , just >>>> ask >>>> what do you want to a better understanding. please i need it >>>> >>>> "Rémi Cura" <[email protected]> escribió: >>>> >>>> >>>> I'm very sorry it is difficult to understand what you mean. >>>> >>>>> Maybe with a real drawing and link here to it, or to some screenshots? >>>>> ;-) >>>>> >>>>> Cheers, >>>>> >>>>> Rémi-C >>>>> >>>>> 2013/12/12 <[email protected]> >>>>> >>>>> thanks for the quick answer Rémi, but, thats right thats one of >>>>> answers, >>>>> >>>>>> but my idea was not complete,because there is a >>>>>> 3rd shape, your answer works fine for the 1st and 2dn shapes, but not >>>>>> with >>>>>> the 3rd, because the 3rd has not suares inside, >>>>>> the 3rd shape have big triangles inside,the idea is that i need some >>>>>> routine that merge or blend the spatial data and with it the >>>>>> attributes >>>>>> of respective data, i need some ideas for do that, and am working on >>>>>> it, >>>>>> but not sucess, please i need help, thanks for all. >>>>>> >>>>>> >>>>>> 1-the first shapefile >>>>>> __________________ >>>>>> | | >>>>>> | | >>>>>> | 1 | shp=A >>>>>> | | >>>>>> | | >>>>>> |_________________| >>>>>> num of poligons=1 >>>>>> >>>>>> >>>>>> The one big country, this is a multipolygon shape >>>>>> >>>>>> DATA=>dni01 numeric,dni02 numeric,dni03 numeric, >>>>>> dni04 numeric,dni05 numeric,dni06 numeric, >>>>>> dni07 numeric,dni08 numeric,dni09 numeric, >>>>>> dni10 numeric,dni11 numeric,dni12 numeric, >>>>>> dniann numeric,the_geom geometry >>>>>> >>>>>> 2-and the second shapefile >>>>>> __________________ >>>>>> | 2 | 2 | >>>>>> |________|________| >>>>>> | 2 | 2 | shp=B >>>>>> |________|________| >>>>>> | 2 | 2 | >>>>>> |________|________| >>>>>> num of poligons = 6 >>>>>> >>>>>> The same country, but this time in little pieces, the states, this is >>>>>> a >>>>>> multipolygon shape too >>>>>> >>>>>> DATA=>dni01 numeric,dni02 numeric,dni03 numeric, >>>>>> dni04 numeric,dni05 numeric,dni06 numeric, >>>>>> dni07 numeric,dni08 numeric,dni09 numeric, >>>>>> dni10 numeric,dni11 numeric,dni12 numeric, >>>>>> dniann numeric,the_geom geometry >>>>>> >>>>>> >>>>>> 3-and the second shapefile >>>>>> __________________ >>>>>> | / | >>>>>> | / | >>>>>> | 3 / | shp=C >>>>>> | / | >>>>>> | / 4 | >>>>>> |_____/___________| >>>>>> num of poligons = 2 >>>>>> >>>>>> The same country, but this time in little pieces, the states, this is >>>>>> a >>>>>> multipolygon shape too >>>>>> >>>>>> DATA=>dni01 numeric,dni02 numeric,dni03 numeric, >>>>>> dni04 numeric,dni05 numeric,dni06 numeric, >>>>>> dni07 numeric,dni08 numeric,dni09 numeric, >>>>>> dni10 numeric,dni11 numeric,dni12 numeric, >>>>>> dniann numeric,the_geom geometry >>>>>> >>>>>> >>>>>> >>>>>> and i want join the 2 shapes in only one shapefile getting something >>>>>> like >>>>>> this >>>>>> >>>>>> ______________________________ >>>>>> | | / | >>>>>> | |1,2,3 / | >>>>>> | 1,2,3 | /1,2,4 | >>>>>> | | / | >>>>>> |______________|____/_________| >>>>>> | |1,2/ | shp=A and B >>>>>> | |,3/ | >>>>>> | 1,2,3 | / 1,2,4 | >>>>>> | |/ | >>>>>> |______________/______________| >>>>>> | /| | >>>>>> | / | | >>>>>> | 1,2,3 /1,| 1,2,4 | >>>>>> | /2,4| | >>>>>> |_________/____|______________| >>>>>> num of poligons = 9 >>>>>> >>>>>> >>>>>> DATA=>dni01A numeric,dni02A numeric,dni03A numeric,dni04A numeric, >>>>>> dni05A numeric,dni06A numeric,dni07A numeric,dni08A numeric, >>>>>> dni09A numeric,dni10A numeric,dni11A numeric,dni12A numeric, >>>>>> dniannA numeric,dni01B numeric,dni02B numeric,dni03B numeric, >>>>>> dni04B numeric,dni05B numeric,dni06B numeric,dni07B numeric, >>>>>> dni08B numeric,dni09B numeric,dni10B numeric,dni11B numeric, >>>>>> dni12B numeric,dniannB numeric,dni01C numeric,dni02C numeric, >>>>>> dni03C numeric,dni04C numeric,dni05C numeric,dni06C numeric, >>>>>> dni07C numeric,dni08C numeric,dni09C numeric,dni10C numeric, >>>>>> dni11C numeric,dni12C numeric,dniannC numeric,the_geom geometry >>>>>> >>>>>> "Rémi Cura" <[email protected]> escribió: >>>>>> >>>>>> >>>>>> Seems like If you want : >>>>>> >>>>>> for each little square, get the id of big square overlaping. >>>>>>> If this is simply this, you don't need the "intersection" function, >>>>>>> but only the "intersects" function : >>>>>>> >>>>>>> You could do something like this >>>>>>> >>>>>>> SELECT ss.id, bs.id , ss.geom >>>>>>> FROM smal_square_table AS ss, big_square_table AS bs >>>>>>> WHERE ST_Intersects(ss.geom,bs.geom)=TRUE >>>>>>> >>>>>>> Cheers, >>>>>>> Rémi-C >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> 2013/12/12 <[email protected]> >>>>>>> >>>>>>> Hi, >>>>>>> >>>>>>> >>>>>>>> >>>>>>>> Try pg 21 of this: http://presentations.opengeo. >>>>>>>>> org/2011_FOSS4G/postgis-power.pdf >>>>>>>>> >>>>>>>>> That will give you the metacode. >>>>>>>>> >>>>>>>>> Overlays. (he sighs.) Be glad you only have 2 layers... . >>>>>>>>> >>>>>>>>> Best, >>>>>>>>> Steve >>>>>>>>> >>>>>>>>> Hey steve thanks for the book is really good as a resume, but the >>>>>>>>> only >>>>>>>>> >>>>>>>>> apart that it have to do with my problem is the intersection of 2 >>>>>>>> shapes >>>>>>>> "SELECT >>>>>>>> a.*, b.*, >>>>>>>> ST_Intersection(a.geom, b.geom) >>>>>>>> FROM >>>>>>>> a, b >>>>>>>> WHERE >>>>>>>> ST_Intersects(a.geom, b.geom);" >>>>>>>> >>>>>>>> but my problem is different, i got as a mention 2 shapes with the >>>>>>>> same >>>>>>>> projection and place, >>>>>>>> and are the same but one is from one study, and the other is from >>>>>>>> other >>>>>>>> stufy, but are the same >>>>>>>> place and each one have data, the only things that they got >>>>>>>> different >>>>>>>> are >>>>>>>> the size of the squares,the data they got and the >>>>>>>> name of the columns are the same, but the values are different cause >>>>>>>> the >>>>>>>> type of the study >>>>>>>> ,there is one that have the squares more smaller that the other, >>>>>>>> but i >>>>>>>> dont want lose any data, i need that in the map it has seen like >>>>>>>> the figure "A and B" but in the data each row got the values of A >>>>>>>> and >>>>>>>> the >>>>>>>> values of B >>>>>>>> >>>>>>>> 1-the first shapefile >>>>>>>> __________________ >>>>>>>> | | >>>>>>>> | | >>>>>>>> | 1 | shp=A >>>>>>>> | | >>>>>>>> | | >>>>>>>> |_________________| >>>>>>>> >>>>>>>> The one big country, this is a multipolygon shape >>>>>>>> >>>>>>>> DATA=>dni01 numeric,dni02 numeric,dni03 numeric, >>>>>>>> dni04 numeric,dni05 numeric,dni06 numeric, >>>>>>>> dni07 numeric,dni08 numeric,dni09 numeric, >>>>>>>> dni10 numeric,dni11 numeric,dni12 numeric, >>>>>>>> dniann numeric,the_geom geometry >>>>>>>> >>>>>>>> >>>>>>>> 2-and the second shapefile >>>>>>>> __________________ >>>>>>>> | 2 | 2 | >>>>>>>> |________|________| >>>>>>>> | 2 | 2 | shp=B >>>>>>>> |________|________| >>>>>>>> | 2 | 2 | >>>>>>>> |________|________| >>>>>>>> The same country, but this time in little pieces, the states, this >>>>>>>> is >>>>>>>> a >>>>>>>> multipolygon shape too >>>>>>>> >>>>>>>> DATA=>dni01 numeric,dni02 numeric,dni03 numeric, >>>>>>>> dni04 numeric,dni05 numeric,dni06 numeric, >>>>>>>> dni07 numeric,dni08 numeric,dni09 numeric, >>>>>>>> dni10 numeric,dni11 numeric,dni12 numeric, >>>>>>>> dniann numeric,the_geom geometry >>>>>>>> >>>>>>>> >>>>>>>> and i want join the 2 shapes in only one shapefile getting something >>>>>>>> like >>>>>>>> this >>>>>>>> >>>>>>>> __________________ >>>>>>>> | 1,2 | 1,2 | >>>>>>>> |________|________| >>>>>>>> | 1,2 | 1,2 | shp=A and B >>>>>>>> |________|________| >>>>>>>> | 1,2 | 1,2 | >>>>>>>> |________|________| >>>>>>>> >>>>>>>> DATA=>dni01A numeric,dni02A numeric,dni03A numeric,dni04A numeric, >>>>>>>> dni05A numeric,dni06A numeric,dni07A numeric,dni08A numeric, >>>>>>>> dni09A numeric,dni10A numeric,dni11A numeric,dni12A numeric, >>>>>>>> dniannA numeric,dni01B numeric,dni02B numeric,dni03B numeric, >>>>>>>> dni04B numeric,dni05B numeric,dni06B numeric,dni07B numeric, >>>>>>>> dni08B numeric,dni09B numeric,dni10B numeric,dni11B numeric, >>>>>>>> dni12B numeric,dniannB numeric,the_geom geometry >>>>>>>> >>>>>>>> i think that this is posible to do with postgis, but i dont know >>>>>>>> why, >>>>>>>> am >>>>>>>> looking in quantumGIS but i lose data cause the big suare overlap >>>>>>>> the >>>>>>>> little >>>>>>>> ones and i lose data cause there is some places that i get NULL. >>>>>>>> >>>>>>>> please help >>>>>>>> thanks for all >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>>> >>>>>>>>> On Mon, Dec 9, 2013 at 11:03 AM, J.Alejandro Martinez Linares < >>>>>>>>> >>>>>>>>> [email protected]> wrote: >>>>>>>>> >>>>>>>>>> >>>>>>>>>> Hi People, i need your help, let say that i have 2 shapefiles >>>>>>>>>> >>>>>>>>>> 1-the first shapefile >>>>>>>>>> __________________ >>>>>>>>>> | | >>>>>>>>>> | | >>>>>>>>>> | 1 | shp=B >>>>>>>>>> | | >>>>>>>>>> | | >>>>>>>>>> |_________________| >>>>>>>>>> >>>>>>>>>> One big country, this is a multipolygon shape >>>>>>>>>> >>>>>>>>>> 2-and the second shapefile >>>>>>>>>> __________________ >>>>>>>>>> | 2 | 2 | >>>>>>>>>> |________|________| >>>>>>>>>> | 2 | 2 | shp=B >>>>>>>>>> |________|________| >>>>>>>>>> | 2 | 2 | >>>>>>>>>> |________|________| >>>>>>>>>> The same country, but this time in little pieces, the states, >>>>>>>>>> this >>>>>>>>>> is >>>>>>>>>> a multipolygon shape too >>>>>>>>>> >>>>>>>>>> and i want join the 2 shapes in only one shapefile getting >>>>>>>>>> something >>>>>>>>>> like this >>>>>>>>>> >>>>>>>>>> __________________ >>>>>>>>>> | 1,2 | 1,2 | >>>>>>>>>> |________|________| >>>>>>>>>> | 1,2 | 1,2 | shp=A and B >>>>>>>>>> |________|________| >>>>>>>>>> | 1,2 | 1,2 | >>>>>>>>>> |________|________| >>>>>>>>>> >>>>>>>>>> i think that this is posible, please help me to get somthing like >>>>>>>>>> this i need it. >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> -- >>>>>>>>>> >>>>>>>>>> Este mensaje le ha llegado mediante el servicio de correo >>>>>>>>>> electronico >>>>>>>>>> que ofrece Infomed para respaldar el cumplimiento de las misiones >>>>>>>>>> del >>>>>>>>>> Sistema Nacional de Salud. La persona que envia este correo asume >>>>>>>>>> el >>>>>>>>>> compromiso de usar el servicio a tales fines y cumplir con las >>>>>>>>>> regulaciones >>>>>>>>>> establecidas >>>>>>>>>> >>>>>>>>>> Infomed: http://www.sld.cu/ >>>>>>>>>> >>>>>>>>>> _______________________________________________ >>>>>>>>>> postgis-users mailing list >>>>>>>>>> [email protected] >>>>>>>>>> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> ---------------------------------------------------------------- >>>>>>>> This message was sent using IMP, the Internet Messaging Program. >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>>> >>>>>>>> Este mensaje le ha llegado mediante el servicio de correo >>>>>>>> electronico >>>>>>>> que >>>>>>>> ofrece Infomed para respaldar el cumplimiento de las misiones del >>>>>>>> Sistema >>>>>>>> Nacional de Salud. La persona que envia este correo asume el >>>>>>>> compromiso >>>>>>>> de >>>>>>>> usar el servicio a tales fines y cumplir con las regulaciones >>>>>>>> establecidas >>>>>>>> >>>>>>>> Infomed: http://www.sld.cu/ >>>>>>>> >>>>>>>> _______________________________________________ >>>>>>>> postgis-users mailing list >>>>>>>> [email protected] >>>>>>>> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>> ---------------------------------------------------------------- >>>>>> This message was sent using IMP, the Internet Messaging Program. >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> >>>>>> Este mensaje le ha llegado mediante el servicio de correo electronico >>>>>> que >>>>>> ofrece Infomed para respaldar el cumplimiento de las misiones del >>>>>> Sistema >>>>>> Nacional de Salud. La persona que envia este correo asume el >>>>>> compromiso >>>>>> de >>>>>> usar el servicio a tales fines y cumplir con las regulaciones >>>>>> establecidas >>>>>> >>>>>> Infomed: http://www.sld.cu/ >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>> >>>> ---------------------------------------------------------------- >>>> This message was sent using IMP, the Internet Messaging Program. >>>> >>>> >>>> >>>> -- >>>> >>>> Este mensaje le ha llegado mediante el servicio de correo electronico >>>> que >>>> ofrece Infomed para respaldar el cumplimiento de las misiones del >>>> Sistema >>>> Nacional de Salud. La persona que envia este correo asume el compromiso >>>> de >>>> usar el servicio a tales fines y cumplir con las regulaciones >>>> establecidas >>>> >>>> Infomed: http://www.sld.cu/ >>>> >>>> >>>> >>> >> >> ---------------------------------------------------------------- >> This message was sent using IMP, the Internet Messaging Program. >> >> >> -- >> >> Este mensaje le ha llegado mediante el servicio de correo electronico que >> ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema >> Nacional de Salud. La persona que envia este correo asume el compromiso de >> usar el servicio a tales fines y cumplir con las regulaciones establecidas >> >> Infomed: http://www.sld.cu/ >> >> >> >> > > > ---------------------------------------------------------------- > This message was sent using IMP, the Internet Messaging Program. > > > -- > > Este mensaje le ha llegado mediante el servicio de correo electronico que > ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema > Nacional de Salud. La persona que envia este correo asume el compromiso de > usar el servicio a tales fines y cumplir con las regulaciones establecidas > > Infomed: http://www.sld.cu/ > > > > _______________________________________________ > postgis-users mailing list > [email protected] > http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users >
_______________________________________________ postgis-users mailing list [email protected] http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
