- Contemporary messages sorted: [ by date ] [ by thread ] [ by subject ] [ by author ] [ by messages with attachments ]

From: Stéphane Wasserhardt <swasserhardt_at_cls.fr>

Date: Wed, 15 Mar 2006 13:21:09 +0100

Hello list !

I have a problem using mercator projection :

When if zoom out to the maximum (1:204 883 520), projection.getUpperLeft()

and projection.getLowerRight() sometimes seems to give bad longitude values.

Zoomed out to the maximum should give an east value equal or less to the

west value, but I often get east value higher than west.

For instance I get west = 190.0 and east = 190.0000005 or something like that.

Maybe it is due to float rounding problems when the two values should be

the same, but the consequence is that the work done for this projection is

done only in a small area (width = 0.0000005) instead of a large one (width

= 360).

So I'm using the following code to work around this problem :

LatLonPoint ul = projection.getUpperLeft();

LatLonPoint lr = projection.getLowerRight();

float west = ul.getLongitude();

float south = lr.getLatitude();

float east = lr.getLongitude();

float delta = Math.abs(east - west);

if ((delta < 1) && (projection.getScale() > 100000000)) {

if (delta == 0)

delta = 0.0001f;

east = west - 2*delta;

if (east < -180)

east = 180;

}

I don't know if this problem happens with other projections. I use only

mercator and orthographic, and orthographic doesn't seem to generate this

error.

Maybe the piece of code I use (or a better version of it) should be added

to OpenMap's projections classes...

Could somebody give me more info about this?

Thanks a lot in advance !

Stephane

Date: Wed, 15 Mar 2006 13:21:09 +0100

Hello list !

I have a problem using mercator projection :

When if zoom out to the maximum (1:204 883 520), projection.getUpperLeft()

and projection.getLowerRight() sometimes seems to give bad longitude values.

Zoomed out to the maximum should give an east value equal or less to the

west value, but I often get east value higher than west.

For instance I get west = 190.0 and east = 190.0000005 or something like that.

Maybe it is due to float rounding problems when the two values should be

the same, but the consequence is that the work done for this projection is

done only in a small area (width = 0.0000005) instead of a large one (width

= 360).

So I'm using the following code to work around this problem :

LatLonPoint ul = projection.getUpperLeft();

LatLonPoint lr = projection.getLowerRight();

float west = ul.getLongitude();

float south = lr.getLatitude();

float east = lr.getLongitude();

float delta = Math.abs(east - west);

if ((delta < 1) && (projection.getScale() > 100000000)) {

if (delta == 0)

delta = 0.0001f;

east = west - 2*delta;

if (east < -180)

east = 180;

}

I don't know if this problem happens with other projections. I use only

mercator and orthographic, and orthographic doesn't seem to generate this

error.

Maybe the piece of code I use (or a better version of it) should be added

to OpenMap's projections classes...

Could somebody give me more info about this?

Thanks a lot in advance !

Stephane

-- [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 Wed Mar 15 2006 - 07:54:35 EST

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