Friday, March 30, 2012

Maps and Boardgames (Part 1 - Introduction)


Hi all.

If you have seen some of my posts you've probably suspected that I like spatial stuff :). I would like to make an experiment where I'm going to make some kind of boardgame engine on top of a map (probably Leaflet).

It will be a little bit useless but should be a fun exercise to apply some of the stuff that I've been talking about, like html5 canvas, tile maps, leaflet, UTFGrids, etc.

Friday, March 23, 2012

NHibernate Spatial (Part 4 - Querying)


In my previous NH Spatial post I've shown a concrete end-to-end example of how to use NHibernate Spatial on an ASP.NET MVC project.
Anyway, there's still much to be said about using this library and I've received some hits on my blog from people who were searching for how to do specific spatial operations with NH Spatial. So, this blog post will be pretty much practical, showing some spatial queries using NH Spatial on SQL Server 2008 R2, taking into account some variables in the process:
  • Geography (always assuming SRID 4326)  and Geometry data types
  • HQL and LINQ
  • NHibernate version

Sunday, March 18, 2012

Custom Map Tiles (Part 3 - TileStache)


In my previous post all the map tiles were pre-rendered and stored in the filesystem. Although that approach brings more flexibility it also has some disadvantages: storage and time.

Imagine that we want to store tiles for every zoom level covering the whole world. We would be talking probably about Pentabytes of information. Even if we just stored all the zoom levels for some countries it would be probably lots of Terabytes. Space is cheap, but we're talking about a whole new level here.

Probably even worse than the storage, it would take ages to render all of the required tiles. Without enough computational power we could be looking at months (or more) to render all the tiles. 

So, in this post, I'm going to present a realistic alternative: using a Tile Server to generate and cache map tiles on-the-fly. I'm going to use TileStache for this.

Tuesday, March 13, 2012

Custom Map Tiles (Part 2 - TileMill)


In my previous post I've shown a really simple way of overlaying custom map tiles on top of Bing Maps using MapCruncher.

One of the problems with that approach is that it only works for raster files. If one needs to do more complex stuff like creating tiles with data from shapefiles, kml or databases then a different method/tool must be used.

We have three challenges here:
  1. How do we create a raster map representation of our raw data?
  2. How do we split that image in tiles?
  3. How do we serve those tiles to the map client (like Bing/Google maps)? 
I'm going to use a tool that simplifies this process without sacrificing any quality on the process: TileMill. TileMill is, like stated in their homepage, "an application for making beautiful maps". It uses a Mapnik core to render the maps, and provides a very simple UI and a CSS-like language to style them. I could praise the application a little bit more but I prefer to show you.

Wednesday, March 7, 2012

Custom Map Tiles (Part 1 - MapCruncher)



When drawing overlays on top of a map one can choose between two different methods: custom map tiles or using the map API.

On this series of posts I'm going to show what are custom map tiles, how overlaying them compares to using the map API in client-side and finally how to interact with the tiles.

Friday, March 2, 2012

ASP.NET MVC 4 (Part 2 - Mobile Features)

In its newer release ASP.NET MVC has brought better support for mobile devices. How so?