Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

Part 3 - adding heatmaps with open layers and views

Parent Feed: 

Mapping in drupal with open layers and views is hella awesome.  Add in the heatmaps and you've got some pretty sweet visualizations.  open layer heatmap exposed view filter using the content type with our geolocation field from our first exercise we first create a view - since we're using points we'll need a vector overlay to start with vector data overlay in views.  For those looking to test on their own site I've added an updated feature with the mapping in it.  The settings for the overlay are also pretty straightforward.  I use EPSG 4326 for most projections - especially since I'm using google's geocoder that spits it out by default (if we had to use ogr2ogr to transform the data we could , but for this project EPSG 4326 is just fine.  I also use WKT (well known text) for most of my mapping... again, this is handy with google, and generally a pretty usable format open layers vector overlay settings.  Once your view is built hit save - it's time to head over to the open layers side for a bit....

In the open layers interface /admin/structure/openlayers/maps/list/ add a new map - you'll need to center the map where you expect your data to be... in my case the US and then set your projections - EPSG 4326 (aka WGS84) is what I used here again - consistency is what matters....epsg 436 for data then scroll down a bit and you'll see your layer that you created from your view select the view with open layer data. After you're done here go on to the Behaviors tab.open layers behaviors part 1 there are a huge number of settings in here, but basically the defaults are going to be your friend....heatmap and tooltip settings Hit save now and go back to the view you just created... it's time to render this sucker.  Create a page view in your existing view - you could create a new view, but why bother... it's nice to keep it all in one place in my experience... that said don't forget to use the "override for this view" settings so that when you select openlayer map for your format you won't override any other views....  openlayer map page in viewUnder settings select your newly minted map and you're done!final map in drupal openlayers

We're almost done with the report - next we're going to look at how to preserve the data by passing it along to an international service aka open spending... again - thanks to all who have helped thus far from the charlottesville gop, @Buddy Weber, Barbara Null, Richard Statman, John Pfaltz et al.  As noted in our discussions what we find here is that Charlottesville is not really a big spender when it travels, and that in a given month we don't travel all that much.

Author: 
Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web