Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Leveraging sql server to improve vector display through point clustering


Published on

Presented at the 2011 Texas GIS Forum

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Leveraging sql server to improve vector display through point clustering

  1. 1. Leveraging SQL Server to Improve Vector Display through Point Clustering
  2. 2. The Problem… Due to Java Script limitation, Large Numbers of Vectors don’t draw in Web-Mapping Environments. Cutoff is ~ 300-500 Features
  3. 3. Current ways to solve…1. Use Silverlight or Flash  Increases capacity roughly an order of magnitude, but similar limitation exists.2. Show Pictures, Query Features  Has the capability to show and query ALL features for a pleasant user experience, but takes time to build tile cash (the pretty pictures).  However, Tile Caches are Large and are, basically, redundant storage.3. Use a WMS to feed ‘pictures’ dynamically and then use a separate, spatial query for feature attributes.  Extra ‘moving’ parts in the solution.  Possibly extra cost in licenses.
  4. 4. Why Invent a ‘Better’ Solution??? Original Design…  Texas Hydrologic Information System (TexasHIS)   Client desires immediate access to vector data and attributes Data Characteristics  Lots of tightly packed ‘Sites’ ~ 300K+  data with gobs of related attribute data ~ 5,000,000+ related records!
  5. 5. Factors Affecting a Good ‘Clustering’ The Data Solution…  Density  Distribution The Scale  Large – Basically Draw everything  ‘Medium’ – Draw some, Cluster some – Lots of Code and Logic!  Small – Basically Cluster everything Logic  Thresholds/Limits of when to Cluster vs. When to Draw  How to Carve the display to deal with Data Distribution  Complex Algorithms to determine the optimal number of features to draw.
  6. 6.  Create a ‘smart’ solution that…  Isn’t affected by the java script limit  Only queries the database one time (other solutions can query the database for image creation and attribute retrieval.  Is still capable of retrieving vector attributes for single features
  7. 7. Solution Basics…1. Drawing Thresholds  When to Draw everything  When to Cluster  When to take no action2. Carving The Display  At first glance, a 16 x 16 ‘Grid’ would be best. It would yield 256 Cluster ‘Features’3. Clustering Logic  Draw the Singles  Cluster Everything Else
  8. 8. Solution Basics: Thresholds…1. Drawing Thresholds  Draw Everything – if the total number of Points to ‘cluster’ is below 500  Cluster – If there are 500 (Lower Limit) to 5000 (Upper Limit)  Above the Upper Limit – Take no action. The Clustering Query becomes too expensive. So much so that user experience is drastically diminished.
  9. 9. Solution Basics: Carving up the Display and Applying the Logic Rules… Spatial Indexes are Similar in concept 16 x 16 creates 256 Cells – Near the upper limit of our display threshold Polygons with more than 1 Site are ‘Cluster Candidates’. The Centroid of the polygon will represent the cluster spatially. Threshold values are variables so that they are easily ‘tuned’ in a series of runs.
  10. 10. Solution Basics: How it works…  The Envelope of the Display is passed as a parameter  First Function, a Scalar-Valued Function, determines how ‘big’ the cells will be in the X and Y direction – Returns a comma separated number pair – “0.3456778,0.3456777”  Second Function, a Table-Valued Function, returns a table of polygon cells that are ‘built’ from the output of the SVF and the starting point of the Display Envelope. A ‘cutter’ variable is used to build-out polygons with @var_Y rows and @var_X columns.  The results of these functions are then used to 0perate on the ‘Sites’ point dataset.
  11. 11. XY
  12. 12. At Long Last… DEMO!!!
  13. 13. Further Improvements… Add logic to always draw ‘up-to’ the lower limit. Possibly add some ‘weight’ to the clustered point so that it doesn’t show in such a ‘regular’ way. Others…
  14. 14. TNRIS Information Services… Richard Wade – Team Lead Ryan Mitchell – Web Systems and Data Czar Yvette Giraud – Web Development Ragunath Jayabalakrishnan – Developer (Contract) Chris Williams – Database Administrator
  15. 15.