[OpenMap Users] Problem getting lat/lon from screen coordinates

From: Greg Bulla <gbulla_at_yahoo.com>
Date: Fri, 10 Feb 2006 20:08:09 -0800 (PST)

HI - I'm trying to obtain a lat/lon position from screen coordinates,
but the return values are way off from what I'm expecting. I'm using
the Mercator projection.

Below is a code snippet. I'm passing in the following values: x=459
y=319 centerLat=33.2 centerLon=-116.0 projectionType=mercator
width=620 height=438 scale=1.0E9

It is returning lat=-20.562952 and new lon=-32.1875.

Perhaps the inverse method doesn't work the way I expected. Any
ideas? Thanks,

Greg

------------------------------

private LatLonPoint getLatLonFromScreenCoordinates(int x, int y,
double centerLat, double centerLon, String projectionType, int width,
int height, float scale)
{
   LatLonPoint centerLatLonPoint = new LatLonPoint(centerLat,
centerLon);
   Projection projection = null;

   if (projectionType.equalsIgnoreCase("Mercator"))
   {
      projection = new Mercator(centerLatLonPoint, scale, width,
height);
      return projection.inverse(x, y);
   }
.
.
.

-----------------------

--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Fri Feb 10 2006 - 23:09:16 EST

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:07 EDT