GeographyUnionAggregate return null

Jan 7, 2011 at 6:36 PM

Hi,

I try to make a aggregate of three Valid Polygons but the result is Null with the version 61525. Any idea ?

CREATE TABLE [test](
	[data] [geography]
) ON [PRIMARY]

insert into [test] (data) values (dbo.MakeValidGeographyFromText('POLYGON ((1.819423 49.194479, 1.819283 49.196165, 1.815741 49.197238, 1.815303 49.197551, 1.814648 49.197663, 1.814168 49.19769, 1.814159 49.199162, 1.814156 49.19969, 1.81355 49.199831, 1.812194 49.200283, 1.811411 49.199909, 1.80974 49.202018, 1.809235 49.202509, 1.80895 49.202787, 1.807808 49.203926, 1.807193 49.204695, 1.807451 49.205268, 1.806664 49.205522, 1.806224 49.205827, 1.80605 49.205948, 1.80299 49.206766, 1.802861 49.206422, 1.80195 49.205475, 1.801385 49.20493, 1.799461 49.205552, 1.798192 49.206033, 1.798277 49.206405, 1.796608 49.207563, 1.796259 49.207877, 1.794842 49.207133, 1.792394 49.205658, 1.791346 49.205086, 1.794271 49.203586, 1.795275 49.202914, 1.794713 49.202757, 1.794932 49.202499, 1.79338 49.201984, 1.792857 49.202498, 1.79242 49.202326, 1.788881 49.201223, 1.786326 49.201135, 1.786429 49.20045, 1.7865 49.199977, 1.787286 49.199277, 1.787308 49.199091, 1.784643 49.19886, 1.785211 49.198045, 1.784184 49.197601, 1.782266 49.196942, 1.780781 49.196741, 1.780879 49.196238, 1.780934 49.195954, 1.782462 49.195984, 1.783654 49.196341, 1.783947 49.196429, 1.785323 49.19723, 1.785433 49.197065, 1.785891 49.196373, 1.786458 49.195086, 1.786894 49.194543, 1.785426 49.193469, 1.785387 49.193441, 1.784717 49.193111, 1.78059 49.191864, 1.781821 49.189835, 1.783391 49.187047, 1.781052 49.18665, 1.780771 49.186602, 1.781207 49.185987, 1.77836 49.185829, 1.779324 49.184921, 1.78125 49.18514, 1.785196 49.187175, 1.786376 49.186957, 1.787064 49.186807, 1.785979 49.183674, 1.785651 49.182601, 1.788415 49.181431, 1.789632 49.181789, 1.790919 49.179974, 1.793737 49.180358, 1.793707 49.181061, 1.793678 49.182433, 1.794001 49.183608, 1.794097 49.184743, 1.795324 49.186475, 1.796505 49.185211, 1.797345 49.186447, 1.797962 49.186967, 1.800016 49.186461, 1.800493 49.186948, 1.802894 49.186757, 1.802962 49.18993, 1.803091 49.190359, 1.803808 49.190825, 1.803904 49.190894, 1.804003 49.190963, 1.805751 49.190655, 1.80614 49.1912, 1.807232 49.19109, 1.807488 49.192148, 1.807791 49.192435, 1.807353 49.19272, 1.80722 49.193062, 1.806214 49.193515, 1.807648 49.194493, 1.807857 49.194579, 1.807462 49.194978, 1.807588 49.195864, 1.808108 49.196524, 1.808764 49.196298, 1.809112 49.196499, 1.810195 49.197761, 1.811159 49.197221, 1.811074 49.196849, 1.812265 49.195989, 1.812451 49.195826, 1.813003 49.195341, 1.813049 49.194827, 1.813329 49.194686, 1.813443 49.194629, 1.813878 49.19483, 1.814925 49.195006, 1.817415 49.194615, 1.817329 49.194386, 1.818377 49.194189, 1.819423 49.194479))',4326))
insert into [test] (data) values (dbo.MakeValidGeographyFromText('POLYGON ((2.462307 49.258518, 2.462184 49.258647, 2.461529 49.259334, 2.461461 49.259406, 2.460979 49.259912, 2.460728 49.260212, 2.460678 49.26031, 2.460669 49.260329, 2.460651 49.260401, 2.460651 49.260472, 2.460665 49.260565, 2.460715 49.260751, 2.460777 49.261015, 2.460813 49.261167, 2.459815 49.261799, 2.458011 49.260808, 2.45749 49.261323, 2.457444 49.261326, 2.457396 49.261345, 2.457389 49.261347, 2.456904 49.261673, 2.457075 49.261776, 2.4574 49.261952, 2.457955 49.262233, 2.458619 49.262592, 2.459041 49.262927, 2.45914 49.263006, 2.459871 49.263588, 2.460059 49.263734, 2.458508 49.2645, 2.45687 49.265798, 2.456114 49.265192, 2.456111 49.265175, 2.456011 49.265093, 2.454992 49.265432, 2.45491 49.265459, 2.454182 49.265707, 2.451923 49.265659, 2.451921 49.265624, 2.45188 49.26575, 2.451832 49.265862, 2.45175 49.265966, 2.451681 49.266056, 2.451627 49.266114, 2.451517 49.266191, 2.451794 49.266286, 2.451251 49.266914, 2.45122 49.266893, 2.450475 49.266763, 2.450394 49.2668, 2.450029 49.266974, 2.449939 49.267015, 2.449938 49.267043, 2.449827 49.267623, 2.4499 49.267729, 2.450086 49.267971, 2.449785 49.267941, 2.44977 49.26794, 2.449502 49.267922, 2.449393 49.267922, 2.4492 49.267927, 2.448994 49.267941, 2.448624 49.267977, 2.448431 49.268013, 2.448267 49.268076, 2.448123 49.268147, 2.448075 49.268171, 2.447896 49.268274, 2.447732 49.268315, 2.445583 49.268461, 2.44557 49.268694, 2.445566 49.268954, 2.445505 49.268949, 2.445019 49.268955, 2.444985 49.269405, 2.445545 49.269413, 2.445544 49.269427, 2.445908 49.27123, 2.444958 49.272646, 2.443694 49.273282, 2.440317 49.274262, 2.437759 49.275902, 2.437756 49.275904, 2.437695 49.275943, 2.438243 49.276854, 2.437793 49.276923, 2.437153 49.277258, 2.436679 49.277792, 2.437048 49.279723, 2.435379 49.279679, 2.435308 49.281199, 2.434785 49.281148, 2.434625 49.280317, 2.429735 49.280311, 2.429696 49.27972, 2.42859 49.278943, 2.426739 49.279369, 2.424028 49.279178, 2.424074 49.279085, 2.424318 49.278589, 2.423809 49.278471, 2.423621 49.278428, 2.422445 49.280325, 2.422377 49.280435, 2.421721 49.280219, 2.421968 49.279764, 2.421374 49.279585, 2.421373 49.279585, 2.421345 49.279579, 2.420962 49.279499, 2.420945 49.279522, 2.420681 49.279884, 2.420653 49.279923, 2.420159 49.279923, 2.419791 49.279654, 2.418144 49.2796, 2.418067 49.279598, 2.417181 49.280694, 2.417115 49.280776, 2.414447 49.279233, 2.413688 49.278935, 2.412713 49.276828, 2.411687 49.276559, 2.411887 49.276028, 2.411956 49.27578, 2.411937 49.275776, 2.411241 49.275674, 2.411672 49.275349, 2.411673 49.275346999999996, 2.411713 49.2753, 2.411284 49.275162, 2.410881 49.275036, 2.410408 49.275333, 2.41002 49.2763, 2.40999 49.276296, 2.409963 49.276368, 2.40442 49.275611, 2.404959 49.273638, 2.40496 49.273633, 2.405005 49.273469, 2.405537 49.272685, 2.405574 49.272631, 2.405508 49.272613, 2.40534 49.272613, 2.40476 49.272611, 2.404759 49.272611, 2.403942 49.27261, 2.403862 49.272543, 2.403858 49.272539, 2.401486 49.270544, 2.400384 49.269096, 2.400104 49.267729, 2.40261 49.26713, 2.403 49.267037, 2.40345 49.266836, 2.403382 49.266753, 2.402765 49.266155, 2.40536 49.264901, 2.405034 49.264498, 2.403884 49.264381, 2.402389 49.264509, 2.403222 49.263982, 2.404305 49.263366, 2.405787 49.262541, 2.406233 49.262289, 2.406542 49.262123, 2.406806 49.261968, 2.407214 49.261684, 2.40787 49.261012, 2.407896 49.260988, 2.407652 49.260912, 2.407622 49.260903, 2.408107 49.259506, 2.408333 49.259343, 2.408431 49.259196, 2.408678 49.25871, 2.408727 49.258319, 2.408746 49.258171, 2.409294 49.257362, 2.410322 49.256687, 2.411831 49.255968, 2.414026 49.255247, 2.413683 49.254978, 2.412859 49.254979, 2.412036 49.255294, 2.41135 49.255294, 2.411144 49.255429, 2.41087 49.255519, 2.410046 49.255475, 2.409566 49.255295, 2.408811 49.255251, 2.408467 49.254936, 2.409359 49.254666, 2.410457 49.254711, 2.410938 49.254935, 2.411624 49.254935, 2.411967 49.254844, 2.412241 49.254575, 2.413476 49.254439, 2.414025 49.254214, 2.414162 49.254035, 2.414162 49.254007, 2.414162 49.25399, 2.41471 49.253675, 2.415053 49.25363, 2.415808 49.253674, 2.415698 49.253205, 2.415693 49.25316, 2.415706 49.253094, 2.415766 49.252972, 2.415789 49.252926, 2.415848 49.252767, 2.415896 49.252602, 2.415925 49.252504, 2.415957 49.252342, 2.415957 49.252234, 2.415948 49.252203, 2.415883 49.251982, 2.415851 49.251901, 2.415801 49.251731, 2.415784 49.25165, 2.415774 49.25161, 2.415774 49.251581, 2.415814 49.251509, 2.415833 49.251473, 2.415839 49.251436, 2.415839 49.251217, 2.41581 49.250363, 2.415755 49.25004, 2.415892 49.25004, 2.416036 49.250058, 2.416314 49.250088, 2.416801 49.250117, 2.41783 49.250179, 2.418767 49.250235, 2.419259 49.250299, 2.419598 49.250357, 2.419801 49.250417, 2.419884 49.250435, 2.420172 49.250523, 2.420301 49.250561, 2.420375 49.250575, 2.420463 49.250589, 2.420557 49.250593, 2.42065 49.250591, 2.420828 49.250589, 2.420908 49.250591, 2.42124 49.250621, 2.421446 49.250639, 2.421573 49.250641, 2.42171 49.250642, 2.421773 49.250648, 2.422157 49.250714, 2.422424 49.250755, 2.422693 49.250796, 2.42297 49.25085, 2.423201 49.250882, 2.423289 49.250882, 2.423333 49.250877, 2.423377 49.250866, 2.423526 49.250805, 2.423544 49.250808, 2.423735 49.250844, 2.423646 49.251262, 2.423585 49.251737, 2.423545 49.252046, 2.423741 49.252342, 2.424484 49.252288, 2.42449 49.252288, 2.424816 49.252254, 2.425591 49.252173, 2.425801 49.252151, 2.426303 49.252532, 2.426384 49.252542, 2.426581 49.252493, 2.426631 49.252481, 2.427403 49.252289, 2.427538 49.252273, 2.427525 49.25233, 2.427498 49.252516, 2.427493 49.252666, 2.427512 49.252867, 2.429209 49.252613, 2.42925 49.252049, 2.431181 49.252132, 2.432869 49.251545, 2.43319 49.250919, 2.433612 49.250786, 2.433737 49.250501, 2.432796 49.249535, 2.433035 49.249362, 2.433029 49.249358, 2.43302 49.249351, 2.433025 49.24935, 2.43467 49.248521, 2.434674 49.248476, 2.434692 49.248428, 2.434761 49.248356, 2.435044 49.248104, 2.435098 49.248059, 2.435684 49.247567, 2.435953 49.247333, 2.436017 49.247277, 2.436191 49.247196, 2.436406 49.247127, 2.436698 49.247048, 2.439236 49.246369, 2.439341 49.246354, 2.439401 49.246351, 2.44117 49.245437, 2.441259 49.245433, 2.441417 49.245902, 2.441866 49.245768, 2.443194 49.245544, 2.443234 49.245538, 2.443327 49.245522, 2.443572 49.245481, 2.445363 49.245178, 2.445365 49.245178, 2.44579 49.245106, 2.446593 49.24497, 2.448075 49.244625, 2.44811 49.244617, 2.448236 49.244588, 2.44834 49.244693, 2.448238 49.24459, 2.448691 49.244483, 2.448737 49.244539, 2.449565 49.245549, 2.45 49.245483, 2.450137 49.245467, 2.45327 49.245101, 2.453271 49.245101, 2.453293 49.245145, 2.453751 49.246373, 2.454353 49.248538, 2.45535 49.250143, 2.455407 49.250235, 2.456071 49.251148, 2.457144 49.252152, 2.457986 49.252949, 2.457822 49.253054, 2.457501 49.253358, 2.457324 49.253526, 2.457169 49.253713, 2.456447 49.254456, 2.455467 49.255182, 2.455449 49.255203, 2.455458 49.255233, 2.455463 49.255248, 2.455495 49.255263, 2.456436 49.255524, 2.456859 49.255642, 2.459326 49.256094, 2.459352 49.256097, 2.459964 49.25642, 2.460161 49.25654, 2.460248 49.256612, 2.460789 49.257148, 2.461078 49.257435, 2.461425 49.257781, 2.461785 49.258141, 2.461963 49.25829, 2.46206 49.258365, 2.462151 49.258422, 2.462307 49.258518))',4326))
insert into [test] (data) values (dbo.MakeValidGeographyFromText('POLYGON ((2.605587 49.537028, 2.605546 49.537078, 2.604339 49.538576, 2.604273 49.538918, 2.604163 49.539718, 2.603987 49.540617, 2.603723 49.541488, 2.60321 49.542858, 2.602697 49.544846, 2.60217 49.544636, 2.60176 49.545054, 2.600461 49.544547, 2.5997 49.545288, 2.598895 49.544973, 2.59806 49.545761, 2.596188 49.544768, 2.595588 49.545347, 2.59468 49.545012, 2.594036 49.545611, 2.593001 49.544828, 2.591707 49.546129, 2.591536 49.546301, 2.58997 49.545425, 2.589764 49.545309, 2.589283 49.54504, 2.587848 49.546856, 2.583945 49.544925, 2.583753 49.546705, 2.582699 49.546617, 2.581556 49.548109, 2.580563 49.548431, 2.580049 49.548679, 2.579816 49.548791, 2.579772 49.548401, 2.578131 49.550206, 2.577737 49.549672, 2.577518 49.549015, 2.577372 49.548767, 2.57664 49.549061, 2.575757 49.54833, 2.575602 49.548202, 2.572779 49.548767, 2.571813 49.548814, 2.571068 49.548849, 2.571019 49.548768, 2.570848 49.548478, 2.570332 49.548563, 2.57008 49.548604, 2.56993 49.548433, 2.569619 49.548075, 2.57008 49.548076, 2.569796 49.547019, 2.568195 49.546287, 2.567537 49.545829, 2.567735 49.545386, 2.567231 49.544914, 2.567736 49.54463, 2.566933 49.543963, 2.566902 49.543938, 2.566683 49.543756, 2.565606 49.544539, 2.56333 49.543573, 2.563306 49.543563, 2.563775 49.54315, 2.563855 49.543079, 2.56232 49.542076, 2.562064 49.541979, 2.56118 49.541645, 2.560877 49.541518, 2.559578 49.54097, 2.563204 49.538508, 2.562525 49.537735, 2.560025 49.536116, 2.558877 49.535557, 2.558863 49.535514, 2.558891 49.535468, 2.559609 49.535144, 2.560049 49.534374, 2.563865 49.536667, 2.566322 49.537515, 2.567681 49.53856, 2.567419 49.537389, 2.567968 49.537204, 2.568649 49.536891, 2.569176 49.536864, 2.569064 49.536407, 2.569569 49.535822, 2.571108 49.534041, 2.571169 49.534009, 2.571678 49.533742, 2.572118 49.533343, 2.57247 49.532815, 2.572997 49.532302, 2.573546 49.531718, 2.574466 49.53389, 2.57462 49.533677, 2.577276 49.530012, 2.577956 49.530228, 2.580281 49.531146, 2.581948 49.529207, 2.583042 49.532551, 2.583267 49.532377, 2.586357 49.529988, 2.588244 49.528563, 2.590021 49.527096, 2.592281 49.527943, 2.592522 49.527729, 2.592757 49.52776, 2.598046 49.528468, 2.598002 49.52991, 2.600064 49.530028, 2.600657 49.529215, 2.601942 49.529458, 2.602566 49.529576, 2.602764 49.52999, 2.600833 49.531929, 2.599098 49.533811, 2.602016 49.535344, 2.603508 49.536089, 2.605587 49.537028))',4326))

select dbo.GeographyUnionAggregate([data]) from test

Frédéric OGUER
SID
MCT/MCP Microsoft

 

 

Developer
Jan 7, 2011 at 7:04 PM

Hi Frédéric -

Your polygons, while valid, do not touch each other, which makes me wonder why you are trying to aggregate them.  The best that you could hope for, in this case, is to return a MultiPolygon.  Let me know what can of spatial object you expect.

Thanks,

-Ed

Jan 9, 2011 at 6:53 PM

Hi Ed,

Yes, i want a Multipolygon, not a null object !

This three polygons was just a sample.

All my polygons (432) touch each other and i want one polygon but the result is always null...

I upload the file http://cid-25bcd60ffe4ba704.office.live.com/self.aspx/.Public/tech/432polygons.zip

Any idea ? Thanks

Fred

 

Developer
Jan 9, 2011 at 10:29 PM

Hi Frédéric -

Looks like an issue with the GeographyUnionAggregate() function (and probably its mate, the GeometryUnionAggregate().

While I look into this, you might want to consider using the new SQL Server Code-Named "Denali" CTP1 release.  This
release contains the new UnionAggregate method which does behave correctly:

CREATE TABLE [test](
	[data] [geography]
) ON [PRIMARY]
GO

INSERT INTO [test] (data) VALUES (Geography::STGeomFromText('POLYGON ((1.819423 49.194479, 1.819283 49.196165, 1.815741 49.197238, 1.815303 49.197551, 1.814648 49.197663, 1.814168 49.19769, 1.814159 49.199162, 1.814156 49.19969, 1.81355 49.199831, 1.812194 49.200283, 1.811411 49.199909, 1.80974 49.202018, 1.809235 49.202509, 1.80895 49.202787, 1.807808 49.203926, 1.807193 49.204695, 1.807451 49.205268, 1.806664 49.205522, 1.806224 49.205827, 1.80605 49.205948, 1.80299 49.206766, 1.802861 49.206422, 1.80195 49.205475, 1.801385 49.20493, 1.799461 49.205552, 1.798192 49.206033, 1.798277 49.206405, 1.796608 49.207563, 1.796259 49.207877, 1.794842 49.207133, 1.792394 49.205658, 1.791346 49.205086, 1.794271 49.203586, 1.795275 49.202914, 1.794713 49.202757, 1.794932 49.202499, 1.79338 49.201984, 1.792857 49.202498, 1.79242 49.202326, 1.788881 49.201223, 1.786326 49.201135, 1.786429 49.20045, 1.7865 49.199977, 1.787286 49.199277, 1.787308 49.199091, 1.784643 49.19886, 1.785211 49.198045, 1.784184 49.197601, 1.782266 49.196942, 1.780781 49.196741, 1.780879 49.196238, 1.780934 49.195954, 1.782462 49.195984, 1.783654 49.196341, 1.783947 49.196429, 1.785323 49.19723, 1.785433 49.197065, 1.785891 49.196373, 1.786458 49.195086, 1.786894 49.194543, 1.785426 49.193469, 1.785387 49.193441, 1.784717 49.193111, 1.78059 49.191864, 1.781821 49.189835, 1.783391 49.187047, 1.781052 49.18665, 1.780771 49.186602, 1.781207 49.185987, 1.77836 49.185829, 1.779324 49.184921, 1.78125 49.18514, 1.785196 49.187175, 1.786376 49.186957, 1.787064 49.186807, 1.785979 49.183674, 1.785651 49.182601, 1.788415 49.181431, 1.789632 49.181789, 1.790919 49.179974, 1.793737 49.180358, 1.793707 49.181061, 1.793678 49.182433, 1.794001 49.183608, 1.794097 49.184743, 1.795324 49.186475, 1.796505 49.185211, 1.797345 49.186447, 1.797962 49.186967, 1.800016 49.186461, 1.800493 49.186948, 1.802894 49.186757, 1.802962 49.18993, 1.803091 49.190359, 1.803808 49.190825, 1.803904 49.190894, 1.804003 49.190963, 1.805751 49.190655, 1.80614 49.1912, 1.807232 49.19109, 1.807488 49.192148, 1.807791 49.192435, 1.807353 49.19272, 1.80722 49.193062, 1.806214 49.193515, 1.807648 49.194493, 1.807857 49.194579, 1.807462 49.194978, 1.807588 49.195864, 1.808108 49.196524, 1.808764 49.196298, 1.809112 49.196499, 1.810195 49.197761, 1.811159 49.197221, 1.811074 49.196849, 1.812265 49.195989, 1.812451 49.195826, 1.813003 49.195341, 1.813049 49.194827, 1.813329 49.194686, 1.813443 49.194629, 1.813878 49.19483, 1.814925 49.195006, 1.817415 49.194615, 1.817329 49.194386, 1.818377 49.194189, 1.819423 49.194479))',4326))
INSERT INTO [test] (data) values (Geography::STGeomFromText('POLYGON ((2.462307 49.258518, 2.462184 49.258647, 2.461529 49.259334, 2.461461 49.259406, 2.460979 49.259912, 2.460728 49.260212, 2.460678 49.26031, 2.460669 49.260329, 2.460651 49.260401, 2.460651 49.260472, 2.460665 49.260565, 2.460715 49.260751, 2.460777 49.261015, 2.460813 49.261167, 2.459815 49.261799, 2.458011 49.260808, 2.45749 49.261323, 2.457444 49.261326, 2.457396 49.261345, 2.457389 49.261347, 2.456904 49.261673, 2.457075 49.261776, 2.4574 49.261952, 2.457955 49.262233, 2.458619 49.262592, 2.459041 49.262927, 2.45914 49.263006, 2.459871 49.263588, 2.460059 49.263734, 2.458508 49.2645, 2.45687 49.265798, 2.456114 49.265192, 2.456111 49.265175, 2.456011 49.265093, 2.454992 49.265432, 2.45491 49.265459, 2.454182 49.265707, 2.451923 49.265659, 2.451921 49.265624, 2.45188 49.26575, 2.451832 49.265862, 2.45175 49.265966, 2.451681 49.266056, 2.451627 49.266114, 2.451517 49.266191, 2.451794 49.266286, 2.451251 49.266914, 2.45122 49.266893, 2.450475 49.266763, 2.450394 49.2668, 2.450029 49.266974, 2.449939 49.267015, 2.449938 49.267043, 2.449827 49.267623, 2.4499 49.267729, 2.450086 49.267971, 2.449785 49.267941, 2.44977 49.26794, 2.449502 49.267922, 2.449393 49.267922, 2.4492 49.267927, 2.448994 49.267941, 2.448624 49.267977, 2.448431 49.268013, 2.448267 49.268076, 2.448123 49.268147, 2.448075 49.268171, 2.447896 49.268274, 2.447732 49.268315, 2.445583 49.268461, 2.44557 49.268694, 2.445566 49.268954, 2.445505 49.268949, 2.445019 49.268955, 2.444985 49.269405, 2.445545 49.269413, 2.445544 49.269427, 2.445908 49.27123, 2.444958 49.272646, 2.443694 49.273282, 2.440317 49.274262, 2.437759 49.275902, 2.437756 49.275904, 2.437695 49.275943, 2.438243 49.276854, 2.437793 49.276923, 2.437153 49.277258, 2.436679 49.277792, 2.437048 49.279723, 2.435379 49.279679, 2.435308 49.281199, 2.434785 49.281148, 2.434625 49.280317, 2.429735 49.280311, 2.429696 49.27972, 2.42859 49.278943, 2.426739 49.279369, 2.424028 49.279178, 2.424074 49.279085, 2.424318 49.278589, 2.423809 49.278471, 2.423621 49.278428, 2.422445 49.280325, 2.422377 49.280435, 2.421721 49.280219, 2.421968 49.279764, 2.421374 49.279585, 2.421373 49.279585, 2.421345 49.279579, 2.420962 49.279499, 2.420945 49.279522, 2.420681 49.279884, 2.420653 49.279923, 2.420159 49.279923, 2.419791 49.279654, 2.418144 49.2796, 2.418067 49.279598, 2.417181 49.280694, 2.417115 49.280776, 2.414447 49.279233, 2.413688 49.278935, 2.412713 49.276828, 2.411687 49.276559, 2.411887 49.276028, 2.411956 49.27578, 2.411937 49.275776, 2.411241 49.275674, 2.411672 49.275349, 2.411673 49.275346999999996, 2.411713 49.2753, 2.411284 49.275162, 2.410881 49.275036, 2.410408 49.275333, 2.41002 49.2763, 2.40999 49.276296, 2.409963 49.276368, 2.40442 49.275611, 2.404959 49.273638, 2.40496 49.273633, 2.405005 49.273469, 2.405537 49.272685, 2.405574 49.272631, 2.405508 49.272613, 2.40534 49.272613, 2.40476 49.272611, 2.404759 49.272611, 2.403942 49.27261, 2.403862 49.272543, 2.403858 49.272539, 2.401486 49.270544, 2.400384 49.269096, 2.400104 49.267729, 2.40261 49.26713, 2.403 49.267037, 2.40345 49.266836, 2.403382 49.266753, 2.402765 49.266155, 2.40536 49.264901, 2.405034 49.264498, 2.403884 49.264381, 2.402389 49.264509, 2.403222 49.263982, 2.404305 49.263366, 2.405787 49.262541, 2.406233 49.262289, 2.406542 49.262123, 2.406806 49.261968, 2.407214 49.261684, 2.40787 49.261012, 2.407896 49.260988, 2.407652 49.260912, 2.407622 49.260903, 2.408107 49.259506, 2.408333 49.259343, 2.408431 49.259196, 2.408678 49.25871, 2.408727 49.258319, 2.408746 49.258171, 2.409294 49.257362, 2.410322 49.256687, 2.411831 49.255968, 2.414026 49.255247, 2.413683 49.254978, 2.412859 49.254979, 2.412036 49.255294, 2.41135 49.255294, 2.411144 49.255429, 2.41087 49.255519, 2.410046 49.255475, 2.409566 49.255295, 2.408811 49.255251, 2.408467 49.254936, 2.409359 49.254666, 2.410457 49.254711, 2.410938 49.254935, 2.411624 49.254935, 2.411967 49.254844, 2.412241 49.254575, 2.413476 49.254439, 2.414025 49.254214, 2.414162 49.254035, 2.414162 49.254007, 2.414162 49.25399, 2.41471 49.253675, 2.415053 49.25363, 2.415808 49.253674, 2.415698 49.253205, 2.415693 49.25316, 2.415706 49.253094, 2.415766 49.252972, 2.415789 49.252926, 2.415848 49.252767, 2.415896 49.252602, 2.415925 49.252504, 2.415957 49.252342, 2.415957 49.252234, 2.415948 49.252203, 2.415883 49.251982, 2.415851 49.251901, 2.415801 49.251731, 2.415784 49.25165, 2.415774 49.25161, 2.415774 49.251581, 2.415814 49.251509, 2.415833 49.251473, 2.415839 49.251436, 2.415839 49.251217, 2.41581 49.250363, 2.415755 49.25004, 2.415892 49.25004, 2.416036 49.250058, 2.416314 49.250088, 2.416801 49.250117, 2.41783 49.250179, 2.418767 49.250235, 2.419259 49.250299, 2.419598 49.250357, 2.419801 49.250417, 2.419884 49.250435, 2.420172 49.250523, 2.420301 49.250561, 2.420375 49.250575, 2.420463 49.250589, 2.420557 49.250593, 2.42065 49.250591, 2.420828 49.250589, 2.420908 49.250591, 2.42124 49.250621, 2.421446 49.250639, 2.421573 49.250641, 2.42171 49.250642, 2.421773 49.250648, 2.422157 49.250714, 2.422424 49.250755, 2.422693 49.250796, 2.42297 49.25085, 2.423201 49.250882, 2.423289 49.250882, 2.423333 49.250877, 2.423377 49.250866, 2.423526 49.250805, 2.423544 49.250808, 2.423735 49.250844, 2.423646 49.251262, 2.423585 49.251737, 2.423545 49.252046, 2.423741 49.252342, 2.424484 49.252288, 2.42449 49.252288, 2.424816 49.252254, 2.425591 49.252173, 2.425801 49.252151, 2.426303 49.252532, 2.426384 49.252542, 2.426581 49.252493, 2.426631 49.252481, 2.427403 49.252289, 2.427538 49.252273, 2.427525 49.25233, 2.427498 49.252516, 2.427493 49.252666, 2.427512 49.252867, 2.429209 49.252613, 2.42925 49.252049, 2.431181 49.252132, 2.432869 49.251545, 2.43319 49.250919, 2.433612 49.250786, 2.433737 49.250501, 2.432796 49.249535, 2.433035 49.249362, 2.433029 49.249358, 2.43302 49.249351, 2.433025 49.24935, 2.43467 49.248521, 2.434674 49.248476, 2.434692 49.248428, 2.434761 49.248356, 2.435044 49.248104, 2.435098 49.248059, 2.435684 49.247567, 2.435953 49.247333, 2.436017 49.247277, 2.436191 49.247196, 2.436406 49.247127, 2.436698 49.247048, 2.439236 49.246369, 2.439341 49.246354, 2.439401 49.246351, 2.44117 49.245437, 2.441259 49.245433, 2.441417 49.245902, 2.441866 49.245768, 2.443194 49.245544, 2.443234 49.245538, 2.443327 49.245522, 2.443572 49.245481, 2.445363 49.245178, 2.445365 49.245178, 2.44579 49.245106, 2.446593 49.24497, 2.448075 49.244625, 2.44811 49.244617, 2.448236 49.244588, 2.44834 49.244693, 2.448238 49.24459, 2.448691 49.244483, 2.448737 49.244539, 2.449565 49.245549, 2.45 49.245483, 2.450137 49.245467, 2.45327 49.245101, 2.453271 49.245101, 2.453293 49.245145, 2.453751 49.246373, 2.454353 49.248538, 2.45535 49.250143, 2.455407 49.250235, 2.456071 49.251148, 2.457144 49.252152, 2.457986 49.252949, 2.457822 49.253054, 2.457501 49.253358, 2.457324 49.253526, 2.457169 49.253713, 2.456447 49.254456, 2.455467 49.255182, 2.455449 49.255203, 2.455458 49.255233, 2.455463 49.255248, 2.455495 49.255263, 2.456436 49.255524, 2.456859 49.255642, 2.459326 49.256094, 2.459352 49.256097, 2.459964 49.25642, 2.460161 49.25654, 2.460248 49.256612, 2.460789 49.257148, 2.461078 49.257435, 2.461425 49.257781, 2.461785 49.258141, 2.461963 49.25829, 2.46206 49.258365, 2.462151 49.258422, 2.462307 49.258518))',4326))
INSERT INTO [test] (data) values (Geography::STGeomFromText('POLYGON ((2.605587 49.537028, 2.605546 49.537078, 2.604339 49.538576, 2.604273 49.538918, 2.604163 49.539718, 2.603987 49.540617, 2.603723 49.541488, 2.60321 49.542858, 2.602697 49.544846, 2.60217 49.544636, 2.60176 49.545054, 2.600461 49.544547, 2.5997 49.545288, 2.598895 49.544973, 2.59806 49.545761, 2.596188 49.544768, 2.595588 49.545347, 2.59468 49.545012, 2.594036 49.545611, 2.593001 49.544828, 2.591707 49.546129, 2.591536 49.546301, 2.58997 49.545425, 2.589764 49.545309, 2.589283 49.54504, 2.587848 49.546856, 2.583945 49.544925, 2.583753 49.546705, 2.582699 49.546617, 2.581556 49.548109, 2.580563 49.548431, 2.580049 49.548679, 2.579816 49.548791, 2.579772 49.548401, 2.578131 49.550206, 2.577737 49.549672, 2.577518 49.549015, 2.577372 49.548767, 2.57664 49.549061, 2.575757 49.54833, 2.575602 49.548202, 2.572779 49.548767, 2.571813 49.548814, 2.571068 49.548849, 2.571019 49.548768, 2.570848 49.548478, 2.570332 49.548563, 2.57008 49.548604, 2.56993 49.548433, 2.569619 49.548075, 2.57008 49.548076, 2.569796 49.547019, 2.568195 49.546287, 2.567537 49.545829, 2.567735 49.545386, 2.567231 49.544914, 2.567736 49.54463, 2.566933 49.543963, 2.566902 49.543938, 2.566683 49.543756, 2.565606 49.544539, 2.56333 49.543573, 2.563306 49.543563, 2.563775 49.54315, 2.563855 49.543079, 2.56232 49.542076, 2.562064 49.541979, 2.56118 49.541645, 2.560877 49.541518, 2.559578 49.54097, 2.563204 49.538508, 2.562525 49.537735, 2.560025 49.536116, 2.558877 49.535557, 2.558863 49.535514, 2.558891 49.535468, 2.559609 49.535144, 2.560049 49.534374, 2.563865 49.536667, 2.566322 49.537515, 2.567681 49.53856, 2.567419 49.537389, 2.567968 49.537204, 2.568649 49.536891, 2.569176 49.536864, 2.569064 49.536407, 2.569569 49.535822, 2.571108 49.534041, 2.571169 49.534009, 2.571678 49.533742, 2.572118 49.533343, 2.57247 49.532815, 2.572997 49.532302, 2.573546 49.531718, 2.574466 49.53389, 2.57462 49.533677, 2.577276 49.530012, 2.577956 49.530228, 2.580281 49.531146, 2.581948 49.529207, 2.583042 49.532551, 2.583267 49.532377, 2.586357 49.529988, 2.588244 49.528563, 2.590021 49.527096, 2.592281 49.527943, 2.592522 49.527729, 2.592757 49.52776, 2.598046 49.528468, 2.598002 49.52991, 2.600064 49.530028, 2.600657 49.529215, 2.601942 49.529458, 2.602566 49.529576, 2.602764 49.52999, 2.600833 49.531929, 2.599098 49.533811, 2.602016 49.535344, 2.603508 49.536089, 2.605587 49.537028))',4326))
GO

SELECT Geography::UnionAggregate(data) FROM test
GO

This will return a MultiPolygon, exactly as you expected.

Thanks,

- Ed

Jan 10, 2011 at 10:20 AM

Hi Ed,

Thanks , I will try the new SQL Server Code-Named "Denali" CTP1 release.

But I hope you will found a solution for my SQL 2008 R2 production Server (on Windows Server 2003).

If i can help you or if you need more sample...

Regards,

Fred

 

Jan 10, 2011 at 2:18 PM

Hi Ed,

Good News : I try new UnionAggregate method on my database (36 883 polygons, 9 681 666 points) and everything is perfect !

But I can't use it on my server...

Thanks,

Fred