Hi gis team, my question scenes: using(proj4Project proj4=new Proj4Project(ManagedProj4Projection.GetLatLongParametersString (),ManagedProj4Projection.GetGoogleMapParametersString ())) { PointShape point=new PointShape(114.111111,21.11111); PointShape externalPoint=proj4.ConvertToExternalProjection(point); PointShape internalPoint=proj4.ConvertToInternalProjection (externalPoint); if(the point.X=!internalPoint.X and the point.Y!=internalPoint.Y) { // } } I expect the result is point==internalPoint result. but I found point != internalPoint(point.X=!internalPoint.X and the point.Y!=internalPoint.Y) why it’s such result, can you give me some support. why the point != internalPoint(point.X=!internalPoint.X and the point.Y!=internalPoint.Y), can you tell me how to solve the problem.
Using Pro4Project convert latitude longitude question
Hi Li,
We have recreate your problem, this should be caused by computer accurate issue. So, it is a little hard to retrieve the original data after a series of calculations in the projection conversion. A walkaround could be to round it like following code:
if (point.X != Math.Round(internalPoint.X, 5) && point.Y != Math.Round(internalPoint.Y, 5))
if there is any other questions, please feel free to let us know.
Thanks,
Summer
thinks for your answer. it is a little hard to retrieve the original data after a series of calculations in the projection conversion .I want to reduce the error,so try not to use Math.round method?
because I want GPS and Google coordinate conversion, coordinate values are errors, so the display to the map there is a little error.
Hi Li,
Thanks for your further information, though converted point has a little difference, but visually they are still in the same position, in attached test vedio: screencast.com/t/WzaJpgxe , even in the deepest zoomlevel two points are still overlaps.
And another thought for you is to use PointShape.Tag, you could set pointBeforeProjection.Tag equal pointAfterProjection.Tag, so that you could tell pointBeforeProjection and pointAfterProjection are actually the same place through their Tag.
Hope it helps
Summer