Thanks,
it is spherical mercator projection -> lat lon.

I have done a simple solution for this , it seems to work.
http://github.com/h4ck3rm1k3/GWTOsm/commit/51fb613e679d7a4ccb7ff8b74d41645397c48fbd

The program is now deployed and you can check it
http://xhema.flossk.org:8180/GWTOSM/

It is very very simple, but finally is working. Now I can add in more
features.
mike


On Jun 3, 2:16 pm, Brendan Kenny <bcke...@gmail.com> wrote:
> Mike --
>
> Eric is absolutely right, and I should have been more careful in my
> initial response, but for your case you should be fine with that
> simpler solution.
>
> Obviously I don't know what form that "EastNorth" object is going to
> be or what you input data looks like, but (assuming that the function
> fits your data and you take this advice with a large grain of salt)
> your initial function call should be fine precision-wise. Since it
> looks like you're just creating location markers based on where a user
> clicks, and even assuming you'll need that down to a tenth of an
> arcsecond, you'll need to be at ludicrously large zoom levels on the
> map before you run into any precision problems.
>
> FWIW,
>
> Math.atan(Math.sinh(p.north()))*180/Math.PI
>
> is equivalent to (in this domain)
>
> (2 * Math.atan(Math.exp(p.north())) - Math.PI/2) * 180/Math.PI
>
> (similar to the second code sample you posted). That gets you around
> using sinh() and might keep things a little neater numerically.
>
> With mapping, input noise will drown out a lot of other problems (the
> assumption that the earth is a perfect sphere alone...), so I'd go
> with the simple solution and just keep the rest in mind if you run
> into problems further down the line.
>
> On Jun 2, 10:49 am, "jamesmikedup...@googlemail.com"
>
> <jamesmikedup...@googlemail.com> wrote:
> > Hi all,
> > I don't want to sound stupid, but I am not a mathematical genius.
> > What i do know that is it taking a projected point  (on the screen in
> > Spherical Mercartor) to find out the lat long,
>
> > public LatLon eastNorth2latlon(EastNorth p) {
> >         return new LatLon(
> >                 Math.atan(Math.sinh(p.north()))*180/Math.PI,
> >                 p.east()*180/Math.PI);
> >     }
>
> > So the equivalent to this jsom code that I am porting is the open
> > layers code.
>
> > I think this might be correct, but I am not certain. They look
> > different.
>
> >http://trac.openlayers.org/browser/sandbox/crschmidt/google/lib/OpenL...
>
> > inverseMercator: function(merc) {
> > 221
> > 222             var lon = (merc.lon / 20037508.34) * 180;
> > 223             var lat = (merc.lat / 20037508.34) * 180;
> > 224
> > 225             lat = 180/Math.PI * (2 * Math.atan(Math.exp(lat *
> > Math.PI / 180)) - Math.PI / 2);
> > 226
> > 227             return new OpenLayers.LonLat(lon, lat);
> > 260         },
> > 261
>
> > But this projection transformation is common, and also done by the
> > google maps api. I will have to look into this some more.
>
> > thanks,
> > mike
> > On Jun 2, 4:37 pm, Eric <erjab...@gmail.com> wrote:
>
> > > On Jun 2, 4:21 am, Brendan Kenny <bcke...@gmail.com> wrote:
>
> > > > 2) or, if it needs to remain in js-land, just expose a sinh() function
> > > > for use just like the page at your first link suggests: (e^x - e^(-
> > > > x)) / 2. Just be careful with your NaNs and Infs.
>
> > > Actually, be careful with small values of x too.
> > >   e^x = 1 + x +x^2/2 + x^3/6 +..., but
> > >   sinh x = x + x^3 / 6 + ....
>
> > > Using e^x directly for small values of x automatically loses
> > > significant digits.
> > > The mathematical definition of a special function is rarely the way
> > > you want
> > > to compute it.  Look up computational procedures in AMS 55, or the
> > > Numerical Recipes series.  You might find yourself using continued
> > > fractions,
> > > or Pade approximants. You almost certainly want to use different
> > > procedures
> > > for different values of x.
>
> > > Given that you have expm1 available, try sinh x = e^(-x) (e^(2x) - 1) /
> > > 2 if you
> > > have nothing else available: Math.exp(-x) * Math.expm1(2.0*x) / 2.0.
> > > Switch
> > > to the standard method when |x| > 0.1.  But in any case, use e^(-x) =
> > > 1/e^x.
>
> > > Look up AMS 55 (Abromowitz and Stegun), the Numerical Recipes series
> > > (Press, et al),
> > > and Numerical Methods that (Usually) Work (Acton).
>
> > > Why is the original poster using hyperbolic functions anyway?
>
> > > Respectfully,
> > > Eric Jablow
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to