Skip to content

Commit

Permalink
fix getLatitude() and getLongitude()
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbae committed Nov 21, 2018
1 parent bc0a688 commit 093783d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/main/java/com/microsoft/sqlserver/jdbc/Geography.java
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ public boolean hasZ() {
* @return double value that represents the latitude.
*/
public Double getLatitude() {
if (null != internalType && internalType == InternalSpatialDatatype.POINT && xValues.length == 1) {
return xValues[0];
if (null != internalType && internalType == InternalSpatialDatatype.POINT && yValues.length == 1) {
return yValues[0];
}
return null;
}
Expand All @@ -224,8 +224,8 @@ public Double getLatitude() {
* @return double value that represents the longitude.
*/
public Double getLongitude() {
if (null != internalType && internalType == InternalSpatialDatatype.POINT && yValues.length == 1) {
return yValues[0];
if (null != internalType && internalType == InternalSpatialDatatype.POINT && xValues.length == 1) {
return xValues[0];
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -968,8 +968,8 @@ public void testGetXGetY() throws SQLException {

x = geog.getLatitude();
y = geog.getLongitude();
assertEquals(x, 1);
assertEquals(y, 2);
assertEquals(x, 2);
assertEquals(y, 1);
}

@Test
Expand Down

0 comments on commit 093783d

Please sign in to comment.