I am using the fromPixels() function in osmdroid (3.05) like so:
public boolean onScroll(ScrollEvent e) {
//get the scroll's destination
GeoPoint g = (GeoPoint) e.getSource().getProjection().fromPixels(e.getX(), e.getY());
Toast.makeText(e.getSource().getContext(), "in e6: " +
g.getLongitudeE6() + " " + g.getLatitudeE6() + " in deg's" +
convertToDecimalDegrees(g.getLongitudeE6())
+ " " + convertToDecimalDegrees(g.getLatitudeE6()), Toast.LENGTH_LONG).show();}
I am scrolling the map somewhere near -0.0029109 51.9933734 but in the toast i get:
-0.9613029999999999 76.60554499999999 so it seems like the lat is way off (the convert to decimal
degrees is Ok – i just multiply by 1E-6)
Am i using the function incorrectly?
From what i read it seems like my usage is fine, also i read that there used to be a problem with
that function but that it should be fixed now
Thanks in advance!
Omri
I know this thread is a little old but the answer to this question can be found on http://code.google.com/p/osmdroid/issues/detail?id=209
To point is to set max extent of map and restrict scrolling to that extent.
Below is the summary of issue mentioned above (Add the code below to MapView.java)
Now you can call the setScrollableAreaLimit method when map view is created or you can expand constructor with BoundingBoxE6 parameter.
Hope this helps.
In addition to this a correction for double tap bug is needed http://code.google.com/p/osmdroid/issues/detail?id=209#c23