If you’ve used WMS, you’re probably familiar with GetCapabilities (retrieves metadata) and GetMap (retrieves map tiles) requests. GetFeatureInfo is another type of request which retrieves attribute information at a given location, provided the server (e.g. GeoMet) has been configured to provide this information (look for “queryable=’1′ ” in the layer metadata).
One stumbling block I encountered (and likely handled poorly) was overcoming the issue of cross-origin resource sharing (CORS). No matter what I tried, I was blocked from retrieving the request response because, of course, my webpage resides on a different server than the WMS. I got around this by calling a PHP script that copies the text response from the request locally and reads that version. Honestly, I’m not sure why that works and reading the original request doesn’t, but it does and that’s good enough for me. If you have a simpler solution (I’m sure it’s out there), I’d love to learn about it!
I’ve been looking into Canadian open data, and stumbled across GeoMet Geospatial Web Services, which is a HUGE collection of weather-based web map services and KMLs. You can check out my sample map here, which contains a very tiny sampling of the available WMSes.
As so often is the case with these side-projects, I blindly followed my nose to produce this map, which maps the 2011 Canadian Population Census, Census Profile (data here). There are 472 attributes in all, dealing with population, age, sex, dwellings, families, marital status and language.
The province squares idea came from Bill Dollins’ US States as Squares project, although I could have just as easily used the province boundaries.
I’m still definitely learning Mapbox JS – feel free to leave tips in the comments!