Thursday, December 11, 2014

R GeoNames API

R has a package (geonames) for connecting to the GeoNames API.  If you are not familiar with GeoNames be sure to check out this previous post with a few examples.  The documentation for the package can be found at:

Step #1: Getting a Free Account
You will need to visit to create a free account.  Note: GeoNames has free and premium services.

Step #2: Activating the Account
After receiving a confirmation e-mail, log-in, and click the activate link.  Look midway or towards the bottom of the page.  It is easy to miss!  If you do not activate the account, you will receive an error message in R such as '401 Unauthorized'.

Step #3: Installing and Loading the Package in R
The simplest way to a install a package in R is to go the toolbar at the top, select "Install Packages", choose a download source or simply select "OK" and then scroll down until you find "geonames" in all lowercase letters.

  • After the package installs, you will also have to Load Package from the same toolbar.  
  • Loading the package from the toolbar will have to be done each session--unless you write a short bit of code to do the same automatically.
  • Also make sure you have admin privileges on the computer you are working on.

Step #4: Connecting to the API
In R, you will have two write two lines setting "options" to access the API.  Simply replace "your username" in red with your username!  You will also have to set the host--which is currently  Please note in some older documentation and websites this is listed incorrectly as an older address.  It is also possible, although not likely, it could change in the future but would be listed here.

options(geonamesUsername="your username")

Step #5: Test Your Connection
In R, simply type:


If everything is setup correctly, R will pause for a few seconds and return geographic data like in the screenshot below.

Running the code above, you can test your connection.

Step #6: GeoNames Structure
Remember geographic data can have different hierarchies (See Place Hierarchy Webservices) and be accessed in different ways. Be sure to read through the GeoNames and R package documentation to be certain you are getting your desired result.  There are a number of user-defined functions in the GeoNames package.

Examples of user-defined functions:

  • GNcities () - returns cities within a bounding box
  • GNearthqukes () - returns recent earthquakes
  • ...and many more!

Step #7: Getting Geographic Information from Wikipedia, Saving...
For example, one function in the package allows you search Wikipedia articles and retrieve geographic information (i.e. lat, long, elevation).  For example the following code looks for up to 10 articles with "oriole" and stores them in a R dataframe named results:

results<-GNwikipediaSearch("oriole", maxRows = 10)

Click the screenshot to open in a larger window
Example of results, with rank and geographic information, lat, long, and elevation.
You can also type "summarize(results)"--without the quotes -- remember 'results' is the name of the data set to view all of the variables.  The data can also be exported from R.  Keep in mind you can use R to perform exact or fuzzy merging with a data set of place names you have.

Tuesday, December 2, 2014

Review of the Spatial Computing Class on Coursera

From GPS and Google Maps to Spatial Computing was the first geospatial Coursera course that I took and my second Coursera class. Below, I describe the course, what you'll learn, and key takeaways.  Overall, the course is a unique offering that you should check out!


The eight-week course is taught by Shashi Shekar and Brent Hecht from the University of Minnesota's Department of Computer Science and Engineering.  The goal of the course is to:
"introduc[e] concepts, algorithms, programming, theory and design of spatial computing technologies such as global positioning systems (GPS), Google Maps, location-based services and geographic information systems."
The class has a workload of 4-10 hours per week depending on which of the three tracks you decide to complete (scroll to the bottom of this post to learn more about the different tracks). The majority of the weeks are close to the four hour end. Week 3's workload was heavy.  Be sure to set aside enough time to watch all of the video lectures each week.

Topics Covered

You will learn why SQL requires extensions for spatial queries as well as how to understand the results from basic spatial queries.  How spatial data are stored, accessed, and algorithms used to solve basic spatial problems (i.e. shortest-path, routing) will be discussed.

You'll also learn about volunteered geographic information, different types of positioning, and even how position can be tracked underground. There are interesting lectures about implicit and explicit spatialization--being able to visualize and analyze spatial information in different ways than you might normally think about. Lastly, you will briefly cover cartography (mainly for those new to GIS and/or computer science focused).

Course Schedule

Week 1: Introduction to Spatial Computing and Overview of Course
Week 2: Spatial Query Languages
Week 3: Spatial Networks (e.g. road networks)
Week 4: Spatial Data Mining
Week 5: Volunteered Geographic Information
Week 6: Positioning
Week 7: Cartography and Geographic Human-Computer Interaction
Week 8: Future Directions in Spatial Computing 

Platforms used: WikiBrain API and briefly TileMill

You will learn about WikiBrain - accessing data from Wikipedia and Atlasify (soon to be released).


In addition to lectures/videos and slides, you will see taped/videoconference interviews with leading geospatial professionals. In the first few weeks, I felt this worked well but got a little old as the course went on. Hopefully, future sessions will shorten the interview segments--which can be quite lengthy--and occasionally feel burdensome on top of the other coursework.  You will also have a few required readings that are directly related to the coursework and include interesting real world applications.


  • Curiosity:  come as you want! no requirements
  • Concept:  Short quizzes and a Statement of Accomplishment
  • Technical: Harder quizzes and assignments for a Distinguished Statement of Accomplishment
    • For the Technical Track, you will need to complete quizzes for both the Concepts and Technical Track. Having programming experience is recommended for the Technical Track's programming homework.

Signature Track available: Yes.  To learn more about Coursera's signature track visit:

You will want to sign-up now for e-mail reminders about future sessions, since Coursera offerings are typically spaced several months apart.  For other geospatial classes on Coursera, visit my earlier post:  I will be updating this list in the months to come.  (Please note, like other Coursera classes, it will take several weeks for your Statement of Accomplishment to be posted.)

Monday, November 17, 2014

GeoNames: 8 Million-plus Placenames for Free

GeoNames is an open-source geographical database, which you can download, that contains information on many types of features, in various languages, has attribute data (such as elevation) and comes with lat/long coordinates.

You can see a breakdown of the number of features by country at:  In addition to being able to download the data in bulk, GeoNames also has collaboration and editing features similar to other open mapping ecosystems.

Example: Populated Places Around Mt. Everest
Before downloading,  open the Readme: to make sure you are grabbing the correct files.  It will also describe the column names and send you to a few other webpages for reference information.  For example, you will also want to read through the feature codes at:

Populated places (PPL) from GeoNames.  Click to enlarge.
Other data sources: USGS (DEM) and Natural Earth (Roads, Rivers,etc.).
There are also free and premium web services:

GeoNames also allows users to add and edit data.  A screenshot of the interface for Mt. Everest:

Add/Edit Interface
You can also view a history of edits:
Wikipedia Map
Lastly, you can even view Wikipedia entries on an interactive map:

Markers pop-up for entries in Wikipedia
GeoNames data sources:

Tuesday, November 4, 2014

QGIS on Raspberry Pi

Raspberry Pi is a low-cost credit-card sized computer that has gained notoriety for programming, education, and a wide variety of other projects. In this post, I will talk about using QGIS with Raspberry Pi as hardware.

I will cover the different models for Raspberry Pi, which one you should use, other accessories, installing an operating system (OS), and more!  If you have any suggestions, please let me know in the comments section below.

Where to purchase
Raspberry Pi can be purchased online through and other online retailers.  Some specialty electronic stores, like Micro Center, and hobby shops also carry it in stock.  Expect to pay more in physical stores than online.  Also, it can be easier to find accessories online than in brick and mortar stores, where I had to hunt through bins!

What to purchase
There are two models of the Raspberry Pi: Model B+, the newest version, and Model B.  Model B+ carries a number of significant improvements over Model B including: More USB ports (4 vs 2), Micro SD slot for storage, lower power consumption, and better audio.  Both models also sport an HDMI connection.  The Model B+ is also organized better with an improved layout.  Both models sport the same processor and 512 MB of RAM.

Comparison of Model B+ and Model B, Raspberry Pi
I purchased a Raspberry Pi Model B+ Starter Kit ($60 USD/48 Euros/6739 Yen) since it contains nearly everything you need to get started including a case to protect your device, power supply, Micro SD card with SD adapter (several OS already installed), and a brief user's guide.  (Note: the Micro SD card needs to be removed to completely close the case).

Additional Items
I purchased an inexpensive card reader to be able to copy files from my computer onto the Micro SD card that I will use in the Raspberry Pi. I also got a Samsung micro SD card PRO with a larger capacity (16 GB), faster read speeds up to 90 MB per second, and write speeds of 50 MB per second ($20 USD/ 6 Euros /2246 Yen).

Lastly, I purchased a Wi-Pi, a wireless adapter ($14 USD/11 Euros/1572 Yen) designed for the Raspberry Pi.  Already on hand, I have a regular sized keyboard and mouse, a monitor (or TV can be used), an array of cables (USB and HDMI) and as an alternate: a small wireless keyboard with mouse pad.

There are several posts on installing QGIS on Raspberry Pi including one on StackExchange.

Sources of Frustration
Minor: The Raspberry Pi may not detect your monitor or TV size and resolution at first.  You can also edit a config file to match your desired characteristics.

Major: I had issues with Debian, upgrading from Wheezy to Jessie, and being able to re-boot.  From Goggling, the issues I had are known - and not new.

Success or Failure?
I was able to install QGIS on the Raspberry, see below for a screenshot, but it is slow. I was also able to install plugins.
Success but was it worth it?

Worth the Effort?
It will take at least 2-3 hours to go from Wheezy to Jessie and install QGIS.  Expect to spend more time, if like me, you are new to Linux-based systems, you run into difficulties, or need to start from scratch.  For the moment, I won't be using my Raspberry Pi for GIS, but I may check-back in on it later.  I think I will be using the Raspberry for its more typical uses.

Friday, October 17, 2014

Customizing Qgis2threejs Code

I have received a few e-mails about customizing the output from the cool Qgis2threejs plugin, created by Minoru Akagi.  The QGIS plugin allows for the creation of a 3D map that can be placed in a website or run off your computer's web browser, without having to install any additional software.

The plugin has been improved and enhanced since my original post on Manhattan and follow-up post.  The best part is that the code is well annotated and easy to follow, so you do not need to be a coding expert to make some neat and fun changes!

In this post, I open up a few of the different file types, edit a few values, and show the results.  I will also briefly talk about some of the plugins newer options, including labels!  What mapper does not love to be able to add labels...and labels for 3D!  Neat stuff!!

Saving the Plugin's Output
At the bottom of the plugin, you will see a white box that allows you to browse to a location to store the output.  Selecting a location, several files will be output instead of being stored in a temporary folder.

Results are easy to export to a folder destination of your choosing.

Starting view: Before changing the code

Starting view from the plugin (before any changes to code)
HTML File:  Camera and Controls

First, I will edit the starting position of the camera.  The three values for the camera.position.set are X,Y, and Z values.

 var camera = new THREE.PerspectiveCamera(45, width / height, 0.1, 1000);
  camera.position.set(0, -100, 100);

Changed to:
 var camera = new THREE.PerspectiveCamera(45, width / height, 0.1, 1000);
  camera.position.set(0, 0, 75);

Result from changing the camera position - now overhead view and close-up.

Qgis2threejs.css: Changing the starting background gradient

Many websites will tell you the color codes to build a new color gradient.  Here, I changed the nice default blue gradient to a burnt orange sky.

#webgl { background: linear-gradient(to bottom, #98c8f6 0%,#cbebff 40%,#f0f9ff 100%); }

Changed to:
#webgl { background: linear-gradient(to bottom, #FF350D 0%,#FF8B3D 40%,#EFBBAE 100%); }

Changing the starting background color is easy to do too!
Within QGIS and the plugin, there are a few basic background options as well, such as making it a solid color.

Additional new features
A number of improvements have been made to the plugin, which is also easier to use.  You can add multiple types of GIS files.  You can also label attributes on your 3D map, although there is a cost to performance.  Labeling lots of features will grind your map to a halt.

Labels can be added now, in this case roof heights

Wednesday, October 8, 2014

An Introduction to Leaflet, Part III: Comparing Heatmap Plugins

A great advantage and disadvantage of free and open source GIS (FOSS GIS) is the variety of options out there.  In this post, we will take a look at four different heatmap plugins for Leaflet.  If you want to skip to the final product, visit:
to see the final comparison.

We will take a look at four different plugins listed on Leaflet's plugin page:

Screenshot of the comparison site:
I used QGIS to generate 500 random points within the state of New Hampshire.

Each plugin references point data and intensity/weight values in slightly different way.  For the three plugins I got to work, here are how points should be formatted.
Overall Impressions

Performance: Heatmap.js was fastest. (Although I did not have a chance to use WebGL Heatmap.  HeatCanvas was slowest rendering.

Ease of Use: Heatmap.js was the clear winner! Leaflet-div-heatmap required more knowledge of JavaScript and I ended up editing the actual plugin code.  WebGL required understanding that!

Documentation: Heatmap.js and HeatCanvas were good.  For Heatmap js be sure to visit the website separate from github.  Leaflet-div-heatmap had poor documentation.

Other considerations: I couldn't quite get the WebGL plugin to work - when adding point data. However, I was able to get a demo working and be able to interactively change density using my mouse with another *.html file.  However, WebGL does boast performance for large datasets, so I may return to it a later date.  The Leaflet-div-heatmap uses sort of collect events/morph feature, so it is different from the rest, be sure to zoom in on the map.  This will become clearer when you try it... Also don't forget to check out each plugin and their array of options!

Heatmap Comparison webpage:

See also:
Leanpub: Leaflet Tips and Tricks
A related post in Stackoverflow

Monday, September 8, 2014

An Introduction to Leaflet, Part II: Adding GeoJSON from an External File

Last time, I wrote about adding data from a spreadsheet.  In today's post, I will show how to load GeoJSON data from an external file and create a legend with mutually exclusive categories.

In many tutorials, GeoJSON data is incorporated as part of the code.  However, with a large number of features comes a large block of code that can make writing and debugging difficult. So, reading in the data straight from an external file is valuable.  (One method that is not recommended is creating a JavaScript variable in the GeoJSON file.)

I will be condensing a longer blog post by Lyzi Diamond but feel free to head over to her page for the full explanation and the complete details.  I will also be using code from the Leaflet chloropleth map tutorial, and give its legend a needed update.

The Data
For this post, I will be creating a map of health insurance rates  (2012) in Texas based on data gathered for a post earlier this year on health insurance rates.

What You Will Need
You will need jQuery, a JavaScript library that makes life easier.

Loading the GeoJSON file
In the head of the document, in between style tags, load the jQuery script and reference the GeoJSON file using a link relation.  Here, the file is texas2.geojson.

<script src="./jquery.min.js"></script>
<link rel="polygon" type="application/json" href="/leaflet/healthinsurance/texas2.geojson">    

...and in the body...

$.getJSON($('link[rel="polygon"]').attr("href"), function(data){
var geojson = L.geoJson(data,{...
                .,,with additional code for styling and the popup.

The Leaflet chloropleth tutorial has nice code for styling by creating two JavaScript functions and using ColorBrewer for getting colors in hexadecimal.

The Legend
The legend code from the Leaflet tutorial is really neat but it needs a little updating.  The legend's categories are not mutually exclusive.  So, I created two arrays (one for the lower bound, the other for upper bound of the categories for percent uninsured) instead of just one for the lower bound in the tutorial.

  var div = L.DomUtil.create('div', 'info legend'),
        lower = [2,12.6,16.9,21,26],
        upper = [12.5,16.8,20.9,25.9,"plus"],
        labels = [];

    // loop through our density intervals and generate a label with a colored square for each interval
    for (var i = 0; i < lower.length; i++) {
        div.innerHTML +=
            '<i style="background:' + getColor(lower[i] + 1) + '"></i> ' +
            lower[i] + '&ndash;' + upper[i]+'<br>';
    return div;

I've updated Leaflet's code to make a mutually exclusive legend.
The Final Map
The final map can be viewed at: Don't forget,on the webpage you can right-click with your mouse and select "view source" to see the final code.

The final map has popups for County Name + Percent Uninsured
I am still deciding on the topic for the next Leaflet post.  If you have any suggestions, please leave them in the comment section below.

Thursday, August 28, 2014

An Introduction to Leaflet, Part I: CSVs and Pop-ups

Leaflet is an open source JavaScript library for publishing interactive web-based and mobile maps. Most tutorials on Leaflet's website are geared towards creating basic maps with a small number of features.

Despite this, the code libraries are capable of doing much more!  Today's post will focus on importing and using point data in spreadsheet form, specifically comma separated value files or *.csv.  (In the next post, we will look at other data types and formats.)  l will use the Leaflet Simple CSV Plugin that contains many different features, which I will describe later.

The data
The data set contains locations of homicides (417) in Chicago during 2013.  It also contains attribute data for incident, type, circumstances, arrests, date, and, location.  It is available through Chicago's large open data portal.

End product:
If you want to skip to see the end result, click this link:  The screenshot below shows the map on an iPad Mini (Gen 1). Click for a closer vew.

On iPad Mini: A Leaflet Map of Homicides in Chicago, 2013
How I got there...
There are several Leaflet plugins to import *.csv files.  On the web, I found the Leaflet Simple CSV Plugin by Matthew Perry that incorporates several different plugins, including a bonus one for clustering/collecting markers, into one set of code. Furthermore, it contains code for allowing attribute data from the *.csv file to be displayed when a marker is clicked.  

Pop-up displaying attribute data from the *.csv about the homicide
The code package put together many different capabilities. It was easy-to-use, modify, has documentation, and a working example.  I accessed the maps on several devices: two different computers, the iPad mini, an iPhone 4S, and a Nexus 7 tablet.  The only device that had an issue was the iPhone 4S.  When clicking a point market, pop-up attribute data was not always displayed and simply flickered.  I am still looking into this and will post anything I found out.

Resources for Learning Leaflet
Leaflet.js Essentials (Published August 2014)

Where to learn JavaScript and more coding skills for free

Tuesday, August 19, 2014

Free Online Mapping Classes From PSU and Coursera

Course dates: Last updated on 12/16/2014

Penn State has an online Open Web Mapping Class for free using open source software.  The course materials are available at: through a creative commons license. You can also take the paid version of the online course for credit.  Coursework includes QGIS, GDAL, OGR, GeoServer, TileMill, Openlayers, and OpenStreetMap.  Penn State also has several map-related classes on Coursera.

Coursera has at least six relevant classes to GIS, GPS, and more during this upcoming fall 2014 and winter 2015 sessions.  Please note some of the courses do offer different tracts that range from basic to technical in difficulty.  This fall and winter there are exciting course offerings!

One course is on Geodesign
Another is on GPS, mapping, and spatial computing
Also don't forget, ESRI does have some free and low cost tutorials for ArcGIS on their training page as well:  Be sure to checkout Directions Magazine's articles and webinars for other opportunities.

If anyone else has any that they would like to share, feel free to write them in the comments section below!

Update #1:  Noteworthy addition:  ESRI is offering a free MOOC or massive open online course entitled "Going Places with Spatial Analysis".  Head over to the link below to signup for notification when registration begins, which is shortly: Going Places Signup / Start Page

Thursday, August 14, 2014

Image Processing Using Orfeo Toolbox in QGIS

Satellite and aerial images are more than pretty pictures.  Each image contains a wealth of data that can be queried, modified, extracted, and visualized through simple and advanced techniques.  This blog entry will cover a few basic tools in the Orfeo Toolbox in QGIS.  Instructions for installing Orfeo Toolbox in the QGIS processing toolbox can be found be clicking here.  There is also a standalone Monteverdi 2 program.

Quick Background on Orfeo Toolbox
The toolbox, often abbreviated OTB, was created to promote the use of several French satellites.  Like many programs, the algorithms are geared towards popular satellites.  For more on its creation, visit:

After following the instructions above, go under "Processing" and make sure the "Toolbox" is selected. You will see Orfeo's tools grouped into what types of functions they perform.

Screenshot of Orfeo Toolbox in QGIS's Processing Toolbox
Feature Extraction, Identification, and Classification
Extracting features from imagery is an extremely powerful tool.  For example, roads can be extracted from imagery.  Edges of images and line segments can be detected.  They can a provide a quick unique source of data for areas large and small.  Click on any of the images below to get a closer look.

Extracted edges of buildings at a college campus.

Line segment detection: In this case the lines of a tennis court (and fencing).
The tan lines are generated by the software.
Line segments differentiating a road, sidewalk, and  nearby grass.
Images can also be searched for specific objects. to automate their discovery. Image classification, groupings based on spectral characteristics, whether supervised or unsupervised, is another post in itself.

Change Detection
Another important aspect of imagery is detecting changes over time, whether something is new, absent, modified, or (re)moved.

Left: Unpainted roof, Center: Roof painted red, Right: Change Detection of Roof
Remote sensing and image processing are technical fields.  There is a significant amount of documentation (hundreds of pages) on the Orfeo Toolbox website. A shortened manual and a series of short practical exercises could help to expand its user base.  If you work in remote sensing and image processing, be sure to check out this fantastic resource!

Tuesday, August 5, 2014

OpenJUMP for Editing Geometry and Attribute Data

OpenJUMP is a neat little program for editing geometry and attribute data in GIS-related files.  It is free and open source, its project source code can be downloaded.  A full list of its features can be found here. Anyone that has gotten deep into a GIS project knows that inevitably attribute or geometry data will need be edited.  

OpenJUMP can be installed on Windows, Mac OSX, or Linux.  Instructions for installation are found on the project's wiki:

After installing and opening the program, you will find a neat and organized interface.  Setting up workspaces/a project space is easy and smooth, unlike other programs that I have used.  There is a very nice and functional menu bar at the top.  Buttons below provide for basic functions that are common in GIS-related programs.

You will find a lot of functionality in the "Tools", "Rasters"," and Plugins on the top navigation bar.  For example, in Tools you will be able to:
  • Do spatial and attribute queries
  • Proximity/buffer analysis
  • Create statistics about the layer and featurs
  • Generate grids,etc.
  • Perform quality assurance (QA)
  • Edit geometry data
  • Edit attribute data
Also, right-clicking on a loaded layer, will also bring up a wide variety of actions to be performed.

First, our map.  Below is a map of shapefiles loaded in OpenJUMP for Cornell University's campus buildings and a shapefile of trees from an inventory in 2012. Click any of the images below to see them in a larger version.

Cornell University Campus and Tree Inventory.
Editing Attribute Data

Below is a screenshot of the attribute table in OpenJUMP.  Right-click in the table, and selecting "Editable" allows users to edit attribute data and also brings up an additional Editing Toolbar for editing geometry.

An attribute table for our tree inventory file.
Editing Geometry Data

At right: the Editing Geometry toolbar.
Editing geometry toolbar includes the ability to:

  •  Select features, parts, and linestrings
  • Draw rectangle, polygon, linestring, and points
  • Invert, delete, or move a vertex
  • Scale selected items 
  • Snap vertices, snap vertices to selected vertex, split lines, node lines
  • ...and about 12 other actions

So, let's say I wanted to edit a building.  I would right-click on the shapefile and click "Editable" and then make the change, say using the delete vertex tool.  Your cursor becomes a small red x and pulsates/sends a ping to let you know that the action has been completed.

Lastly, a quick word about using the Feature Info Tool / identify tool.  With it, you have several different ways to display information about select features.  The screens below show information for a tree shapefile.

The Feature Info Tool allows you to view attribute and/or geometry data
with a few clicks of a button, it can be viewed in different formats.
OpenJUMP has a lot of interesting features, including exporting images as scaleable vector graphs or *.svg. Be sure to check out OpenJUMP at:

Monday, July 28, 2014

Version 2.0 of 3D FugroViewer Released

Version 2.0 of Fugro's free 3D viewer FugroViewer has been released and includes a few improvements. Head over to their website to download it.  The release includes support for compressed LIDAR files or *.laz, created by the open source compression program LASzip.  In addition, there are greater export capabilities and the ability to view 3D shapefiles.  A few months ago, I blogged about using the previous version of FugroViewer to examine LIDAR data of the Luxor Hotel in Las Vegas.

After completing a brief form on Fugro's website, you will immediately receive an e-mail with links to download the program and sample data.  The program is small, and sample data sets, which can downloaded individually, range from 30 to 155 MB.

One sample data set is LIDAR data from Baltimore City and includes Baltimore's baseball stadium: Oriole Park at Camden Yards and the Inner Harbor. Reference imagery can be added by going to the "File menu" and selecting "Open Reference File."

Left: LIDAR points overlaying imagery.  Right: 3D view of Camden Yards Stadium

A picture I took at a recent Orioles / O's game.

Another data set is a digital elevation model or DEM from Fugro's GeoSAR/IFSAR/Radar.

A DEM displayed in FugroViewer
Note: Because of its recent release, antivirus programs, such as Norton, may not yet recognize this program and display a warning about a "potential threat."

Thursday, July 10, 2014

QGIS 2.4 Chugiak Released

The latest version of QGIS, QGIS 2.4 Chugiak, has been released.  Interestingly, the release is named after a location in the United States: Chugiak, Alaska. New features are listed on the change log and include:
  •  Cartography
    • An inverted polygon renderer - allowing everything outside of a polygon to be styled
    • Shapeburst fill style - create a gradient from the polygon line edge to the interior
    • Long lines can be labeled at regular intervals
    • Better print composer - analogous to layout view in ArcGIS
    • Grayscale and colorblindness previews
  • Table attribute data
    • Quick field calculator bar
    • Easier to incorporate tables into maps in print composer
  • Layer style-related
    • Saving and recovering styles from Spatialite layers
    • Added support for QLR files -- analogous to layer file or*.lyr in ArcGIS
    • Shifting marker line placement - allowing the user to specify an offset
  • Metadata-related improvements
    • Applying scale and offset to raster data
    • Generating band names
    • MetaSearch Catalog Client Plugin
  • Performance
    • Multi-threaded rendering - splitting the workload between the cores in your CPU
In the near future, I will post about a few of these improvements and show examples.  Also, if you use QGIS a lot, or just like the idea of a free and open source GIS, then head over to their donation page. I know I did!

Loading screen for QGIS's latest release

Wednesday, July 2, 2014

Summary File 1 DVDs: Quick Access to Detailed Census Data

The U.S. Census Bureau has done a better job of getting data online in consumable formats, most notably adding shapefiles and geodatabases containing demographic, social, and economic data.  Room for improvement remains.  One additional source is a free set of DVDs that contain data at various geographies and levels of detail for variables in Summary File 1.  No Access tables need to be created or linked or statistical code run.
"Summary File 1 (SF 1) contains the data compiled from the questions asked of all people and about every housing unit."
The two DVDs are split into a US Summary and National File (for larger geographies).  Installing both requires 20 GB of free space. A quick overview can be found on the Census website.

Most importantly, the DVDs include a 'data engine' that makes selecting data easier by a variety of criteria including geographic unit, variables of interest, and output format (i.e. *.csv, *.shp, etc.).  There are numerous file types for exporting data.  Summary information can also be displayed in a report format.  The information contained in the DVDs is far more detailed than can be easily found elsewhere.

  • For example, the DVDs contain counts of people for single-year age groups.  
After installing the data engine at data from at least one of the DVDs, you click an icon and get prompted to create a workspace/folder.  You then proceed to pick a geography, output (file type or report), variables, and custom/derived variables that are of interest. A workspace can also be saved for future use.

A screenshot from the Census website showing the data engine
and tabs that you will work through to get your data.
Arrows show how to get started, basic navigation, and the help button.
I have used the DVDs at my work and it is a much more efficient way to navigate through census data, especially if you are near a deadline.  Unfortunately, accessing other census data, such as Summary File 2, remains more challenging.  Be sure to check with your local or state planning agency to see if they have census data posted on their website in shapefiles or spreadsheets for easy use.

Lastly, if you are interested in data from the American Community Survey, be sure to check out the TIGER Products website and the Summary Data Retrieval Tool (direct download link).

Monday, June 16, 2014

Open Topography: A Well-Organized and Feature Rich Site

OpenTopography allows users to register, upload, and download high resolution topography data and tools. as well as download it.  It is run by two universities and funded through a National Science Foundation (NSF) grant.  Below is an overview video of the website.  It is important to note the social features at play and its goals of democratizing information sharing and discovery.

Finding LIDAR data is easy on OpenTopography.  Simply navigate on a map, click a point for more information on the data set, or zoom in for the full coverage area.  In addition, there is a list of tools available and links to them at:  Click on the screenshots below to take a closer look at using the site.  You can draw a bounding box to select an area of interest.

Finding data is a snap.  Currently, the overwhelming majority of the data is for the continental U.S.
While your data request is being processed, you will receive a nicely formatted report with the associated files and their descriptions. You will also receive an e-mail of the same report with links to your requested files.

Example of a Job Report for data for Washington DC.
Well Organized and Data Ready to Download!
Of course, not only is there free data but but also free tools, like LAStools in QGIS, for looking at your data from OpenTopography.

LIDAR data from OpenTopography visualized in LAStools.  Na Pali Coast, Kauai, Hawaii.
Points colored by elevation.  Pressing the space bar allows user to pan, zoom, rotate, etc. with the mouse.

Friday, May 30, 2014

GWR4: Software for Geographically Weighted Regression

Today, I will write about a free program that I think remains unknown to many people.  If you are interested in regression models, you will want to keep reading!

GWR4 was developed by the same scholars that created Geographically Weighted Regression (GWR) (Brunsdon, Fortheringham, and Charlton).  In brief, GWR runs local regression models on each geographic feature vs. ordinary least squares (OLS) regression which globally runs one model on all features.  In GWR, coefficient estimates are allowed to vary geographically and can be mapped.
  • Questions that GWR can help answer:
    • General: Do the effects of demographics race, income, education vary geographically on your outcome of interest, after statistical adjustment?
    • Specific:  Does the percent of smokers on prevalence of asthma vary geographically or stay the same? 
      • Since smoking is a major risk factor for asthma, we would expect all local coefficients to be positive--increasing the prevalence or risk of asthma.
GWR4 helps calibrate and run GWR Models. Moreover, it allows for models besides the normal/Gaussian distribution--such as Poisson (for counts and rates) and Logistic (odds).  For people interested in counts and rates, it is vital to be able to use the Poisson distribution.  Currently ArcGIS only uses OLS models.  GWR is a free program but is copyrighted.  It runs on Microsoft Windows.
"GWR 4 can be used to explore geographically varying relationships between dependent/response variables and independent/explanatory variables."
If you are still confused, click the map of Tokyo below--based on GWR4 and the sample data.  Hopefully, this will help clarify the significance of GWR models. (I ran out of time or I would have classified the layer better.  Keep in mind, odds  > 1 each unit increase in the unemployment rate is associated with higher mortality, odds < 1 each unit increase in unemployment rate is associated with lower mortality.)
Odds of the effects of the unemployment rate on mortality among the working age population.  Each of the 262 municipalities in Tokyo has an estimate of unemployment's contribution--adjusted for other variables in the model.
GWR4 has an intuitive user interface, good manual, and sample data with its associated publication. Your sessions/selections  of data, model, specifications, etc. can be saved by going to the file menu.  Be sure to check it out!

Visit here to download GWR4

GWR's Interface and Workflow: Load data->Identify Dependent and Independent Variables-->
--> Choose kernel, bandwidth, and selection criteria-->Output and Execute!

A quick note: I am taking a break from OpenLayers 3 (OL3) to wait for the final code, documentation, tutorials, and books to be completed.  However, we will return to OL3 later this year--when I also hope to have more examples.  Be sure to check out other JavaScript libraries to get maps on the web from Leaflet,  MapBox,  GoogleCartoDB, and any others I missed!  For more information on other similar projects visit the GIS StackExchange

Tuesday, May 20, 2014

An Introduction to OpenLayers 3, Part III

This week we will look at adding a Web Map Service (WMS) in OpenLayers 3 (OL3).

Adding a WMS
The code below illustrates how to add a WMS from the National Atlas.  Specifically, I pull from the data section on "people" and the layer named "fd0002_9" which is for Percent of Population that Receives Food Stamps, by County for 2002.  You can view this information on the National Atlas website or load the WMS through QGIS.  For the capabilities file and loading into a GIS, see:

Key parts of the code are emboldened in red.

   <!--Loads WMS Service from the National Atlas--People: FoodStamps, 2002//-->
   <!--Makes WMS layer transparent, so if can be overlaid on the OSM basemap//-->

 var wmsmap = new ol.layer.Tile({
source: new ol.source.TileWMS({
url: '',
params: {'LAYERS': 'fd0002_9',transparent:'true'},

A basic map is located here: A text file with the code: However, you won't be able to get any information when you click a county.

Adding Interactivity
In addition, OL3 allows information to be retrieved when a user clicks on a map.  See the more interactive example here: Attribute information will be returned in the green box.

Example of a Capabilities File for a WMS from the
It contains important information about the map layer/image.
This WMS is queryable (=1) so we can allow users to click an area and return information.  I had to change the INFO FORMAT to text/plain as outlined in the National Atlas's technical documentation.

Lastly, it is important to mention that the NationalAtlas is being merged into the USGS NationalMap later this year.  It is always possible the links for the WMS could change.

Next post: Adding a KML

Helpful OL3 API Docs

Saturday, May 10, 2014

An Introduction to OpenLayers 3, Part II

Last week, we created a basic web map by loading a basemap from OpenStreetMap using OpenLayers 3 (OL3).  If you missed last week's post, below are links to the code:
This week I will cover copying OL3's JavaScript libraries to a web hosting service. Also, note that you can run basic OpenLayers code off your computer--it simply depends on where the sources of data are located and how the code is written.

In order to get your map visible on the web, you will need a web hosting service or your own server.  After setting up an account, you will have a chance to upload files. Before that, there are a few things you need to know:
  • You will upload folders and files from the OL3 JavaScript library to the public or root directory of your web hosting service.  
  • In some cases, this is simply a matter of placing files in a folder; for some services you may have to set permission levels to public/everyone.
  • An additional step for uploading and accessing layers.
    •  In the next post, we will upload, use, and symbolize this uploaded layer.  
      • OL3 runs client-side (vs the server) so keep that in mind, so you won't want to use this method for large layers.
      • You don't need to do this step or the next one if you are accessing layers using a web map service or WMS.
      • Later I will also look at using GeoServer for more complex layers.
    • In addition, you will have to create a simple web config file to access files on your web hosting service. 
      • This can be done in a text editor, like Notepad. 
      • For example if you plan to use KML files, you will have upload a file with the following code for particular media or MIME types
      • Click to magnify the screenshot below for an example for a *.kml file.
You can find code for other MIME types by searching the web.
Save this code as web.config and upload to the root directory of your web hosting service.
After downloading and unpacking the *.zip file from OL3 (or OL2), you will see several folders and files. 
  • Consider copying all the folders and files over to see examples and understand how the code works
  • Keep in mind how you copy folders and files over, since this will affect how you write code and reference directories.
  • Lastly, the ol.js file you need is in the build folder.  In the first example that I showed (in the code above), you need to change the link to the OL3 website from "" to "build/ol.js."  The same goes for the css stylesheet.
Next time, we will look at uploading, using, and symbolizing a KML.

For serious developers, be sure to check out the OL3 wiki at:

Tuesday, April 29, 2014

An Introduction to OpenLayers 3, Part I

OpenLayers is a JavaScript library for creating interactive maps on the web. Basically, these libraries are referenced to help facilitate the development process, providing a basic foundation and advanced features.  I will devote several posts to OpenLayers 3 (OL3) which is currently in its beta release.

This first post will demonstrate some of the basic code and functionality of OpenLayers, and why you should consider using it.  Later posts will cover topics that build logically on one another and include moving and copying files to a web host, symbology, and allowing for user interaction (and feedback) with a map.  Lastly, we'll look at incorporating other free and open source GIS software, such as GeoServer.

OL3 will improve on its predecessors with a more streamlined code, better templates, and documentation. For a brief history of OpenLayers, head over to Wikipedia.  OpenLayers can handle a wide range of map-related files and extensions.  It is client side (I will talk more about this in later posts).

OL3 will improve on OL2.

Loading a Basemap
A logical starting point is loading a basemap, which many maps and map apps utilize.  One of the earliest decisions you may face:  ow much of the user's screen a map should take up.  For the web version, visit:  Feel free to zoom and pan.  Other open basemaps, for example Stamen maps, can also be loaded. A screenshot appears below:

As seen in Mozilla's Firefox web browser

You can download the code with comments in a text file here or html file, which you can experiment with after downloading to your desktop.

A different sized map is at:  A simple change to the height of the style was made and is highlighted in red.
      .map {
        height: 350px;
        width: 100%;
Initially, OL3's learning curve remains fairly steep.  However, coding appears to be much more efficient than OL2 and gets easier over time.  Advanced functionality can be easily added, a definite bonus!  An early OpenLayers 3 workshop is available here (note: try reloading the page).  Tutorials, examples, and documentation are still being produced.  Looking ahead, at least two books will be published to assist you:
Next time, I will write about moving and copying OL3's libraries. to a web hosting service and getting them on the web! I will also talk about key additional steps and importing common layer files such as KML files.