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; }
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.