You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sindizzy wrote 2016-05-05 at 00:34
It took me some time to debug this but I dont think Reproject.ReprojectPoints is working like it should. I take two points on my map (NorthPoleStereographic) and want to reproject them to WGS84. I setup the calculation and only the first point comes out
correct. When I do them individually then both come out correct. Can someone maybe point out my shortcoming.
So my first attempt is to send all points at once:
Dim firstCoord As New Coordinate(4485207.83013716, 2805066.943671)
Dim lastCoord As New Coordinate(2656525.17410077, 3950495.93338145)
Debug.Print(" firstCoord Vertex in MapProj x={0} y={1}", firstCoord.X, firstCoord.Y)
Debug.Print(" lastCoord Vertex in MapProj x={0} y={1}", lastCoord.X, lastCoord.Y)
'create an array of coordinates in the map's projection
Dim mapXY() As Double = {firstCoord.X, firstCoord.Y, lastCoord.X, lastCoord.Y}
Dim mapZ() As Double = {firstCoord.Z, lastCoord.Z}
'now we reproject the coordinates to geographic coordinates
Reproject.ReprojectPoints(mapXY, mapZ, mapMain.Projection, KnownCoordinateSystems.Geographic.World.WGS1984, 0, 2)
'create reprojected coordinates for ease of use
Dim firstCoordWgs84 As New Coordinate(mapXY(0), mapXY(1), mapZ(0))
Dim lastCoordWgs84 As New Coordinate(mapXY(2), mapXY(3), mapZ(1))
Debug.Print(" firstCoord Vertex in WGS84 x={0} y={1}", firstCoordWgs84.X, firstCoordWgs84.Y)
Debug.Print(" lastCoord Vertex in WGS84 x={0} y={1}", lastCoordWgs84.X, lastCoordWgs84.Y)
and here is the debug (not sure how the last coordinate was calculated)
firstCoord Vertex in MapProj x=4485207.83013716 y=2805066.943671
lastCoord Vertex in MapProj x=2656525.17410077 y=3950495.93338145
firstCoord Vertex in WGS84 x=-42.9779741870071 y=45.0079085872576
lastCoord Vertex in WGS84 x=-165 y=0
My second attempt reprojects the points one at a time
'create an array for first coordinate in the map's projection
Dim mapXY() As Double = {firstCoord.X, firstCoord.Y}
Dim mapZ() As Double = {firstCoord.Z}
'now we reproject the coordinates to geographic coordinates
Reproject.ReprojectPoints(mapXY, mapZ, mapMain.Projection, KnownCoordinateSystems.Geographic.World.WGS1984, 0, 1)
Dim firstCoordWgs84 As New Coordinate(mapXY(0), mapXY(1), mapZ(0))
'create an array for the second coordinate in the map's projection
mapXY = {lastCoord.X, lastCoord.Y}
mapZ = {lastCoord.Z}
'now we reproject the coordinates to geographic coordinates
Reproject.ReprojectPoints(mapXY, mapZ, mapMain.Projection, KnownCoordinateSystems.Geographic.World.WGS1984, 0, 1)
Dim lastCoordWgs84 As New Coordinate(mapXY(0), mapXY(1), mapZ(0))
Debug.Print(" firstCoord Vertex in WGS84 x={0} y={1}", firstCoordWgs84.X, firstCoordWgs84.Y)
Debug.Print(" lastCoord Vertex in WGS84 x={0} y={1}", lastCoordWgs84.X, lastCoordWgs84.Y)
and here is that debug (with the last point being entirely different from the first attempt but this second attempt is the correct result)
firstCoord Vertex in MapProj x=4485207.83013716 y=2805066.943671
lastCoord Vertex in MapProj x=2656525.17410077 y=3950495.93338145
firstCoord Vertex in WGS84 x=-42.9779741870071 y=45.0079085872576
lastCoord Vertex in WGS84 x=-18.9190007521499 y=49.133436167914
~AGP
The text was updated successfully, but these errors were encountered:
This issue was imported from CodePlex
sindizzy wrote 2016-05-05 at 00:34
It took me some time to debug this but I dont think Reproject.ReprojectPoints is working like it should. I take two points on my map (NorthPoleStereographic) and want to reproject them to WGS84. I setup the calculation and only the first point comes out
correct. When I do them individually then both come out correct. Can someone maybe point out my shortcoming.
Now in that projection here are my coordinates:
So my first attempt is to send all points at once:
and here is the debug (not sure how the last coordinate was calculated)
My second attempt reprojects the points one at a time
and here is that debug (with the last point being entirely different from the first attempt but this second attempt is the correct result)
~AGP
The text was updated successfully, but these errors were encountered: