Projecting GPS Points in DBF OLEDBPoint Provider

Topics: General Topics
Nov 21, 2006 at 9:34 PM

I am trying to project points in a DBase file captured by a GPS (the GPS points is in a Shapefile, I am using the DBF that contains the attribute data as an OLEDBPoint Provider). I know GPS's capture points in the WGS84 Datum. Currently my other Shapefiles all project as WGS 84 / Lo29 projections. But my DBF points are appearing in the normal Decimal Degree Coordinate Values. I need the points to render over my other layers on a roadset. Most of the code is taken straight out of samples and posts.

Below is the code:


DBFConnector = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + HttpContext.Current.Server.MapPath(@"~\App_Data\clients") +
";Extended Properties=dBASE IV;User ID=Admin;Password=";
SharpMap.Layers.VectorLayer layDealers = new SharpMap.Layers.VectorLayer("MTN Dealers");
OleDbPoint DealersDS = new OleDbPoint(DBFConnector, "dealers.dbf", "DH_DEALER", "LAT", "LONG");
layDealers.DataSource = DealersDS;
layDealers.Style.Symbol = new Bitmap(HttpContext.Current.Server.MapPath(@"~\images\dealers.png"));
layDealers.Style.SymbolScale = 0.2f;

I know I can reder layers via a call in the class:

ICoordinateTransformation trans = CoordTransformation.Transform2TransverseMercator(GeographicCoordinateSystem.WGS84);

I have created a sepearate class file - CoordTrans.cs

public static ICoordinateTransformation Transform2Mercator(ICoordinateSystem source)
//Check source coordinate system
if (source == null)
throw new ArgumentException("Source coordinate system is null");
if (!(source is IGeographicCoordinateSystem))
throw new ArgumentException("Source coordinate system must be geographic");
CoordinateSystemFactory cFac = new CoordinateSystemFactory();
List<ProjectionParameter> parameters = new List<ProjectionParameter>(5);
parameters.Add(new ProjectionParameter("central_meridian", 29.0));
parameters.Add(new ProjectionParameter("latitudeoforigin", 0.0));
parameters.Add(new ProjectionParameter("false_easting", 0.0));
parameters.Add(new ProjectionParameter("false_northing", 0.0));
parameters.Add(new ProjectionParameter("scale_factor", 1.0));
IProjection projection = cFac.CreateProjection("Transverse Mercator", "Transverse_Mercator", parameters);
IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem("Mercator", source as IGeographicCoordinateSystem, projection,
LinearUnit.Metre, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("South", AxisOrientationEnum.South));
return new CoordinateTransformationFactory().CreateFromCoordinateSystems(source, coordsys);

Basically how do I get the points to project ? Some help please, I am still coming to grips with C# and GIS in general.

Thanks in advance,