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

From: Don Dietrick <dietrick_at_bbn.com>
Date: Fri, 10 Feb 2006 23:55:00 -0500

Hi Greg,

For me, that height and width for a screen won't allow that scale
(the scale gets limited to 1:210,474,240, if you try to zoom out
further, the projection won't allow it because the whole earth is
covered at the limit), but the coordinates for that mouse position
seem to be on target. What were you expecting?

- Don


On Feb 10, 2006, at 11:08 PM, Greg Bulla wrote:

> 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"]

--
[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:55:27 EST

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