I have written an augmented reality app that will place objects on top of printed street maps. I know the GPS coordinates of each corner of each map and could calculate a relative value where to place any object on this map. While this worked good with an atlas format, I am now integrating large folding maps (p.e. France) where the deviation of positions became unacceptable.
I have no experience whatsoever in coordinate projection, so I found proj.4 which seemed perfect and was really happy to find a unity3d integration. But whatever I try I am getting wrong values back (probably my fault as I don’t have a deep understanding what I’m doing here)
This is the projection oft the map all my other maps are produced from (I’ve assembled the string myself, it might contain syntactical errors, the values are correct though)
"+proj=lcc +lat_1 =49 +lat_2=46 +lat_0=47.5 +lon_0=13.33333333333333 +x_0=400000 +y_0=400000 +ellps = bessel +datum=hermannskogel +towgs84=577.326,90.129,463.919,5.137,1.474,5.297,2.4232 +units=m +no_defs";
I would presume that I have to project from a spherical latlon or the webmercator which seem tob e pretty similar(at least the results are) to lcc
Webmercator:
"+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs";
Latlon:
"+proj=latlong +a=6370 +b=6370 +towgs84=0,0,0 +no_defs"
So I initialize the projections, and then transformt he list of positions: WebMercator.Transform(mainMapProj, xValues, yValues);
As test data set I’m using the GPS coordinates of my southern france map:
testMap.TopLeft_lat = 46.985;
testMap.TopLeft_lon = -3.702;
testMap.TopRight_lat = 47.3162;
testMap.TopRight_lon = 9.1447;
testMap.BottomRight_lat = 42.41;
testMap.BottomRight_lon = 9.1667;
testMap.BottomLeft_lat = 41.3022;
testMap.BottomLeft_lon = -2.291;
As well as the coordinate oft he random city of chereay
cheray.lat = 45.97316;
cheray.lon = -1.352547;
Correctly projected, the coordinates should roughly result in a rectangle (printed page) and the city should be relatively placed at roughly (0.1748,0.9044) from the lower left corner of the rectangle.
The values I’m getting are far off. I don’t know what I’m doing wrong and how to continue. Thanks in advance for any hint.