本文整理了Java中org.geotools.referencing.CRS.toSRS()
方法的一些代码示例,展示了CRS.toSRS()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CRS.toSRS()
方法的具体详情如下:
包路径:org.geotools.referencing.CRS
类名称:CRS
方法名:toSRS
[英]Returns the Spatial Reference System identifier, or null if none. OGC Web Services have the concept of a Spatial Reference System identifier used to communicate CRS information between systems.
Spatial Reference System (ie SRS) values:
代码示例来源:origin: geotools/geotools
@Override
public PropertiesCollector collect(GridCoverage2DReader gridCoverageReader) {
CoordinateReferenceSystem crs = gridCoverageReader.getCoordinateReferenceSystem();
crsCode = CRS.toSRS(crs, false);
return this;
}
}
代码示例来源:origin: geotools/geotools
public String getSRS() {
return CRS.toSRS(envelope.getCoordinateReferenceSystem());
}
代码示例来源:origin: geotools/geotools
String srsName = toSRS(crs);
if (codeOnly && srsName != null) {
代码示例来源:origin: geotools/geotools
/** 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());
}
/**
代码示例来源:origin: geotools/geotools
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;
}
代码示例来源:origin: geotools/geotools
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);
}
代码示例来源:origin: geotools/geotools
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);
}
}
代码示例来源:origin: geotools/geotools
properties.setProperty(Prop.MOSAIC_CRS, CRS.toSRS(mosaicConfiguration.getCrs()));
代码示例来源:origin: geotools/geotools
LOGGER.warning("Null CRS in feature type named [" + ftName + "]. Ignore CRS");
} else {
srsName = CRS.toSRS(crs, true); // single implementation of toSRS
if (srsName == null) {
代码示例来源:origin: geotools/geotools
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 {
代码示例来源:origin: geotools/geotools
miny = env.getMinY();
maxy = env.getMaxY();
srs = CRS.toSRS(env.getCoordinateReferenceSystem());
} else {
Envelope env = null;
srs = (String) geom.getUserData();
} else if (geom.getUserData() instanceof CoordinateReferenceSystem) {
srs = CRS.toSRS((CoordinateReferenceSystem) geom.getUserData());
代码示例来源:origin: geotools/geotools
String srsName = CRS.toSRS(TYPE.getCoordinateReferenceSystem());
if (srsName != null) {
transform.setSrsName(srsName);
代码示例来源:origin: geotools/geotools
String srsName = CRS.toSRS(bbox.getCoordinateReferenceSystem());
ai.addAttribute("", "srsName", "", "anyURI", srsName);
} else {
代码示例来源:origin: geotools/geotools
String srs = null;
if (features.getSchema().getCoordinateReferenceSystem() != null) {
srs = CRS.toSRS(features.getSchema().getCoordinateReferenceSystem());
代码示例来源:origin: geotools/geotools
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);
代码示例来源:origin: geotools/geotools
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());
}
代码示例来源:origin: org.geoserver.community/gs-notification-common
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());
}
代码示例来源:origin: org.geotools/gt-wms
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);
}
代码示例来源:origin: geotools/geotools
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");
代码示例来源:origin: org.geotools/gt-main
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 );
}
内容来源于网络,如有侵权,请联系作者删除!