本文整理汇总了Java中org.opengis.referencing.crs.CoordinateReferenceSystem.getCoordinateSystem方法的典型用法代码示例。如果您正苦于以下问题:Java CoordinateReferenceSystem.getCoordinateSystem方法的具体用法?Java CoordinateReferenceSystem.getCoordinateSystem怎么用?Java CoordinateReferenceSystem.getCoordinateSystem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opengis.referencing.crs.CoordinateReferenceSystem
的用法示例。
在下文中一共展示了CoordinateReferenceSystem.getCoordinateSystem方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: clipRange
import org.opengis.referencing.crs.CoordinateReferenceSystem; //导入方法依赖的package包/类
/**
*
* @param val
* the value
* @param crs
* @param axis
* the coordinate axis
* @return
*/
private static double clipRange(
final double val,
final CoordinateReferenceSystem crs,
final int axis ) {
final CoordinateSystem coordinateSystem = crs.getCoordinateSystem();
if (coordinateSystem.getDimension() > axis) {
final CoordinateSystemAxis coordinateAxis = coordinateSystem.getAxis(axis);
if (val < coordinateAxis.getMinimumValue()) {
return coordinateAxis.getMinimumValue();
}
else if (val > coordinateAxis.getMaximumValue()) {
return coordinateAxis.getMaximumValue();
}
}
return val;
}
示例2: adjustCoordinateDimensionToRange
import org.opengis.referencing.crs.CoordinateReferenceSystem; //导入方法依赖的package包/类
/**
* This is perhaps a brain dead approach to do this, but it does handle wrap
* around cases. Also supports cases where the wrap around occurs many
* times.
*
* @param val
* the value
* @param crs
* @param axis
* the coordinate axis
* @return
*/
public static double adjustCoordinateDimensionToRange(
final double val,
final CoordinateReferenceSystem crs,
final int axis ) {
final CoordinateSystem coordinateSystem = crs.getCoordinateSystem();
if (coordinateSystem.getDimension() > axis) {
final double lowerBound = coordinateSystem.getAxis(
axis).getMinimumValue();
final double bound = coordinateSystem.getAxis(
axis).getMaximumValue() - lowerBound;
final double sign = sign(val);
// re-scale to 0 to n, then determine how many times to 'loop
// around'
final double mult = Math.floor(Math.abs((val + (sign * (-1.0 * lowerBound))) / bound));
return val + (mult * bound * sign * (-1.0));
}
return val;
}
示例3: updatePixelUnit
import org.opengis.referencing.crs.CoordinateReferenceSystem; //导入方法依赖的package包/类
public void updatePixelUnit(CoordinateReferenceSystem crs) {
final CoordinateSystem coordinateSystem = crs.getCoordinateSystem();
final String unitX = coordinateSystem.getAxis(0).getUnit().toString();
if (!unitX.equals(pixelXUnit.getText())) {
pixelXUnit.setText(unitX);
pixelSizeXField.setValue(unitMap.get(unitX));
}
final String unitY = coordinateSystem.getAxis(1).getUnit().toString();
if (!unitY.equals(pixelYUnit.getText())) {
pixelYUnit.setText(unitY);
pixelSizeYField.setValue(unitMap.get(unitY));
}
}
示例4: getAxis
import org.opengis.referencing.crs.CoordinateReferenceSystem; //导入方法依赖的package包/类
public static String getAxis(
final CoordinateReferenceSystem crs ) {
// Some geometries do not have a CRS provided. Thus we default to
// urn:ogc:def:crs:EPSG::4326
final CoordinateSystem cs = crs == null ? null : crs.getCoordinateSystem();
if ((cs != null) && (cs.getDimension() > 0)) {
return cs.getAxis(
0).getDirection().name().toString();
}
return "EAST";
}
示例5: indexOf
import org.opengis.referencing.crs.CoordinateReferenceSystem; //导入方法依赖的package包/类
private static int indexOf(
final CoordinateReferenceSystem crs,
final Set<AxisDirection> direction ) {
final CoordinateSystem cs = crs.getCoordinateSystem();
for (int index = 0; index < cs.getDimension(); index++) {
final CoordinateSystemAxis axis = cs.getAxis(index);
if (direction.contains(axis.getDirection())) {
return index;
}
}
return -1;
}
示例6: RegularGridImpl
import org.opengis.referencing.crs.CoordinateReferenceSystem; //导入方法依赖的package包/类
/**
* Constructs a RegularGrid from the given bounding box, with the given
* width and height. Note that the bounding box represents the edges of the
* grid, whereas grid coordinates represent the centre of the grid points.
*
* @param minx
* the minimum x value of the bounding box
* @param miny
* the minimum y value of the bounding box
* @param maxx
* the maximum x value of the bounding box
* @param maxy
* the maximum y value of the bounding box
* @param crs
* the {@link CoordinateReferenceSystem}
* @param width
* the number of grid points in the x-direction
* @param height
* the number of grid points in the y-direction
*/
public RegularGridImpl(double minx, double miny, double maxx, double maxy,
CoordinateReferenceSystem crs, int width, int height) {
super(crs);
if (maxx < minx || maxy < miny) {
throw new IllegalArgumentException("Invalid bounding box");
}
this.crs = crs;
double xSpacing = (maxx - minx) / width;
double ySpacing = (maxy - miny) / height;
// The axis values represent the centres of the grid points
double firstXAxisValue = minx + (0.5 * xSpacing);
double firstYAxisValue = miny + (0.5 * ySpacing);
if (crs == null) {
/*
* If we don't have a crs, we can't tell if an axis is longitude
*/
xAxis = new RegularAxisImpl("Unknown X axis", firstXAxisValue, xSpacing, width, false);
yAxis = new RegularAxisImpl("Unknown Y axis", firstYAxisValue, ySpacing, height, false);
} else {
/*
* If we do have a crs, we can use rangeMeaning==WRAPAROUND to
* determine whether the axis is longitude
*
* TODO There may be wrapped axes where this is inappropriate.
* Perhaps change isLongitude to wraps in RegularAxisImpl, and set a
* wrap value?
*/
CoordinateSystem cs = crs.getCoordinateSystem();
xAxis = new RegularAxisImpl(cs.getAxis(0).getName().toString(), firstXAxisValue,
xSpacing, width, (cs.getAxis(0).getRangeMeaning() == RangeMeaning.WRAPAROUND));
/*
* y axis is very unlikely to be longitude
*/
yAxis = new RegularAxisImpl(cs.getAxis(1).getName().toString(), firstYAxisValue,
ySpacing, height, (cs.getAxis(1).getRangeMeaning() == RangeMeaning.WRAPAROUND));
}
}
示例7: internalCreatePrimaryIndex
import org.opengis.referencing.crs.CoordinateReferenceSystem; //导入方法依赖的package包/类
private static PrimaryIndex internalCreatePrimaryIndex(
final SpatialTemporalOptions options ) {
NumericDimensionDefinition[] dimensions;
NumericDimensionField<?>[] fields = null;
CoordinateReferenceSystem crs = null;
boolean isDefaultCRS;
String crsCode = null;
if (options.crs == null || options.crs.isEmpty() || options.crs.equalsIgnoreCase(GeometryUtils.DEFAULT_CRS_STR)) {
dimensions = SPATIAL_TEMPORAL_DIMENSIONS;
fields = SPATIAL_TEMPORAL_FIELDS;
isDefaultCRS = true;
crsCode = "EPSG:4326";
}
else {
crs = decodeCRS(options.crs);
CoordinateSystem cs = crs.getCoordinateSystem();
isDefaultCRS = false;
crsCode = options.crs;
dimensions = new NumericDimensionDefinition[cs.getDimension() + 1];
fields = new NumericDimensionField[dimensions.length];
for (int d = 0; d < dimensions.length - 1; d++) {
CoordinateSystemAxis csa = cs.getAxis(d);
dimensions[d] = new CustomCRSSpatialDimension(
(byte) d,
csa.getMinimumValue(),
csa.getMaximumValue());
fields[d] = new CustomCRSSpatialField(
(CustomCRSSpatialDimension) dimensions[d]);
}
dimensions[dimensions.length - 1] = new TimeDefinition(
options.periodicity);
fields[dimensions.length - 1] = new TimeField(
options.periodicity);
}
BasicIndexModel indexModel = null;
if (isDefaultCRS) {
indexModel = new BasicIndexModel(
fields);
}
else {
indexModel = new CustomCrsIndexModel(
fields,
crsCode);
}
String combinedArrayID;
if (isDefaultCRS) {
combinedArrayID = DEFAULT_SPATIAL_TEMPORAL_ID_STR + "_" + options.bias + "_" + options.periodicity;
}
else {
combinedArrayID = DEFAULT_SPATIAL_TEMPORAL_ID_STR + "_" + (crsCode.substring(crsCode.indexOf(":") + 1))
+ "_" + options.bias + "_" + options.periodicity;
}
final String combinedId = combinedArrayID;
return new CustomIdIndex(
XZHierarchicalIndexFactory.createFullIncrementalTieredStrategy(
dimensions,
new int[] {
options.bias.getSpatialPrecision(),
options.bias.getSpatialPrecision(),
options.bias.getTemporalPrecision()
},
SFCType.HILBERT,
options.maxDuplicates),
indexModel,
new ByteArrayId(
combinedId));
}