CanvasMap
Getting Started Tutorials 3D Reference

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.

First, start with one of the tutorials that already uses GoogleMercator (or "WebMercator") as the projection for the map. Then, project your own data to GoogleMercator to add to your map.

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 CMProjectorWebMercator();

TheMainContainer.SetProjector(TheProjector);