0

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;

Coordinates of the map

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.

kiu
  • 1
  • 1
  • This is a 7th grade geography questions where you learn the different types of projection maps. Do you know what type of map you have? The code is using a Mercator Projection Map and you map may not be Mercator Map (see wiki https://en.wikipedia.org/wiki/Mercator_projection). And https://en.wikipedia.org/wiki/List_of_map_projections – jdweng Aug 22 '17 at 14:38
  • I must have been sick in seventh grade :-)... As noted above though, my map is lcc (see the first projection definition). I need to transform lat/lon values so I can place them correctly with x/y values on that map. The values I'm getting so far are wrong though. So is the approach to convert from circular latlon to lcc wrong? What should I try instead? – kiu Aug 23 '17 at 09:50

1 Answers1

0

Mercator is not circular. You want to convert from conic which is circular using the center of the map as the reference point. The earth is 25,000 mile in circumference and 8,000 miles in diameter. So if you look at the earth from the moon and saw the earth flat you would see a circles of 8,000 miles in diameter which is really at the equator a half circle of 12,500 miles. So the curvature of the earth is a ratio of 12,500/8000 = 1.5. Actually this is pi * r/2r = pi/2 = 1.57.

GPS longitude goes from -324000000(West) to +324000000 (East) and latitude goes from 0 (equator) to +/-162000000.0 (North/South Pole). You will notice that the max longitude (180 degrees) is twice the max latitude (90 degrees). So GPS scale is the same for both latitude and longitude.

So I think the only thing you need to do is to multiple the distance by the scaling factor 1.57.

jdweng
  • 33,250
  • 2
  • 15
  • 20