WGS84 Coordinates Are Offset

Topics: General Topics
Sep 5, 2006 at 9:34 AM
I have recently downloaded the source and examples for SharpMap and proceeded to customise the Ajax demo. Upon adding a series of WGS84 coordinates to the map (which were generated by MapPoint 2004 and Google Maps, and are correctly plotted within these systems), I noticed that alot of my points are offset to the left, i.e. the points that should have been plotted along the west coast of the UK have been plotted in the sea!

To add them I have used the code below:

System.Collections.Generic.List<SharpMap.Geometries.Geometry> geometries = new System.Collections.Generic.List<SharpMap.Geometries.Geometry>();

geometries.Add(new SharpMap.Geometries.Point(-2.23, 53.327));

<<Continued for all 1000 points using the format longitude, latitude>>
SharpMap.Layers.VectorLayer layerVehicles = new SharpMap.Layers.VectorLayer("Vehicles");

layerVehicles.DataSource = new SharpMap.Data.Providers.GeometryProvider(geometries);
layerVehicles.Style.Symbol = (System.Drawing.Bitmap)System.Drawing.Bitmap.FromFile(@"h:\My Pictures\a.gif");
layerVehicles.Style.SymbolScale = 0.75F;

layerVehicles.MinVisible = 1;
layerVehicles.MaxVisible = 4;


Do I need to transform the coordinates in some way? Or is this a known issue? Or is this simply due to the map file used? Any help would be great.

Thanks in advance. James Chapman
Sep 5, 2006 at 10:44 AM
And what datum is the data that you plot your points on in ?
Sep 5, 2006 at 11:35 AM
Sorry to sound a fool! But where/how would I find this out? The coordinates themselves are from Mappoint and are accurate if plotted with Google Maps, if that helps?
Sep 5, 2006 at 11:39 AM
Not sure if this is helpful:



"MapPoint Web Service draws maps by using an orthographic projection centered on the center point of any given map and based on WGS84 datum"

All points are for the UK.


Sep 5, 2006 at 11:09 PM
OK so your new data is in lat/long with a WGS84 datum.
Since I gather that you are plotting these data on top of something else, what coordinate system, projection and datum is this "background" data using? There is no real way of finding this out - your best bet is asking the data distributor or reading the metadata.
Sep 6, 2006 at 7:43 AM
Ah I See...

The actual map I was using was provided with the Ajax Demo (~\App_data\countries.shp) Of course this won't be the map that I would use in the final version, I simply wanted to create a proof-of-concept.

If I knew what projection and datum my 'Base' map used, how would I adjust the vectorlayer to reflect this?

At present I am looking at the follow map:


I believe this will need to be converted to a *.shp file. Are there any free/cheap tools to do this? Would any conversion affect the projection/datum of the map?

Sorry to be a pain. Still struggling with some of these concepts. Answer as you please!!!


James Chapman
Sep 6, 2006 at 8:00 AM
You can use OGR2OGR (http://ogr.maptools.org/ogr2ogr.html) to convert it to Shapefile, or you can use the OGR provider extension to read MapInfo directly in SharpMap.

The data provided with the demos are WGS84 as well, but it is VERY inaccurate. It's only a simplified demo-dataset and has a very low accuracy. This might be the reason for your offset. Furthermore I know for a fact that google maps can have up to several hundreds meters of errors as well. Some of their data is of very poor absolute accuracy.
Sep 6, 2006 at 8:04 AM
Thanks for your quick response and all your help.

The more I use SharpMap, the more I want to use it. If I had more time I would have liked to contribute to the application (Mmm... maybe after I have got my head around some of the mapping concepts!!!).

Thanks again and again!!!

James Chapman


Do you know of any SHP files available as demo's of larger datasets, that are accurate to use and test my own coordinates with?