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

From: Greg Bulla <gbulla_at_yahoo.com>
Date: Fri, 10 Feb 2006 21:06:53 -0800 (PST)

Don

I wasn't aware what the scale limit was (I knew it had one). It could
be the problem - I will check. It should have put me in the
southwestern US area, near San Diego, but as you can see it is
jumping to the southern hemisphere somewhere around
Venezuela/Columbia.

Will try the scale correction and post the results - Thanks!
GB


> 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 Sat Feb 11 2006 - 00:07:27 EST

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