Re: [OpenMap Users] Problems setting up a projection

From: Pavel Lysianskyi <otgolosok_at_gmail.com>
Date: Sun, 31 Aug 2008 20:07:37 +0300

Robert,
sorry for personal message, gmail missed Openmap maillist.

On Sun, Aug 31, 2008 at 5:04 PM, Robert Kosara <robert_at_eagereyes.org> wrote:
> I guess I'm not understanding how scale works, because I thought it would
> map the lat,lon values to screen coordinates, so when those are close, the
> scale would be small. But even a scale of 100 (or 100,000) doesn't seem to
> make a difference. I'm pasting a test program below. It gives me (200,200)
> when I try to project the projection center (which is the expected value for
> a width and height of 400), but anything else is way off. The example below
> results in the output (145052424, 7284944).
It is correct result. Some calculation examples,

Scale of 1:1(theoretically) projects line of 1 meter length in
geo-spatial coordinates to line of 3272 pixels in screen coordinates
(_at_see com.bbn.openmap.proj.Planet.defaultPixelsPerMeter and
com.bbn.openmap.proj.Proj::init() )
Line (0,0) - (0,1) (lat, lon in decimal degrees) which is 60 nautical
mile length, or 1852 * 60 = 111120 meters
and at scale 1:1000 000 it will be displayed as 111120 * 3272 /
1000000 = 363 pixels line
Compare this with output of
        public static void main(String args[]) {

                LatLonPoint center = new LatLonPoint(0, 0);
                LatLonPoint degreePoint = new LatLonPoint(0, 1);

                System.out.println("Distance in miles: "
                                + Math.round(Length.NM.fromRadians(center.distance(new
LatLonPoint(0, 1)))));
                System.out.println("Distance in meters: "
                                + Math.round(Length.METER.fromRadians(center.distance(degreePoint))));

                Projection proj = new Mercator(center, 1000000, 400, 400);
                System.out.println(proj.forward(center).distance(proj.forward(degreePoint)));
        }

Hope this helps you to understand math and logic.

--
[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 Sun Aug 31 2008 - 13:08:31 EDT

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