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

coordinate conversion not working for me

Topics: General Topics
Nov 16, 2006 at 10:24 PM
I am trying to convert from a simple lat / long coordinate to the map coordinates, and then center my map accordingly to that point.

ICoordinateTransformation trans2 = new CoordinateTransformationFactory().CreateFromCoordinateSystems(GeographicCoordinateSystem.WGS84, shp.CoordinateSystem);
SharpMap.Geometries.Point p = trans2.MathTransform.Transform(new SharpMap.Geometries.Point(-94.7, 38.9));

myMap.Center = p;

The map basically goes blank and it appears really to not even process this request, unless the converted point is within the boundaries of the layers. That leads me to believe that the coordinate conversion is invalid.

The shp.coordinate system is kansas state plan north as produced by the shapefile.

That system is ----
SharpMap.CoordinateSystems.ProjectedCoordinateSystem {PROJCS"NAD_1983_StatePlane_Kansas_North_FIPS_1501_Feet", GEOGCS["GCS_North_American_1983", DATUM["D_North_American_1983", SPHEROID["GRS_1980", 6378137, 298.257222101]], PRIMEM["Greenwich", 0], UNIT["Degree", 0.0174532925199433]], PROJECTION["Lambert_Conformal_Conic"], PARAMETER["False_Easting", 1312333.33333333], PARAMETER["False_Northing", 0], PARAMETER["Central_Meridian", -98], PARAMETER["Standard_Parallel_1", 38.7166666666667], PARAMETER["Standard_Parallel_2", 39.7833333333333], PARAMETER["Latitude_Of_Origin", 38.3333333333333], UNIT["Foot_US", 0.304800609601219]} SharpMap.CoordinateSystems.ProjectedCoordinateSystem

Am I wrong because I'm using wgs84 to represent what I call a standard lat / long? Please help.
Nov 17, 2006 at 2:41 AM
The fix was related to work item 4519, in that the lambert conical projection is not setup right. I made all the right changes, but I'm not going to get so lucky when I get other shape files with different units.

I would like to find a much cleaner way to do this if you know how.

Please advise.
Nov 17, 2006 at 6:58 AM
You supply two different datums in the from and to coordinate systems, but you don't supple the required datu-transformation parameters. SharpMap doesn't have the built-in grids required for calculating these values, so you have to supply the TOWGS84 parameter yourself (you can add this to the WKT yourself, and sharpmap will automatically apply it).