[postgis-users] GEOS intersection - with a result containg 2 or more polygons

Tom Melhuish tmelhuish at webinsightsinc.com
Tue Mar 23 11:43:28 PST 2004


Dear users,

I found that the “intersection(geometry,geometry)” works fine if I have one
polygon generated as the result of the intersection. When I have an
intersection that should results in two separate polygons the
“intersection(geometry,geometry)” module can't handle this and the resulting
geometry is skewed outside the extents. This is what resulted in my output
listed below. Has anybody else ran across this an wrote logic to address
this type of situation?

Thanks,
tom

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net]On Behalf Of Tom
Melhuish
Sent: Monday, March 22, 2004 7:52 PM
To: postgis-users at postgis.refractions.net
Subject: [postgis-users] GEOS intersection - geometry outside boundries
&extents


I’m trying to calculate the area and view the different soil types that
might be within a parcel. I’m using the “intersection(geometry,geometry)”
GOES module to do this in Postgis. When I perform then operation resulting
geometry is partially the intersection then it shoots off the image outside
of the extents provided. I’m running PostGIS 8.1 with Postgresql 7.4.1 and a
CVS version of Mapserver that is about a month old. ( I needed the fixes to
Styles – getStyles). I’m not receiving any error messages, so please let me
know what I can provide you to help debug the problem.

My logic and SQL commands are as follows:

1) A point is selected on the parcel to perform the soil analysis
SELECT tag, the_geom  FROM  jcparcels WHERE the_geom &&
GeometryFromText('BOX3D(2191224.56399557   641014.375, 2193496.77138443
642751.25619 )',1) AND Distance(GeometryFromText('POINT(2192334.17418821
641952.976863896)',1),the_geom) < 1

2) The parcel found is used to calculate the extents to contain just this
parcel.
SELECT extent(the_geom) FROM  jcparcels WHERE tag='15080011'

3) This parcel extent is then used to get all of the soil segments that are
contained in this parcel
SELECT gid  FROM  jcsoil WHERE the_geom &&
GeometryFromText('BOX3D(2191620.58538 641014.375,2193100.75
642751.25619)',1)

4) Each of these soil segments are passed in a loop to the “intersection”
command to obtain the intersecting geometry of the soil segment and parcel.
SELECT intersection(the_geom,(SELECT the_geom FROM  jcsoil WHERE
gid='10834' ))  FROM  jcparcels WHERE the_geom &&
GeometryFromText('BOX3D(2191620.58538 641014.375,2193100.75
642751.25619)',1) AND Distance(GeometryFromText('POINT(2192334.17418821
641952.976863896)',1),the_geom) < 1

My results that are outside of the extent, soil, and parcel geometry
boundries
++++++++++++++++++++++++++++++++++
SRID=1;POLYGON((2193071.68646288 641841.996200874,2193067.75
641839.4375,2193062.25 641835.6875,2193055.5 641831.375,2193049.5
641828,2193039.5 641823,2193035 641820.625,2193030 641818.0625,2193018.5
641812.3125,2193012.75 641809.875,2193006 641807.125,2193000.25
641805,2192995.25 641803.375,2192990.5 641801.6875,2192986
641799.75,2192981.25 641797.375,2192976.25 641794.6875,2192972
641792.125,2192968.5 641789.5,2192963.5 641786.1875,2192959.5
641783.625,2192956.5 641781.4375,2192954 641779.125,2192951.75
641776.0625,2192949.25 641772.625,2192946.25 641769.1875,2192943
641766.5625,2192939.75 641764.5625,2192936 641762.5,2192925.5
641756.9375,2192915.75 641752.4375,2192906.5 641748.5,2192902.75
641746.4375,2192898.5 641744.125,2192894 641741.3125,2192889.5
641738.125,2192885.75 641735.0625,2192881.5 641731.6875,2192875.75
641727.5625,2192870.25 641724.1875,2192865 641721.1875,2192859.75
641718.3125,2192854 641715.375,2192848 641712.0625,2192842.5
641708.9375,2192837.25 641706.0625,2192831 641702.8125,2192825
641699.9375,2192820 641697.5625,2192815.5 641695.0625,2192811.75
641692.375,2192807.5 641689.3125,2192803 641686.1875,2192799.25
641684.0625,2192796 641682.1875,2192792.25 641679.5625,2192788.75
641676.125,2192786 641672.875,2192783.5 641670,2192780.5 641667.75,2192777
641665.75,2192773 641663.5625,2192769 641661.0625,2192765.25
641658.75,2192761 641656.25,2192754 641652.1875,2192748 641648.375,2192742.5
641644.375,2192739.25 641641.375,2192735.75 641638.0625,2192731.75
641634.5625,2192728.25 641631.9375,2192725.25 641629.875,2192721.5
641627.5625,2192716.5 641624.4375,2192712.25 641621.5625,2192708.25
641618.75,2192704.5 641615.5,2192700.5 641611.6875,2192696.25
641606.875,2192694 641604,2192692 641601.5,2192689.75 641599.0625,2192686.75
641597.0625,2192683.75 641595.6875,2192680.75 641594.6875,2192676.5
641593.125,2192672.25 641591.25,2192667.75 641588.875,2192663
641585.625,2192659.25 641582,2192655 641577.75,2192651.25
641574.3125,2192645.75 641568.0625,2192643.25 641565,2192640.75
641561.75,2192638 641558.5625,2192633.75 641554.875,2192629.5
641551.8125,2192624.25 641547.9375,2192620 641544.3125,2192616.5
641541.375,2192613 641538.75,2192610 641536.75,2192607 641534.6875,2192603.5
641532.4375,2192599.75 641529.8125,2192596.75 641527.0625,2192593.25
641523.375,2192591.25 641520.5,2192589.75 641518,2192588.25
641515.75,2192585 641512.5625,2192580.75 641509.625,2192576.25
641506.375,2192570.5 641501.8125,2192565.5 641497.625,2192559.75
641492.75,2192554.75 641488.625,2192550.25 641485.0625,2192546.25
641481.625,2192543.25 641478.8125,2192540 641475.75,2192536.75
641472.25,2192534.5 641469.6875,2192532.75 641467.25,2192530.75
641464.0625,2192529.75 641462.375,2192528.75 641461,2192528
641459.875,2192526.75 641458.75,2192525 641457.6875,2192523.25
641456.5625,2192521.5 641455.5,2192520 641454.5,2192518.25
641453.0625,2192516.75 641451.4375,2192516 641449.875,2192515
641448.375,2192513.75 641446.8125,2192512.25 641445.25,2192510.5
641443.5625,2192508.25 641441.375,2192506.25 641439.5,2192504
641437.25,2192500.5 641433.9375,2192500 641433.5,2192497.25
641429.75,2192494 641426.8125,2192486 641420.875,2192478.5
641416.1875,2192471 641412.4375,2192467.25 641409.5625,2192463
641406.5625,2192458 641403.5,2192452.25 641400.8125,2192447
641399.0625,2192441.25 641396.8125,2192436.75 641394.4375,2192433
641391.75,2192430.25 641388.6875,2192429.25 641386.875,2192428
641384.8125,2192427 641382.4375,2192425.75 641379.625,2192424.75
641377.1875,2192423.75 641374.6875,2192420.75 641369.0625,2192417.5
641363.875,2192414 641359,2192407.25 641348.875,2192403.5
641342.6875,2192400.75 641338.0625,2192398.5 641334.0625,2192396
641329.6875,2192392.75 641324.375,2192389.5 641319.6875,2192386.25
641315.4375,2192383.75 641312.375,2192380.75 641309.1875,2192377.5
641305.625,2192374.5 641302.5,2192371.5 641299.875,2192368.5
641297,2192364.25 641292.9375,2192360.5 641289.0625,2192357.25
641285.125,2192353.5 641278.625,2192350.5 641271.25,2192346.75
641263.125,2192343.75 641257.125,2192340.75 641251.8125,2192337.5
641245.9375,2192332.5 641237.1875,2192328.25 641229.4375,2192324
641222.125,2192317.25 641210.3125,2192313.5 641203.3125,2192310.75
641198.1875,2192308.25 641193.6875,2192305.5 641188.6875,2192300.75
641180.75,2192296.25 641173.6875,2192292 641167.125,2192288
641161,2192283.75 641154.5,2192279 641147.3125,2192274.25
641140.3125,2192270 641134.125,2192264.75 641126.625,2192260.75
641120.8125,2192257.75 641115.9375,2192254.75 641111.3125,2192251.5
641106.375,2192248.25 641101.125,2192244.5 641095.625,2192240.25
641089.875,2192236.5 641084.625,2192232 641078.125,2192228.5
641072.6875,2192226 641067.9375,2192223.75 641063.4375,2192220.25
641056,2192216.5 641048.0625,2192212.5 641039.625,2192209.75
641033.8125,2192207.25 641028.375,2192204.25 641021.6875,2192201
641014.375,2192106.87151282 641182.345332897,2192111 641196.75,2192115.5
641216.25,2192120.2 641235.69,2192125 641255.19,2192131.2
641274.19,2192139.8 641292.25,2192148.8 641310.12,2192155.8
641328.81,2192161 641348.12,2192167 641367.19,2192174.8 641385.62,2192183
641403.81,2192191.8 641421.94,2192200.5 641439.88,2192210.2
641457.38,2192221 641474.12,2192232.5 641490.62,2192243.8 641507.19,2192255
641523.75,2192266.5 641540,2192278.8 641555.81,2192291.2 641571.5,2192303.5
641587.19,2192316 641602.88,2192328.2 641618.62,2192340 641634.81,2192352.5
641650.56,2192366.5 641664.81,2192381.2 641678.19,2192395
641692.69,2192407.2 641708.56,2192419 641724.81,2192431.2
641740.69,2192443.5 641756.44,2192456.8 641771.38,2192471
641785.31,2192485.2 641799.56,2192497.5 641815.19,2192509.2
641831.44,2192521.8 641847,2192535.2 641861.75,2192549 641876.44,2192562.2
641891.44,2192575.2 641906.56,2192588.2 641921.75,2192601.2
641937.06,2192614 641952.31,2192626.8 641967.75,2192640 641982.94,2192654.2
641996.75,2192670 642009.19,2192685.5 642021.75,2192700.2
642035.31,2192714.8 642049.06,2192730 642061.94,2192746 642074.12,2192761.8
642086.19,2192777.5 642098.56,2192793.5 642110.81,2192809.5
642122.5,2192826.2 642133.62,2192842.5 642145.19,2192842.52251176
642145.207923378,2192984.5 642042.625,2192986.75 642041,2192985.75
642039.0625,2192939.5 641952.5,2193098.77673046 641862.551861908,2193095
641859.75,2193079 641847.81,2193071.68646288 641841.996200874))

Thanks,
tom

_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users




More information about the postgis-users mailing list