miércoles, 23 de mayo de 2012 15:50Hoping some of the Spatial experts can offer some advice on this issue I've been fighting recently:
I have a website that renders polygons onto Bingmaps. There are several levels in the structure, and these can be combined into larger groups. for example, 3 suburbs can be combined into 1 region. When this happens, the boundaries of the suburbs are merged via STUnion() to create a Region boundary.(fyi The polygons at both Suburb and Region are stored as GEOMETRY datatypes)
The problem occurs when the Suburbs' boundaries don't completely touch, and they contain small gaps.
These get carried into the Regions polygon as artifacts,
and this in turn causes nasty rendering on the Map.
These are the things I've tried so far :
Applied a Buffer to the Suburbs. This does resolve the zigzag lines, but makes the Suburbs appear very ugly where they overlap, and the User feedback on this is a dealbreaker to keeping this in.
I've tried the TopologyLite solution (I feel this is related in part to the issue at http://social.msdn.microsoft.com/Forums/en-US/sqlspatial/thread/0239d8d3-2f7b-4328-a7b1-0f8b44a034f1 ) but running its Simplify method simply caused more gaps.
I've installed the SQLSpatialTools from codeplex, and using its FilterArtifactsGeometry() function on the Region I've had success in many of the renderings, but there are still a few zigzags that continue to show up. If I set the Tolerance to be too high then I risk dropping the smaller regions. I'll continue to play with this, perhaps the solution is to calculate a dynamic tolerance based on the STArea of the Region.
So at the end of the day I feel that the best solution is to adjust the initial Suburb polygons, and that the FilterArtifactsGeometry() is nice but more of a bandaid solution.
Does anyone have any suggestions on the best way to resolve this? My Spatial experience is pretty non-existent outside this project so it's possible (likely?!) I've missed something fundamental.
If you need more info on this please let me know, I appreciate whatever ideas you throw at me! Thanks in advance
Todas las respuestas
jueves, 24 de mayo de 2012 7:49
If the suburbs doesn't have interior rings:
1) STUnion all the suburbs
2) Create a polygon (or multipolygon) using only the exterior ring of the union.
If the suburbs have interior rings:
1 & 2
3) Create one polygon per interior ring, and use STDifference with previous result
- Marcado como respuesta JGallagher jueves, 24 de mayo de 2012 15:00
jueves, 24 de mayo de 2012 15:00
Excellent, thanks for your help.
There is a bit of looping involved in keeping all the polygons clean but fortunately it all occurs Async so the Users not seeing any delay.