﻿ ENCX SDK - ENC Projection

# Developer Reference ENC Projection

### Simple Cylindrical Projection

By default when drawing ENC chart data ENCX uses a simple cylindrical projection. This supports fast drawing at the expense of not preserving bearings exactly.

Paper charts covering a large area generally use the Mercator projection so that Rhumb lines can be drawn by hand using a straight ruler. We don't need to do this on a computer, because the computer is good at calculating the correct curved path for a long geographical (Rhumb or Great Circle) line on any projection. This saves time because a typical system will draw very few long Rhumb and Great Circle lines compared with the vast number of short edges in the ENC data (which, being short, are assumed to be straight in pixel space).

In the simple north up, cylindrical projection case:

Calculate constants for a given view (i.e. constant size, scale, position) of
yScale = (yS – yN) / (latS – latN)
xScale = (xE – xW) / (lonE – lonW)

Where
xE, xW, yN and yS are the pixel bounds of the view
latN, latS, lonW and lonE are the geodetic bounds of the view

The pixel values (pixelX, pixelY) can then be calculated for a geodetic position (lat, lon) as follows:
pixelY = yScale * (latN – lat)
pixelX = xScale * (lon - lonW)

These calculations are for illustration only - you should use the GeoPix class to perform conversions.

The GeoPix.PointEx method provides access to the accurate pixel bearing for any position on the ENC surface. This (and the scale) will vary with position, increasingly at less detailed scales and higher latitudes).

The GeoPix.Point, GeoPix.PointEx, GeoPix.Line and GeoPix.Area methods provide accurate conversion from geographic positions and shapes to pixel positions and shapes. So, using GeoPix.Line may be different from using GeoPix.Point for both ends of a line and drawing a straight line between them.

### Mercator Projection

From ENCX 2.0 you can display ENCs using the Mercator projection