MapBox vs ArcGIS Online


Today I finished the MapBox TileMill crash course. Just as the programming world has the “Hello World!” example for learning new programming languages, the GIS world appears to use the USGS Earthquake data feed for the same purpose. I say that only because of the Maps and the Geospatial Revolution course that I completed last week also used that data feed to introduce ArcGIS Online.

I’ve embedded an example of both sites, MapBox and ArcGIS Online, mapping the earthquake data on my website. These are very basic examples as directed by the respective lessons:

Both tools/sites are easy to use. I liked the CartoCSS used by TillMill better than ArcGIS Online because I felt as if I had more control over the map style. It’s possible that ArcGIS Online has similar control but I just didn’t dig deep enough to find it.

The other thing that I liked about TileMill is that I am not tied to a single map tile server like I am with ArcGIS Online. Maps can be exported in an XML format compatible with Mapnik, should I ever choose to host map tiles on my own server.

I’ll continue exploring TillMill this Labor Day weekend to see what other capabilities I discover. I’m looking forward to seeing what it can do!


Let there be PostGIS


To prepare for the TileMill Crash Course I needed to install a GIS, (in addition to Oracle Spatial and Graph which I previously installed). PostGIS was an easy choice for Ubuntu 12.04 since it is available in the Ubuntu Software Center.

First, I installed PostgreSQL and pgAdmin III.


Initially, I install PostGIS from the Ubuntu Software Center, but I was unable to create the PostGIS or postgis_topology extension.  In the end, I removed it and then followed the instructions found in How to install PostGIS 2.0 on Ubuntu 12.04 LTS (precise) from source. Following those instructions you will do the following:

  1. Install prerequisites, including gdal, if you haven’t already installed it.
  2. Build GEOS 3.3.x from source.
  3. Build PostGIS from source.
  4. Spatially enable your database.

I created a database and added the postgis extensions to it, and then used the function postGIS_full_version() to verify the extension.

$ createdb exploringspatial
$ psql -U postgres exploringspatial
Password for user postgres:
psql (9.1.9)
Type "help" for help.
exploringspatial=# CREATE EXTENSION postgis;
exploringspatial=# CREATE EXTENSION postgis_topology;
exploringspatial=# SELECT postGIS_full_version();

POSTGIS=”2.0.3 r11128″ GEOS=”3.3.8-CAPI-1.7.8″ PROJ=”Rel. 4.8.0, 6 March 2012″ GDAL=”GDAL 1.11dev, released 2013/04/13″ LIBXML=”2.8.0″ LIBJSON=”UNKNOWN” TOPOLOGY RASTER
(1 row)
Finally, launch the Shape File to PostGIS Importer GUI to verify it is installed:
$ sudo xhost +localhost
localhost being added to access control list
$ shp2pgsql-gui &
The Shape File to PostGIS Importer GUI launched as expected, so now I can get back to the TileMill crash course:


Next, I’ll follow the Tilemill crash course and play with heat maps.

Exploring Leaflet Raster Classes


Below is the class diagram for the Leaflet raster classes. As I prepared this diagram I realized it did not go far enough for me since I don’t have experience working the raster images. I’m going to put my exploration of Leaflet classes on hold and take a detour into the world of raster graphics.

Leaflet Raster Classes

Leaflet Raster Classes

I found several posts on Google map tilesBing map tiles, and OSM map tiles. The article on OSM map tiles referenced the Slippy Map Tile Application, and Mapnik, an open source tool for rendering maps.

If I start with Mapnik I need some raster tiles to render, don’t I? This would be the perfect time to continue my post from June about working with satellite images with TileMill. In that post I installed the following tools on my computer:

  1. GDAL, a low-level GIS toolkit
  2. libgeotiff, to work with geotags
  3. ImageMagick, an image processing package
  4. TileMill, an open-source mapmaking app from Mapbox

For my next post, I’ll pick up where I left off and follow the article Processing Landsat 8 Using Open-Source Tools by Charlie Loyd. Then perhaps I’ll look at GMap Creator and MapTiler. I’m open to suggestions for good raster learning resources.

When I’m done I’ll revisit this Leaflet raster class diagram again.

Exploring Leaflet Vector Classes


This post, third in my series on the Leaflet API, explores the vector classes. Vector graphics are primitive geometric shapes that easily scale across pixel resolutions, such as points, lines, circles, and polygons. The point class, L.LatLon was covered in my previous post, Exploring Leaflet Geographic Classes. The remaining vector classes are shown below.

Leaflet Vector Classes

Leaflet Vector Classes

As was the case with the geographic classes, there are similar vector classes available in all online map APIs.

Not pictured above are L.MultiPolyline and L.MultiPolygon, as those are contained in L.FeatureGroup, which extends L.LayerGroup, which I will covered later in my series. I included L.PolyUtil and L.LineUtil because they have some helpful functions, such as Douglas-Peuker line simplification, distance and proximity calculations, and clipping.

A picture is worth a 1,000 words, so I’m not going to expand on my diagram. You can read more in the Leaflet API documentation.

Next stop, raster classes.

Exploring Leaflet Geographic Classes


In my previous post, Exploring Leaflet Base Classes, I covered the core classes upon which the Leaflet API is built. In this post, I cover the geographic classes.

If you have ever used the APIs for Google, Bing, OSM, or Open Layers then you are already familiar with the model objects for the spherical reference system: latitude and longitude, as well as for the 2-D projection, point, expressed as x/y coordinates. The corresponding classes for Google are LatLng, LatLngBounds, and Point. For Bing Maps the classes are Location, LocationRect, and Point. OSM uses LatLng, RectLL, and Point. Leaflet has LatLng, LatLngBounds, Point, and Bounds, as illustrated below.

Leaflet Geographic Classes

Leaflet Geographic Classes

The diagram above also includes the L.Map class showing its functions that either accepts or return the other classes shown on the diagram. You’ll note that many map features, such as responding to events, are available in both Lat/Lon or x/y point versions. Also, note the many projection functions on L.Map that depend on the projection system specified for a given map instance.

Every web mapping API must project coordinates from a spherical reference system, latitude, and longitude, to the 2-D, x/y pixel coordinates on your computer monitor. In most online maps, like Google Maps, the projection system is fixed because the vendor controls both the base map and vector layer. Leaflet and OpenLayers, on the other hand, are open, so the user is free to pick base maps generated with a different coordinate reference system. Matching the projection system ensures that features on the vector layer align with the base map tiles. The Leaflet CRS classes are shown below.


Leaflet CRS Classes

I found a good post about spherical Mercator projections on the Open Layers web site. Lucky for me, at Garmin Connect all of our base maps, Google, Bing, and OSM, use Spherical Mercator so I won’t have to mess with the projection system.

In my next post, I’ll delve into vector layer classes.

Exploring Leaflet Base Classes

In my previous Leftlet post, I gave an example that showed that shapes and click events were preserved across the Cloudmade and OSM map tiles, but not for Google. Before I go off and try writing my own Leaflet plugin for Google I must first learn the Leaflet API. For me, that starts with class diagrams since I am a visual learner.

L is the namespace for all Leaflet classes, not to be confused with the character “L” from Death Note.


L (エル, Eru)

L is shown in the class diagram with only a few of its many functions. The functions shown are all assigned from L.Util.

Leaflet Base Classes

Leaflet Base Classes

L.Util contains core utility functions used throughout Leaflet. The code snippet below shows L.Util function assignments to L. Instead of calling L.Util.extend(), for instance, you can call L.extend().


L.extend is, in turn, used in functions of L.Class.


L.Class is the base class used for object oriented design in Leaflet. In my next post, we’ll start looking at Leaflet’s object classes, all of which extend from L.Class.

Finally, the Leaflet event model is based on L.Mixin. L.Mixin is included in L.Draggable, L.FeatureGroup, L.ImageOverlay, L.Map, L.Marker, L.Path,  L.Popup,  L.PosAnnimation, and L.TileLayer, all of which I’ll explore my the next few posts.

Penn State Geospatial Revolution MOOC on Coursera


This week I completed the 5-week MOOC, Maps and the Geospatial Revolution, taught by Dr. Anthony Robinson of Penn State on the site Coursera. Over 47,000 students enrolled and over 35,000 students participated, making it the largest GIS course ever taught. I found the course to be a good overall survey of the world of GIS (geographic information systems). I recommend it to anybody wanting to learn about GIS or who wants to see what it’s like to take a MOOC (massive open online course). Below is my brief overview which only skims the surface of what we covered.

In the first week, Dr. Robinson illustrated how geospatial technology has revolutionized the way we navigate, make decisions using geography, and share stories using geographic references, like geotagging and geocoding.

The second week covered reference maps and thematic maps. We saw thematic maps showcasing geographic observations, including choropleth maps, dot mapping, proportional symbol mapping, and isoline maps. The concept of spatial autocorrelation  was introduced (the measure of similarity of observations that are close to one another), as well as Tobler’s first law of geography:

Everything is related to everything else, but near things are more related than distant things.

A cool project highlighted in week two was Ushahidi, a non-profit organization that built a platform for volunteered geographic information in disaster areas. Ushahidi was instrumental in relief efforts in Haiti where online maps were very poor at the time of the earthquake.

Week three introduced GNSS (global navigation satellite systems) ranging from America’s GPS, GLONASS in Russia, to the E.U. Galileo system. We also covered the vector and raster spatial data types, as well as remote sensing, LIDAR, spatial metadata, and ArcGIS Online.

Week four discussed map overlays, first introduced in Ian McHarg’s 1969 book, Design with Nature.  A video explained how Dr. John Snow’s map of the cholera outbreak in 1854, Soho, London, was used to trace the cholera outbreak to a bad well. That was the first major use of cluster detection. We learned that spatial correlation is not causation, and we learned about the MAUP (modifiable areal unit problem), where scale effects how geospatial observations are visualized. We covered how important normalization is to avoid skewing maps by population density. To normalize data you calculate the rates of occurrence as a proportion of the overall population.

Finally, week five covered the art of map making, which starts by clearly understanding the audience, target format, and specific purpose of the map. It’s difficult to give a concise summary, so I’ll just say the lesson taught that it is important to use the right thematic map for the type of data (nominal, ordinal, or interval/ratio data). On the topic of color, we covered sequential colors, diverging colors, and qualitative colors. We then explored data classifications: equal interval classification, quantile classification, and natural break classification.

The final assignment was a map of your choosing. I chose to use to running and cycling data that I extracted to create a surface analysis map. The data has some serious flaws (a triathlon at Clinton Lake skewed my data), but it was adequate for my proposes.


I’m already looking for other MOOCs of interest to me that are offered by Corsera.