File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/geo
src/main/asciidoc/reference Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change 2121import org .springframework .data .geo .Point ;
2222
2323/**
24- * {@link GeoJson} representation of {@link Point}.
24+ * {@link GeoJson} representation of {@link Point}. Uses {@link Point#getX()} as {@literal longitude} and
25+ * {@link Point#getY()} as {@literal latitude}.
2526 *
2627 * @author Christoph Strobl
2728 * @since 1.7
@@ -36,15 +37,17 @@ public class GeoJsonPoint extends Point implements GeoJson<List<Double>> {
3637 /**
3738 * Creates {@link GeoJsonPoint} for given coordinates.
3839 *
39- * @param x : longitude
40- * @param y : latitude
40+ * @param x longitude between {@literal -180} and {@literal 180} (inclusive).
41+ * @param y latitude between {@literal -90} and {@literal 90} (inclusive).
4142 */
4243 public GeoJsonPoint (double x , double y ) {
4344 super (x , y );
4445 }
4546
4647 /**
4748 * Creates {@link GeoJsonPoint} for given {@link Point}.
49+ * <p>
50+ * {@link Point#getX()} translates to {@literal longitude}, {@link Point#getY()} to {@literal latitude}.
4851 *
4952 * @param point must not be {@literal null}.
5053 */
@@ -61,9 +64,10 @@ public String getType() {
6164 return TYPE ;
6265 }
6366
64- /*
65- * (non-Javadoc)
66- * @see org.springframework.data.mongodb.core.geo.GeoJson#getCoordinates()
67+ /**
68+ * Obtain the coordinates (x/longitude, y/latitude) array.
69+ *
70+ * @return the coordinates putting {@link #getX() x/longitude} first, and {@link #getY() y/latitude} second.
6771 */
6872 @ Override
6973 public List <Double > getCoordinates () {
Original file line number Diff line number Diff line change @@ -1537,6 +1537,12 @@ public class Store {
15371537----
15381538====
15391539
1540+ [TIP]
1541+ ====
1542+ If the `coordinates` of a GeoJSON object represent _latitude_ and _longitude_ pairs, the _longitude_ goes first followed by _latitude_. +
1543+ `GeoJsonPoint` therefore treats `getX()` as _longitude_ and `getY()` as _latitude_.
1544+ ====
1545+
15401546[[mongo.geo-json.query-methods]]
15411547==== GeoJSON Types in Repository Query Methods
15421548
You can’t perform that action at this time.
0 commit comments