Projections
Introduction
EPSG codes uniquely define every projection available and are used by the WindFarmer scripting to avoid ambiguity. Find your EPSG codes here: http://spatialreference.org/ref/epsg/.
Another option for defining projection is the Global Mapper .prj file which contains "Well Known Text" that describes a projection.
Load a projection from a *.prj file
var projection = Toolbox.LoadProjectionFromFile(@"C:\TestData\BritishGrid.prj");
Create a projection from its EPSG code
var projection = Toolbox.GetProjectionFromEpsgCode(2805);
Set or redefine the global projection
var projection = Toolbox.GetProjectionFromEpsgCode(2805);
// Set or redefine the workbook's projection
Toolbox.RedefineWorkbookProjection(projection);
Reproject point
// WGS84 lat/long
var geoProjection = Toolbox.GetProjectionFromEpsgCode(4326);
// Reproject mast coordinates from current projection to lat-long
Location geoMast = Toolbox.ReprojectPoint(
Workbook.Climate.MeasurementSites["Mast 1"].Location,
Workbook.Geography.Projection,
geoProjection) as Location;