Pavel,
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).
Here's the code:
import java.awt.Point;
import com.bbn.openmap.LatLonPoint;
import com.bbn.openmap.proj.Mercator;
import com.bbn.openmap.proj.Projection;
public class ProjectionTest {
public static void main(String args[]) {
LatLonPoint center = new LatLonPoint(-80, 35);
LatLonPoint coords = new LatLonPoint(-85, 37);
Projection projection = new Mercator(center, 100f, 400, 400);
Point p = new Point();
projection.forward(coords, p);
System.out.println("Result: "+p.y+", "+p.x);
}
}
Any help would be appreciated!
Robert
On Aug 31, 2008, at 3:28 AM, Pavel Lysianskyi wrote:
> On Sun, Aug 31, 2008 at 4:41 AM, Robert Kosara
> <robert_at_eagereyes.org> wrote:
>> Hello,
>>
>> I'm creating a Mercator projection (either directly or using
>> ProjectionFactory, doesn't seem to make a difference) with the
>> center in
>> decimal degrees (58.17360, -96.21688), a scale factor of about 5
>> (also tried
>> 1), and a width and height of 400 pixels. Projecting the point
>> (23.010168,
>> -116.91656) results in the projected coordinates (200, -206577832).
>>
>> What am I doing wrong? These should all be decimal degrees, right?
>> Do I
>> need another scale factor? I tried using a scale factor of
>> 10,000,000, but
>> that only compressed everything in the x direction. What else could
>> be
>> wrong? I'm using the forward function with two floats and a Point).
>>
> Show the code lines where you initialize Projection instance.
> Scale factor 5 (also as 1) is to small for current OpenMap math engine
> (it is limitation of float precision) try some in range 100 - 60.
> Regards, Pavel.
--
[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 - 11:38:37 EDT