[postgis-users] help with the Union of 2 shp

islanis at infomed.sld.cu islanis at infomed.sld.cu
Thu Dec 12 10:21:00 PST 2013


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" <remi.cura at gmail.com> 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 <islanis at infomed.sld.cu>
>>
>>> 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" <remi.cura at gmail.com> 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 <islanis at infomed.sld.cu>
>>>>
>>>> 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" <remi.cura at gmail.com> 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 <islanis at infomed.sld.cu>
>>>>>>
>>>>>> 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 <
>>>>>>>>
>>>>>>>> islanis at infomed.sld.cu> 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
>>>>>>>>>  postgis-users at lists.osgeo.org
>>>>>>>>>  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
>>>>>>> postgis-users at lists.osgeo.org
>>>>>>> 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/


-------------- next part --------------
A non-text attachment was scrubbed...
Name: result.PNG
Type: image/png
Size: 35340 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20131212/8d243931/attachment.png>


More information about the postgis-users mailing list