/** * This test is currently broken. It's a placeholder for some logic that sfarber wrote which tries * to guess the SRS of a featureclass, based on connecting to it via an SeLayer. * * @throws Throwable */ @Test @Ignore public void testAutoFillSRS() throws Throwable { ArcSDEDataStore ds = testData.getDataStore(); CoordinateReferenceSystem sdeCRS = ds.getSchema("GISDATA.TOWNS_POLY").getGeometryDescriptor().getCoordinateReferenceSystem(); LOGGER.info(sdeCRS.toWKT().replaceAll(" ", "").replaceAll("\n", "").replaceAll("\"", "\\\"")); // CoordinateReferenceSystem epsgCRS = CRS.decode("EPSG:26986"); // LOGGER.info("are these two CRS's equal? " + // CRS.equalsIgnoreMetadata(sdeCRS, epsgCRS)); if (1 == 1) return; int epsgCode = -1; int[] projcs = PeFactory.projcsCodelist(); LOGGER.info(projcs.length + " projections available."); for (int i = 0; i < projcs.length; i++) { try { PeProjectedCS candidate = PeFactory.projcs(projcs[i]); // in ArcSDE 9.2, if the PeFactory doesn't support a projection // it claimed // to support, it returns 'null'. So check for it. if (candidate != null && candidate.getName().indexOf("Massachusetts") != -1) { // LOGGER.info("\n\n" + projcs[i] + " has name " + // candidate.getName() + "\ntried to match " + wktName + // "\n\n"); epsgCode = projcs[i]; } else if (candidate == null) { // LOGGER.info(projcs[i] + " was null"); } else if (candidate != null) { // LOGGER.info(projcs[i] + " wasn't null"); } } catch (PeProjectionException pe) { // Strangely SDE includes codes in the projcsCodeList() that // it doesn't actually support. // Catch the exception and skip them here. } } }