0

I am trying to develop an Android application to display a user location on a jpg image of a map which user insert. Using gps coordinates of two positions I calculate the distance between two positions. I need to set that distance on the map jpg image between two locations. I tried getting DPI of the image (which I assumed will be the same as Device's display DPI value) and calculate the pixel distance of the jpg image. But the out put seems wrong. The out put pixel distance is change every time. I assume this happens because the azimuth and DPI is wrong. Do you guys have any idea how to achieve this. Please if you have any sample code let me refer

Thank you very much

2 Answers2

1

I believe you are making the same question as in this topic.

See my answer there: Show current location of user on an offline static image (jpeg) - Android

good luck.

Community
  • 1
  • 1
Luis
  • 11,978
  • 3
  • 27
  • 35
0

It looks like you are trying to do what these two other Android apps are already doing:

MapCalibrator by Martin Ohlin

Custom Maps by Marko Teittinen

Anyway, as you can see, you cannot simply rely on DPI for this. Look around for a real graphics/image library that supports the kind of operations you need (distance between two points and the like).

AlexBottoni
  • 2,237
  • 20
  • 24