I'm trying to get a back-end rendering engine built to pull map data from a local tile server and export a rendered map to a png file. I've been able to get the basics in place except that I've had no luck figuring out the unit conversion. How do
you go about converting between lat/lon and the map units?
Below is the code I have right now which ends up rendering a section of the map I have no data for.
static void Main(string args)
var myMap = new Map(new Size(400, 300));
ITileSource tileSource =
new WebTileProvider(new TmsRequest(new Uri("http://localhost/OSM/"), "png"),
var tileLayer = new TileLayer(tileSource, "OSM");
var myMapPoint = new SharpMap.Geometries.Point(-77.168, 38.901);
var box = new SharpMap.Geometries.BoundingBox(-78.01, 38.42, -76.36, 39.46);
myMap.BackColor = Color.White;
myMap.Center = myMapPoint;
var imgMap = myMap.GetMap();
an answer over on the Proj.Net project after following a few breadcrumbs around. Just required a formula for converting between Lat/Lon and Mercator. Works great now with the code above.