[postgis-users] Splitting a polygon.
Paul moen
pmoen at offroadsoftware.com
Sat Jan 23 18:23:59 PST 2010
I am trying to split a polygon and I found one that doesn't work as I
expect.
The following select statement returns 3 polygons, 2 green and 1
yellow in After.png. It should return 4. The yellow polygon should
be split in two by the east west line as in the start.png.
select
((st_dump(st_polygonize(st_union(st_boundary(poly),line)))).geom) as
mpoly from
(select 'MULTIPOLYGON(((1975538.39350359
377623.361866549,1972852.28369938 377613.359472095,1972847.53554394
380259.639618443,1975537.28833463 380263.247556028,1975538.39350359
377623.361866549)))'::geometry as poly) as a,
(select 'MULTILINESTRING((1972865.08581219
378326.311285453,1972895.7042649 378358.315688868),(1972895.7042649
378358.315688868,1972933.979366 378388.930721138),(1972933.979366
378388.930721138,1972974.16845174 378419.546275256),(1972974.16845174
378419.546275256,1973002.87444456 378443.203252802),(1973002.87444456
378443.203252802,1973029.66659847 378465.468628553),(1973029.66659847
378465.468628553,1973048.80395578 378480.776266062),(1973048.80395578
378480.776266062,1973075.59600672 378503.041704557),(1973075.59600672
378503.041704557,1973117.69772662 378537.831583168),(1973117.69772662
378537.831583168,1973173.19622315 378579.580769303),(1973173.19622315
378579.580769303,1973236.35047682 378622.723192938),(1973236.35047682
378622.723192938,1973307.16042398 378667.258927706),(1973307.16042398
378667.258927706,1973368.39932231 378713.183678761),(1973368.39932231
378713.183678761,1973416.23659085 378770.234714699),(1973416.23659085
378770.234714699,1973450.67513462 378827.282408658),(1973450.67513462
378827.282408658,1973481.28608385 378881.546788078),(1973481.28608385
378881.546788078,1973534.86258824 378946.946753736),(1973534.86258824
378946.946753736,1973609.49694216 378998.440540649),(1973609.49694216
378998.440540649,1973699.45001784 379024.89730255),(1973699.45001784
379024.89730255,1973770.26738669 379033.263732711),(1973770.26738669
379033.263732711,1973913.81676938 379047.215512246),(1973913.81676938
379047.215512246,1974013.34419567 379056.982105999),(1974013.34419567
379056.982105999,1974114.78434737 379070.923334437),(1974114.78434737
379070.923334437,1974218.13591725 379093.212801276),(1974218.13591725
379093.212801276,1974329.13876931 379130.808229422),(1974329.13876931
379130.808229422,1974447.79131378 379187.883323066),(1974447.79131378
379187.883323066,1974562.61031489 379260.261034748),(1974562.61031489
379260.261034748,1974667.8552857 379342.374696672),(1974667.8552857
379342.374696672,1974773.10163982 379417.532965552),(1974773.10163982
379417.532965552,1974887.91994899 379484.347812556),(1974887.91994899
379484.347812556,1975016.1377815 379544.21188679),(1975016.1377815
379544.21188679,1975276.40102593 379658.379116697),(1975276.40102593
379658.379116697,1975389.30423149 379719.631453509),(1975389.30423149
379719.631453509,1975496.46331177 379785.05593613),(1975496.46331177
379785.05593613,1975599.79273051 379853.261981628),(1975599.79273051
379853.261981628,1975701.20851153 379918.685474945),(1975701.20851153
379918.685474945,1975796.88805681 379967.413025216),(1975796.88805681
379967.413025216,1975909.80065063 379995.27974771),(1975909.80065063
379995.27974771,1976032.29294321 379996.718192226),(1976032.29294321
379996.718192226,1976149.0510567 379978.678445439),(1976149.0510567
379978.678445439,1976248.58769298 379950.894153126),(1976248.58769298
379950.894153126,1976327.071639 379921.710658941),(1976327.071639
379921.710658941,1976394.07432062 379886.958030913),(1976394.07432062
379886.958030913,1976459.16498756 379848.031270235),(1976459.16498756
379848.031270235,1976552.97410689 379788.248751641),(1976552.97410689
379788.248751641,1977136.89978777 379418.442870354),(1977136.89978777
379418.442870354,1977816.57151658 379002.790677999),(1977816.57151658
379002.790677999,1977904.64392703 378948.57662571),(1977904.64392703
378948.57662571,1978002.28778939 378892.976452668),(1978002.28778939
378892.976452668,1978122.90027009 378838.779310127),(1978122.90027009
378838.779310127,1978268.39001065 378797.11610984),(1978268.39001065
378797.11610984,1978417.70212459 378767.976655498),(1978417.70212459
378767.976655498,1978570.83994512 378744.405078215),(1978570.83994512
378744.405078215,1978725.88782027 378729.18284317),(1978725.88782027
378729.18284317,1978827.33666845 378723.671651834),(1978827.33666845
378723.671651834,1979154.65170133 378708.54495921),(1979154.65170133
378708.54495921,1979273.32592165 378705.827881016),(1979273.32592165
378705.827881016,1979378.60008853 378705.886409993),(1979378.60008853
378705.886409993,1980779.69300235 378723.413216224),(1980779.69300235
378723.413216224,1983401.94993708 378757.236399321),(1972773.34674946
377707.210612508,1972805.89645524 377668.264572569),(1972805.89645524
377668.264572569,1972830.78484433 377650.184711705),(1972830.78484433
377650.184711705,1972869.07571578 377618.196030881),(1972869.07571578
377618.196030881,1972913.11215175 377573.688032513),(1972913.11215175
377573.688032513,1972960.97911141 377520.833881389),(1972960.97911141
377520.833881389,1973014.58957154 377465.198819163),(1973014.58957154
377465.198819163,1973072.0270778 377416.520769646),(1973072.0270778
377416.520769646,1973140.94504965 377388.713523273),(1973140.94504965
377388.713523273,1973209.85877404 377378.991994578),(1973209.85877404
377378.991994578,1973276.85870732 377367.879039647),(1973276.85870732
377367.879039647,1973343.86222769 377342.854407711),(1973343.86222769
377342.854407711,1973412.78190888 377310.87454125),(1973412.78190888
377310.87454125,1973475.95844977 377281.67580825),(1973475.95844977
377281.67580825,1973525.73129167 377269.16805291),(1973525.73129167
377269.16805291,1973567.84145942 377278.917449126),(1973567.84145942
377278.917449126,1973609.9497359 377295.62288757),(1973609.9497359
377295.62288757,1973640.57751158 377294.239864998),(1972865.08581219
378326.311279507,1972836.38295246 378287.351402944),(1972836.38295246
378287.351402944,1972817.2530921 378237.264198899),(1972765.56033513
378288.726667813,1972813.40884979 378308.214074532),(1972813.40884979
378308.214074532,1972865.08581219 378326.311279507))'::geometry as
line) as b
I tried the following simplified version and it worked like I thought
it should.
select
((st_dump(st_polygonize(st_union(st_boundary(poly),line)))).geom) as
mpoly from
(select 'POLYGON((5 5,10 5,10 10,5 10,5 5))'::geometry as poly) as a,
(select 'MULTILINESTRING((5 5,7 7,11 9),(3 9,7 7),(7 3,12
8))'::geometry as line) as b
Can anyone tell me what I am doing wrong?
Thanks,
Paul
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Start.png
Type: image/png
Size: 8466 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20100123/615ee49d/attachment.png>
-------------- next part --------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: After.png
Type: image/png
Size: 6705 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20100123/615ee49d/attachment-0001.png>
-------------- next part --------------
More information about the postgis-users
mailing list