@Override public PropertiesCollector collect(GridCoverage2DReader gridCoverageReader) { CoordinateReferenceSystem crs = gridCoverageReader.getCoordinateReferenceSystem(); crsCode = CRS.toSRS(crs, false); return this; } }
public String getSRS() { return CRS.toSRS(envelope.getCoordinateReferenceSystem()); }
String srsName = toSRS(crs); if (codeOnly && srsName != null) {
/** Sets BBOX and SRS using the provided Envelope. */ public void setBBox(Envelope envelope) { String version = properties.getProperty(VERSION); boolean forceXY = version == null || !version.startsWith("1.3"); String srsName = CRS.toSRS(envelope.getCoordinateReferenceSystem()); CoordinateReferenceSystem crs = toServerCRS(srsName, forceXY); Envelope bbox; try { bbox = CRS.transform(envelope, crs); } catch (TransformException e) { bbox = envelope; } StringBuffer sb = new StringBuffer(); sb.append(bbox.getMinimum(0)); sb.append(","); sb.append(bbox.getMinimum(1) + ","); sb.append(bbox.getMaximum(0) + ","); sb.append(bbox.getMaximum(1)); setBBox(sb.toString()); } /**
public String getSRS() { if (envelope instanceof ReferencedEnvelope) { CoordinateReferenceSystem crs = ((ReferencedEnvelope) envelope).getCoordinateReferenceSystem(); // 3D crs are not supported here if (crs != null && crs.getCoordinateSystem().getDimension() == 2) { return CRS.toSRS(((ReferencedEnvelope) envelope).getCoordinateReferenceSystem()); } } return null; }
public CRSEnvelope(Envelope envelope) { this.srsName = CRS.toSRS(envelope.getCoordinateReferenceSystem()); // this.srsName = epsgCode; this.minX = envelope.getMinimum(0); this.maxX = envelope.getMaximum(0); this.minY = envelope.getMinimum(1); this.maxY = envelope.getMaximum(1); }
public void testSRSAxisOrder() throws Exception { try { CoordinateReferenceSystem crs = CRS.decode("EPSG:4326"); assertEquals("EPSG:4326", CRS.toSRS(crs)); Hints.putSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE); CRS.reset("ALL"); assertEquals("urn:ogc:def:crs:EPSG::4326", CRS.toSRS(crs)); } finally { Hints.removeSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER); } }
properties.setProperty(Prop.MOSAIC_CRS, CRS.toSRS(mosaicConfiguration.getCrs()));
LOGGER.warning("Null CRS in feature type named [" + ftName + "]. Ignore CRS"); } else { srsName = CRS.toSRS(crs, true); // single implementation of toSRS if (srsName == null) {
System.setProperty("org.geotools.referencing.forceXY", "true"); assertEquals("CRS:84", CRS.toSRS(DefaultGeographicCRS.WGS84)); CoordinateReferenceSystem WORLD = CRS.decode("EPSG:4326", false); assertEquals("4326", CRS.toSRS(WORLD, true)); String srs = CRS.toSRS(WORLD, false); assertTrue("EPSG:4326", srs.contains("EPSG") && srs.contains("4326")); srs = CRS.toSRS(WORLD2, false); assertTrue("EPSG:4326", srs.contains("EPSG") && srs.contains("4326")); srs = CRS.toSRS(WORLD3, false); assertTrue("EPSG:4326", srs.contains("EPSG") && srs.contains("4326")); srs = CRS.toSRS(WORLD4, false); assertTrue("EPSG:4326", srs.contains("EPSG") && srs.contains("4326")); } finally {
String srsName = CRS.toSRS(TYPE.getCoordinateReferenceSystem()); if (srsName != null) { transform.setSrsName(srsName);
String srsName = CRS.toSRS(bbox.getCoordinateReferenceSystem()); ai.addAttribute("", "srsName", "", "anyURI", srsName); } else {
String srs = null; if (features.getSchema().getCoordinateReferenceSystem() != null) { srs = CRS.toSRS(features.getSchema().getCoordinateReferenceSystem());
assertTrue(value instanceof DirectPosition); DirectPosition pos = (DirectPosition) value; assertEquals(CRS.toSRS(pos.getCoordinateReferenceSystem()), "EPSG:4326"); assertEquals(pos.getDimension(), 2); assertEquals(pos.getOrdinate(0), 5.0, 0);
public void testFilter() throws Exception { ReprojectingFeatureCollection rfc = new ReprojectingFeatureCollection(delegate, target); ReferencedEnvelope bounds = delegate.getBounds(); ReferencedEnvelope rbounds = bounds.transform(target, true); // check the bounds filtering works the same way in the standard and reprojected case BBOX filter = ff.bbox( "", bounds.getMinX(), bounds.getMinY(), bounds.getMaxX(), bounds.getMaxY(), CRS.toSRS(delegate.getSchema().getCoordinateReferenceSystem())); BBOX rfilter = ff.bbox( "", rbounds.getMinX(), rbounds.getMinY(), rbounds.getMaxX(), rbounds.getMaxY(), CRS.toSRS(target)); assertEquals(delegate.subCollection(filter).size(), rfc.subCollection(rfilter).size()); }
public Bounds(ReferencedEnvelope bb) { this.minx = bb.getMinX(); this.maxx = bb.getMaxX(); this.miny = bb.getMinY(); this.maxy = bb.getMaxY(); this.crs = CRS.toSRS(bb.getCoordinateReferenceSystem()); }
public CRSEnvelope(Envelope envelope) { this.srsName = CRS.toSRS(envelope.getCoordinateReferenceSystem()); // this.srsName = epsgCode; this.minX = envelope.getMinimum(0); this.maxX = envelope.getMaximum(0); this.minY = envelope.getMinimum(1); this.maxY = envelope.getMaximum(1); }
assertEquals(refEnv.getMinY(), refEnv.getMaxY(), 0); assertEquals(refEnv.getMinY(), 2.5, 0); assertEquals(CRS.toSRS(refEnv.getCoordinateReferenceSystem()), "EPSG:4283"); assertEquals(env.getMinY(), 2.5, 0); assertEquals(env.getMaxY(), 5.0, 0); assertEquals(CRS.toSRS(refEnv.getCoordinateReferenceSystem()), "EPSG:4283"); assertEquals(refEnv.getMinY(), 2.5, 0); assertEquals(refEnv.getMaxY(), 5.0, 0); assertEquals(CRS.toSRS(refEnv.getCoordinateReferenceSystem()), "EPSG:4283");
public BBOX bbox(Expression geometry, BoundingBox bounds, MatchAction matchAction) { return bbox( geometry, bounds.getMinX(), bounds.getMinY(), bounds.getMaxX(), bounds.getMaxY(), CRS.toSRS( bounds.getCoordinateReferenceSystem() ), matchAction ); }