astian 0 Newbie Poster

Hi, I am writing a Silverlight Bing Maps based application and I am trying to merge two (and more) polygons. The approach I am using at the moment is the following:
The geometry for the polygons is stored in a database, and Im writing and reading from it through a WCF Service. So I get the geometry from the database, and I am dealing only with Polygons. The thing I did was to use the STUnion function in the SQL, through a StoredProcedure. It supposedly works, but here is the twist: Many of the polygons are not really sharing a line or anything, meaning that they have no common lines, no points of intersection - nothing. They look like they are sharing a line when they are on the map, but in reallity they dont. I tought this might be because the data I have has the polygons described with points that have 12 symbols after the decimal point, so I rounded the coordinates to the 6th symbol.(As I believe this is the accuracy that the bing maps supports, and when I round more, the polygons get distorted ...) Once again the polygons do not intersect and the STUnion function returns a MultiPolygon, which is not the idea behind the Merge. Furthermore, sometimes the STUnion function returns an error saying that the geometry type is wrong. The thing is that I am taking an already parsed geometry type, and I tried parsing it again and it works. Sometimes it just says Nope, the aggregate geometry is not in the correct format or something like that, sry for not pasting the exact error, but this is the smaller problem. I am looking for a way to merge two polygons that are just a pinch away from each other... I hope this is possible, or at least find a way to "go arround" the issue. I wrote the issue here, because I am writing in C#, though I understand that this is some of a database problem. If there is a solution in C# I would appreciate it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.