A while back, I posted about some experimentation I did with Leaflet and CartoDB in the wake of FOSS4G in Denver. I recently had the chance to go back and update that sample with some spatial queries. At the time of the original post, CartoDB was still in beta and spatial queries didn’t seem to work, despite the fact that the back-end was driven by PostGIS.
Since then, of course, CartoDB has gone production, as has PostGIS 2.0 (up to 2.0.1 now) so I decided to update the sample a little. This time, I added a floodway layer that flows through Leonardtown, Maryland. With a button click, you can identify the buildings that intersect the floodway. I am again using the CartoDB SQL API and GeoJSON to accomplish this. The API call that accomplishes this is:
The CartoDB documentation has greatly improved since my last post, including some good developer examples. A little bit of comfort with PostGIS-esque spatial SQL goes a long way with CartoDB. It’s good to see how the platform is evolving.