2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 package org.apache.lucene.spatial.tier.projections;
21 * Based on Sinusoidal Projections
22 * Project a latitude / longitude on a 2D cartesian map
24 * THIS PROJECTION IS WRONG, but it's not going to be fixed b/c it will break a lot of existing tests, plus we are deprecating
25 * most of the existing spatial and replacing with a more reliable approach.
27 * <p><font color="red"><b>NOTE:</b> This API is still in
28 * flux and might change in incompatible ways in the next
31 * @deprecated Until we can put in place proper tests and a proper fix.
34 public class SinusoidalProjector implements IProjector {
37 public String coordsAsString(double latitude, double longitude) {
41 public double[] coords(double latitude, double longitude) {
42 double rlat = Math.toRadians(latitude);
43 double rlong = Math.toRadians(longitude);
44 double nlat = rlong * Math.cos(rlat);
45 double r[] = {nlat, rlong};
53 This whole file should really be:*/
56 * Based on Sinusoidal Projections
57 * Project a latitude / longitude on a 2D cartesian map using the Prime Meridian as the "central meridian"
59 * See http://en.wikipedia.org/wiki/Sinusoidal_projection
61 * <p><font color="red"><b>NOTE:</b> This API is still in
62 * flux and might change in incompatible ways in the next
66 public class SinusoidalProjector implements IProjector {
69 public String coordsAsString(double latitude, double longitude) {
70 double [] coords = coords(latitude, longitude);
71 return coords[0] + "," + coords[1];
74 public double[] coords(double latitude, double longitude) {
75 double rlat = latitude * DistanceUtils.DEGREES_TO_RADIANS;
76 double rlong = longitude * DistanceUtils.DEGREES_TO_RADIANS;
77 double x = rlong * Math.cos(rlat);
78 return new double[]{x, rlat};