GoogleMercator Projection

There are a large number of services for backgrounds for your web-based maps. These are constructed as "pyramids" of "tiles" that you have seen in GoogleMaps and OpenStreetMap. These tiles are in a custom projectiion that I refer to as "GoogleMercator". To be compatible with tile layers from OpenStreetMap and other vectors, we need to be using the exact spatial reference that was created with GoogleMaps. This is not a great projection for maps but there are many tile sets out there and we'll be using them in future tutorials (some of them are really cool). For this reason, you'll need to project your data into the GoogleMaps projection. BlueSpray supports this with a custom projection engine and I don't know of another GIS application that does.

Projecting Data Sets to GoogleMercator

For this tutorial, convert several vector layers to GoogleMercator and add them to the resizable map example.

To convert a layer to GoogleMercator in BlueSpray:

Projecting Coordinates to GoogleMaps Projection

If we are going to have the coordinate display be in latitude and longitude, we need to provide CanvasMap with a projection engine or "Projector" to convert from GoogleMercator projection back to Geographic.

The code below will add the "GoogleMaps" projector which matches the GoogleMaps projection and the OpenTileFormat. This will allow you to show coordinates in degrees with a map that is in the GoogleMaps projection. It's not cricital where this code is inserted in the "OnLoad()" function.

var TheProjector=new CMProjectorGoogleMaps();
TheProjector.SetZoomLevel(18);
TheCanvasMap.SetProjector(TheProjector);