This project has moved and is read-only. For the latest updates, please go here.

WGS84 Point Conversion

Topics: General Topics, SharpMap v0.9 / v1.x
Nov 4, 2009 at 2:25 PM

I am trying to find my way around the SharpMap API.  I am looking for a method which will take a lat/lon point in a GCS (WGS84) and convert it to meters so I can make some modifications to it, and then convert it back to lat/lon.  In ESRI ArcObjects programming, this is pretty straight forward using the IUnitConverter interface.  Is there anything similar in SharpMap and if not, what would be the best way to accomplish something like this?

Using SharpMap-0.9-Trunk-2009.10.22


Nov 4, 2009 at 2:35 PM
Edited Nov 4, 2009 at 2:35 PM

dbran, you need to use to convert to a planar coordinate system and back - there is a dll in the external references directory on the source control tab.. hth jd

Nov 4, 2009 at 3:16 PM

Thanks, John.  I have the Proj.NET dll added to the project.  I'm just not sure how to go about using it yet.  Perhaps I should move this post to the discussion boards for that project. Is there any example code for something like this anywhere?


Nov 4, 2009 at 3:58 PM

Generally You create two coordinate systems using the CoordinateSystemWktReader. You use these to create a new CoordinateTransformation and then you use the MathTransform property to actually convert coordinates

hth jd

Nov 4, 2009 at 5:36 PM

I think things are starting to become a little clearer, however, I am still unsure about the WKT file format.  In ESRI these are all stored as .prj files.  Does SharpMap have a collection of WKT files that can be used, or is there somewhere they are readily available publicly?  I was also looking at using CoordinateSystemFactory to create them, but it still requires more knowledge than I have right now on WKT.

Thanks again.


Nov 4, 2009 at 5:43 PM

Hi dbran see (btw .prj files are just text files you can open them use the wkt therein - though the format does vary a bit) hth jd

Nov 4, 2009 at 9:43 PM

Thanks, John.  This is the information I was looking for.  I have been playing with this this afternoon and I may actually be getting somewhere.  I did have to modify the WKT that I got from the website you mentioned, because they were missing parameters that the ICoordinateTransformationFactory.CreateFromCoordinateSystems method wanted.  After modifying that, the method I created using this information "seemed" to work.  I will check it tomorrow.

Thanks for all of your help.