Solved! Go to Solution.
private static final SpatialReference SPATIAL_REF_WGS84 = SpatialReference.create(4326); ... public static Geometry projectGeometryWGS84ToMap(Geometry geometryWGS84, SpatialReference spatialRefMap) throws ReprojectException { Geometry result; try { if (spatialRefMap != null && SPATIAL_REF_WGS84.getID() != spatialRefMap.getID()) { // reproject here result = GeometryEngine.project(geometryWGS84, SPATIAL_REF_WGS84, spatialRefMap); } else { // map is already in WGS 84 result = geometryWGS84; } } catch (ArrayIndexOutOfBoundsException e) { // In case of Polygon, I face this kind of Exception sometimes... but don't know why throw new ReprojectException ... } return result; }
private static final SpatialReference SPATIAL_REF_WGS84 = SpatialReference.create(4326); ... public static Geometry projectGeometryWGS84ToMap(Geometry geometryWGS84, SpatialReference spatialRefMap) throws ReprojectException { Geometry result; try { if (spatialRefMap != null && SPATIAL_REF_WGS84.getID() != spatialRefMap.getID()) { // reproject here result = GeometryEngine.project(geometryWGS84, SPATIAL_REF_WGS84, spatialRefMap); } else { // map is already in WGS 84 result = geometryWGS84; } } catch (ArrayIndexOutOfBoundsException e) { // In case of Polygon, I face this kind of Exception sometimes... but don't know why throw new ReprojectException ... } return result; }