Steps to reproduce:
PROJCS["WGS_1984_Web_Mercator_Auxiliary_Sphere",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator_Auxiliary_Sphere"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",0.0],PARAMETER["Standard_Parallel_1",0.0],PARAMETER["Auxiliary_Sphere_Type",0.0],UNIT["Meter",1.0]]
Center the map on the 180 degree meridian at the equator (near baker island), configuring the map extent so the bottom left and top right corner are as follows:
bottomLeft: Point [m_attributes=[1.9449581424337383E7, -626899.6119120895], m_description=com.esri.core.geometry.VertexDescription@7c5d0f85]
topRight: Point [m_attributes=[2.0623654149388406E7, 706162.1279895945], m_description=com.esri.core.geometry.VertexDescription@7c5d0f85]
Point bottomLeft = mMapView.toMapPoint(0, mMapView.getHeight()); Point topRight = mMapView.toMapPoint(mMapView.getWidth(), 0); SpatialReference WGS84 = SpatialReference.create(SpatialReference.WKID_WGS84); Point wgs84BottomLeft = (Point)GeometryEngine.project(bottomLeft, mMap.getSpatialReference(), WGS84); Point wgs84TopRight = (Point)GeometryEngine.project(topRight, mMap.getSpatialReference(), WGS84);
Expected result: Two valid WGS84 points
Actual result:
wgs84bottomLeft: Point [m_attributes=[174.71856263209403, -5.622489445477077], m_description=com.esri.core.geometry.VertexDescription@7c5d0f85]
wgs84topRight: Point [m_attributes=[NaN, NaN], m_description=com.esri.core.geometry.VertexDescription@7c5d0f85]
This issue becomes even worse if you move the extent further east, and you can easily get into a situation where both points return NaN.
Solved! Go to Solution.
Fixed using normalizeCentralMeridian from the latest version of the SDK. See bottom half of this page for more details: Enable wrap around—ArcGIS Runtime SDK for Android | ArcGIS for Developers
Fixed using normalizeCentralMeridian from the latest version of the SDK. See bottom half of this page for more details: Enable wrap around—ArcGIS Runtime SDK for Android | ArcGIS for Developers