You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Trejkaz <tr...@trypticon.org> on 2017/01/12 01:00:31 UTC

Where did earthDiameter go?

Hi.

I don't know why, but we have some kind of esoteric logic in our own
code to simplify a circle on the Earth to a bounding box, clearly
something to do with computing geo queries.

    double lonMin = -180.0, lonMax = 180.0;
    if (!closeToPole(latMin, latMax)) {
       double D = SloppyMath.earthDiameter(lat);
        double d = D * Math.sin((90.0 - lat) * Math.PI / 180.0); //
diameter of a disk formed by parallel at latitude = lat
       double kmPerLonDeg = Math.PI * d / 360.0;
        double distanceInLonDeg = distanceKm / kmPerLonDeg;
       lonMin = lon - distanceInLonDeg;
        lonMax = lon + distanceInLonDeg;
    }

This SloppyMath.earthDiameter(latitude) method appears to be gone in
v6.3.0 but I don't see any mention of a replacement in the changelog.
Is there a replacement? Do I just slot in a constant and hope that
nobody notices? I mean, if the maths are supposed to be "sloppy"... :D

TX

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Where did earthDiameter go?

Posted by Adrien Grand <jp...@gmail.com>.
Agreed it should have had the tag and we should review whether we still
have public classes that miss it.

Le ven. 20 janv. 2017 à 09:13, Trejkaz <tr...@trypticon.org> a écrit :

> On Wed, Jan 18, 2017 at 5:43 AM, Adrien Grand <jp...@gmail.com> wrote:
> > I think the reason why there was no deprecation notice is that this code
> > was considered as internal code rather than something that we explicitly
> > expose to users as an API.
>
> Hmm...
>
>
> http://lucene.apache.org/core/5_5_3/core/org/apache/lucene/util/SloppyMath.html
>
> Public class, public methods, no @lucene.internal Javadoc tag... Looks like
> public API to me. Probably looked like public API to our other developer
> who
> added the call, too. Probably should at least slap the tag on the docs if
> we're
> not supposed to use it. I'm sure we have calls to the other methods, too.
> :/
>
> TX
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Re: Where did earthDiameter go?

Posted by Trejkaz <tr...@trypticon.org>.
On Wed, Jan 18, 2017 at 5:43 AM, Adrien Grand <jp...@gmail.com> wrote:
> I think the reason why there was no deprecation notice is that this code
> was considered as internal code rather than something that we explicitly
> expose to users as an API.

Hmm...

http://lucene.apache.org/core/5_5_3/core/org/apache/lucene/util/SloppyMath.html

Public class, public methods, no @lucene.internal Javadoc tag... Looks like
public API to me. Probably looked like public API to our other developer who
added the call, too. Probably should at least slap the tag on the docs if we're
not supposed to use it. I'm sure we have calls to the other methods, too. :/

TX

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Where did earthDiameter go?

Posted by Adrien Grand <jp...@gmail.com>.
I think the reason why there was no deprecation notice is that this code
was considered as internal code rather than something that we explicitly
expose to users as an API.

Le jeu. 12 janv. 2017 à 22:30, Chris Hostetter <ho...@fucit.org> a
écrit :

>
> I don't konw the rhyme/reason but it looks like it was removed (w/o
> any deprecation first i guess) as part of LUCENE-7123 in commit:
> ce3114233bdc45e71a315cb6ece64475d2d6b1d4
>
> in that commit, existing callers in the lucene code base were changed to
> use "2 * GeoProjectionUtils.SEMIMAJOR_AXIS"
>
> (once the jira outage is over you might find more info in the comments of
> that issue)
>
>
> : Date: Thu, 12 Jan 2017 12:00:31 +1100
> : From: Trejkaz <tr...@trypticon.org>
> : Reply-To: java-user@lucene.apache.org
> : To: Lucene Users Mailing List <ja...@lucene.apache.org>
> : Subject: Where did earthDiameter go?
> :
> : Hi.
> :
> : I don't know why, but we have some kind of esoteric logic in our own
> : code to simplify a circle on the Earth to a bounding box, clearly
> : something to do with computing geo queries.
> :
> :     double lonMin = -180.0, lonMax = 180.0;
> :     if (!closeToPole(latMin, latMax)) {
> :        double D = SloppyMath.earthDiameter(lat);
> :         double d = D * Math.sin((90.0 - lat) * Math.PI / 180.0); //
> : diameter of a disk formed by parallel at latitude = lat
> :        double kmPerLonDeg = Math.PI * d / 360.0;
> :         double distanceInLonDeg = distanceKm / kmPerLonDeg;
> :        lonMin = lon - distanceInLonDeg;
> :         lonMax = lon + distanceInLonDeg;
> :     }
> :
> : This SloppyMath.earthDiameter(latitude) method appears to be gone in
> : v6.3.0 but I don't see any mention of a replacement in the changelog.
> : Is there a replacement? Do I just slot in a constant and hope that
> : nobody notices? I mean, if the maths are supposed to be "sloppy"... :D
> :
> : TX
> :
> : ---------------------------------------------------------------------
> : To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> : For additional commands, e-mail: java-user-help@lucene.apache.org
> :
> :
>
> -Hoss
> http://www.lucidworks.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Re: Where did earthDiameter go?

Posted by Chris Hostetter <ho...@fucit.org>.
I don't konw the rhyme/reason but it looks like it was removed (w/o 
any deprecation first i guess) as part of LUCENE-7123 in commit: 
ce3114233bdc45e71a315cb6ece64475d2d6b1d4

in that commit, existing callers in the lucene code base were changed to 
use "2 * GeoProjectionUtils.SEMIMAJOR_AXIS"

(once the jira outage is over you might find more info in the comments of 
that issue)


: Date: Thu, 12 Jan 2017 12:00:31 +1100
: From: Trejkaz <tr...@trypticon.org>
: Reply-To: java-user@lucene.apache.org
: To: Lucene Users Mailing List <ja...@lucene.apache.org>
: Subject: Where did earthDiameter go?
: 
: Hi.
: 
: I don't know why, but we have some kind of esoteric logic in our own
: code to simplify a circle on the Earth to a bounding box, clearly
: something to do with computing geo queries.
: 
:     double lonMin = -180.0, lonMax = 180.0;
:     if (!closeToPole(latMin, latMax)) {
:        double D = SloppyMath.earthDiameter(lat);
:         double d = D * Math.sin((90.0 - lat) * Math.PI / 180.0); //
: diameter of a disk formed by parallel at latitude = lat
:        double kmPerLonDeg = Math.PI * d / 360.0;
:         double distanceInLonDeg = distanceKm / kmPerLonDeg;
:        lonMin = lon - distanceInLonDeg;
:         lonMax = lon + distanceInLonDeg;
:     }
: 
: This SloppyMath.earthDiameter(latitude) method appears to be gone in
: v6.3.0 but I don't see any mention of a replacement in the changelog.
: Is there a replacement? Do I just slot in a constant and hope that
: nobody notices? I mean, if the maths are supposed to be "sloppy"... :D
: 
: TX
: 
: ---------------------------------------------------------------------
: To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
: For additional commands, e-mail: java-user-help@lucene.apache.org
: 
: 

-Hoss
http://www.lucidworks.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org