A small tweak for those using OpenLayers Symbology with OpenLayers 2.12

Recently, I’ve had the pleasure of experimenting with OpenLayers Symbology, a JavaScript library for thematic mapping in OpenLayers by Zachary Forest Johnson. I’ve specifically been using the Choropleth class.  (You know those maps where counties or Census Tracts are shaded in different colors based on, say, median household income?  Those are choropleth maps.)  OpenLayers Symbology is an impressive contribution to web mapping – it gives you some powerful options for making thematic maps quickly and easily.

OpenLayers Symbology, and indeed OpenLayers itself, are thankfully both free/open source/BSD-licensed.  One of the many advantages of “free-as-in-speech” software is the community it attracts and fosters.  There are so many intelligent and patient individuals who have helped me learn through blog posts and message boards.  A key interest of mine is using data and maps to help strengthen “physical” communities such as neighborhoods, so I’m proud to use software that simultaneously contributes to building strong “virtual” communities.

This blog post, then, is a small attempt for me to give back to the OpenLayers community, and specifically to beginners like myself who may get stumped in similar ways.

OK, here goes:

When I tried to utilize OpenLayers Symbology with OpenLayers 2.12 (rc6), I got the following error:

Object #<Object> has no method ‘loadURL’

But when I switched back to OpenLayers 2.11 (the stable release) everything worked like a charm.  I could have  just used OpenLayers 2.11, but I knew eventually 2.12 would be the stable release and I wanted to figure out what the issue was.  I discovered that loadURL, utilized by OpenLayers Symbology, has been depreciated and replaced by OpenLayers.Request.GET.  The parameters/properties of the two functions are slightly different as well.

Long story short, it only took a small tweak to fix the issue.  I opened up ol.thematic.js and at line 114 replaced this:

if ( this.url ) {OpenLayers.loadURL(this.url, ”, this, this.onSuccess)}

with this:

if ( this.url ){OpenLayers.Request.GET({url: this.url, success: this.onSuccess, scope: this})}

That’s it!  Have fun!


  1. Your tech abilities are awesome. I am so feeble, tech-wise…

    1. Vicinity Blog · · Reply

      Awww…thank you, dear! (But you know full well that I bow down to your acting/dancing/”gruel-ing” skills.)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: