3

I'm currently developing a small piece of (Java) software that should be able to display maps and the current GPS position within that map. I'm absolutely new to this, but it is pretty obvious that I'll have to do some kind of coordinate transformation. I've found "Proj4J", which seems to be able to do a lot for me. Now, what I have and what I want to do:

  1. I have a bitmap of a map. The projection of this map can be any "well-defined" one, like Lambert or Mercator. I cannot fix this to one projection.
  2. I have GPS coordinates from a "standard" GPS receiver. I believe they are lat/lon in WGS84, is that correct?

Now my questions: I must map the GPS position to basically "screen coordinates" in my map bitmap. And for that, I assume, reference points are needed for which I know their lat/lon and corresponding pixel positions. Since my map can easily cover a couple of hundred kilometers in range, a linear interpolation between the known points and an arbitrary position is probably not correct for all types of projections, am I right on that? I've read "Convert long/lat to pixel x/y on a given picure" so far, but this deals with a Mercator projection and I believe a linear approximation will work better than for a Lambert map. I imagine the whole process is as follows:

  1. "Calibrate" the map, i. e. identify two positions of known lat/lon in the bitmap and thus get their pixel position.
  2. Use the Proj.4-transformation from "lat/lon WGS84" to "map projection" to map those reference points from (1.) into map coordinates.
  3. Take the points from (2.) and map them again to a projection that will allow linear interpolation of the pixel positions, I'll call that the "pixel projection".
  4. Now I have two reference points with coordinates in the "pixel projection" and their corresponding pixel positions.

For a lat/lon value from the GPS receiver do the following:

  1. Convert the position to a map position using the "map projection".
  2. Take the map position from (1.) and convert it to a coordinate using the "pixel projection" from above.
  3. Since all distances in the "pixel projection" are maintained (that is the condition of the pixel projection!), an interpolation of the resulting coordinates from (2.) with the known position of the reference points from above can be made.

Here the big questions:

  1. Is this the way to go, using a final "pixel projection" to allow linear interpolation?
  2. What type of projection would that be and can that be done with Proj.4?
  3. Can the "way back" - I have a pixel position and want lat/lon be accomplished (like "pixel position" -> "pixel projection" -> "map projection" -> "lat/lon")?

Thank you very much, Jens.

Jens
  • 93
  • 9
  • I've thought about this for some more time. Would it be of help if I did an "final" mapping of the position in question and the reference points to UTM? My understanding is that UTM is a cartesian mapping - just like my bitmap image. – Jens May 04 '14 at 22:09
  • Are these charts Geotiff encoded? – user3344003 May 08 '14 at 01:27
  • No, I just have a map where I know the corner coordinates (in WGS84 lat/lon) and the projection of the map. – Jens May 08 '14 at 09:00
  • That works for a Mercator projection but you need more information for a Lambert and other types of projections. – user3344003 May 08 '14 at 14:15
  • What kind of "more information" would that be? Information about curvature of the projection e.g.? Is there a way to create a reasonable interpolation if I have nothing more than a number of mapped points? – Jens May 13 '14 at 06:42
  • For a Lambert Conformal Conical Projection you need: the two reference latitudes; the reference longitude; the elliptical flattening used for the earth; the diameter of the earth used; they X and Y pixel scaling; the X and Y rotation; the X and Y position of a reference position; the lat/long of that reference position. – user3344003 May 13 '14 at 18:49
  • @user3344003: I know the parameters for a LCC projection, but that's not the point. I need a suitable interpolation for _any_ kind of projection. The best way to go is probably to get as many reference points as possible (say, 30 landmarks) with known map coordiante/pixel position and choose the closest ones for interpolation. – Jens Jun 27 '14 at 15:38
  • You're going to need different mappings for different projections. On a Mercator projection, the latitude lines are parallel. Lambert has them curve. One interpolation is not going to work correctly for everything. – user3344003 Jun 28 '14 at 00:40

0 Answers0