This project has moved. For the latest updates, please go here.

"Density Map" best way

Topics: SharpMap v0.9 / v1.x
Sep 11, 2011 at 10:07 AM


Whats the best way to create a density map, it is using Custom Theme render - I've seen the code examples, not tired them yet, but was wondering if this is the correct approch before i getr started. 

By density map I mean I want to colour the areas/regions in a shape file by some densities metric based on xy co-ordinate's  from some other file





Sep 12, 2011 at 7:19 AM

If you precompute the density value for the polygonal shapefile, you could use GradientTheme

If that is not an option you could use custom theme and reuse some portion of GradientTheme.

I'd try to do it this way:

  • In the GetStyle(FeatureDataRow row) implementation, convert current geometry to NTS geometry.
  • If you use NTS v1.10 (VS2010 solution) create a prepared geometry from it.
  • Query for all (you hopefully have an index) points and check the intersects constraint of either geometry or prepared geometry.
  • Sum up specific value or count features to get the density value,
  • Set or calculate style

Hth FObermaier