First, you need to use BruTile 0.7.4 for the Bing maps to work correctly (there was a bug in the 0.7.3).
0.7.4 is newly released on NuGet
The you can do like this..
SharpMap.Layers.VectorLayer vLay = new SharpMap.Layers.VectorLayer("Name of layer", provider);
ICoordinateTransformationFactory ctFact = new ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory();
vLay.CoordinateTransformation =
ctFact.CreateFromCoordinateSystems(getGDA94(csFact), GetEPSG900913(csFact));
vLay.ReverseCoordinateTransformation =
ctFact.CreateFromCoordinateSystems(GetEPSG900913(csFact), getGDA94(csFact));
And the helper methods
ICoordinateSystem getGDA94(ICoordinateSystemFactory csFact)
{
return csFact.CreateFromWkt("PROJCS[\"GDA94 / MGA zone 56\",GEOGCS[\"GDA94\",DATUM[\"D_GDA_1994\",SPHEROID[\"GRS_1980\",6378137,298.257222101]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.017453292519943295]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",153],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",10000000],UNIT[\"Meter\",1]]");
}
private IProjectedCoordinateSystem GetEPSG900913(ICoordinateSystemFactory csFact)
{
List<GeoAPI.CoordinateSystems.ProjectionParameter> parameters = new List<GeoAPI.CoordinateSystems.ProjectionParameter>();
parameters.Add(new GeoAPI.CoordinateSystems.ProjectionParameter("semi_major", 6378137.0));
parameters.Add(new GeoAPI.CoordinateSystems.ProjectionParameter("semi_minor", 6378137.0));
parameters.Add(new GeoAPI.CoordinateSystems.ProjectionParameter("latitude_of_origin", 0.0));
parameters.Add(new GeoAPI.CoordinateSystems.ProjectionParameter("central_meridian", 0.0));
parameters.Add(new GeoAPI.CoordinateSystems.ProjectionParameter("scale_factor", 1.0));
parameters.Add(new GeoAPI.CoordinateSystems.ProjectionParameter("false_easting", 0.0));
parameters.Add(new GeoAPI.CoordinateSystems.ProjectionParameter("false_northing", 0.0));
GeoAPI.CoordinateSystems.IProjection projection = csFact.CreateProjection("Google Mercator", "mercator_1sp", parameters);
GeoAPI.CoordinateSystems.IGeographicCoordinateSystem wgs84 = csFact.CreateGeographicCoordinateSystem(
"WGS 84", ProjNet.CoordinateSystems.AngularUnit.Degrees,
ProjNet.CoordinateSystems.HorizontalDatum.WGS84,
ProjNet.CoordinateSystems.PrimeMeridian.Greenwich,
new GeoAPI.CoordinateSystems.AxisInfo("north", GeoAPI.CoordinateSystems.AxisOrientationEnum.North),
new GeoAPI.CoordinateSystems.AxisInfo("east", GeoAPI.CoordinateSystems.AxisOrientationEnum.East)
);
GeoAPI.CoordinateSystems.IProjectedCoordinateSystem epsg900913 = csFact.CreateProjectedCoordinateSystem("Google Mercator", wgs84, projection,
ProjNet.CoordinateSystems.LinearUnit.Metre, new GeoAPI.CoordinateSystems.AxisInfo("East", GeoAPI.CoordinateSystems.AxisOrientationEnum.East),
new GeoAPI.CoordinateSystems.AxisInfo("North", GeoAPI.CoordinateSystems.AxisOrientationEnum.North)
);
return epsg900913;
}
Best Answer
You may convert your .tab files to kml format (using the excellent ogr2ogr tool for example or do it natively from MI itself) and then display them into Gmap. See this sample page to explore the code.