本文整理汇总了Java中org.opengis.referencing.crs.GeographicCRS类的典型用法代码示例。如果您正苦于以下问题:Java GeographicCRS类的具体用法?Java GeographicCRS怎么用?Java GeographicCRS使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GeographicCRS类属于org.opengis.referencing.crs包,在下文中一共展示了GeographicCRS类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getCRS
import org.opengis.referencing.crs.GeographicCRS; //导入依赖的package包/类
@Override
public CoordinateReferenceSystem getCRS(final GeoPos referencePos, ParameterValueGroup parameters,
GeodeticDatum datum) throws FactoryException {
final CRSFactory crsFactory = ReferencingFactoryFinder.getCRSFactory(null);
// in some cases, depending on the parameters set, the effective transformation can be different
// from the transformation given by the OperationMethod.
// So we create a new one
final MathTransformFactory mtFactory = ReferencingFactoryFinder.getMathTransformFactory(null);
final MathTransform transform = mtFactory.createParameterizedTransform(parameters);
final DefaultOperationMethod operationMethod = new DefaultOperationMethod(transform);
final Conversion conversion = new DefiningConversion(AbstractIdentifiedObject.getProperties(operationMethod),
operationMethod, transform);
final HashMap<String, Object> baseCrsProperties = new HashMap<String, Object>();
baseCrsProperties.put("name", datum.getName().getCode());
GeographicCRS baseCrs = crsFactory.createGeographicCRS(baseCrsProperties,
datum,
DefaultEllipsoidalCS.GEODETIC_2D);
final HashMap<String, Object> projProperties = new HashMap<String, Object>();
projProperties.put("name", conversion.getName().getCode() + " / " + datum.getName().getCode());
return crsFactory.createProjectedCRS(projProperties, baseCrs, conversion, DefaultCartesianCS.PROJECTED);
}
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:25,代码来源:OperationMethodCrsProvider.java
示例2: createCrs
import org.opengis.referencing.crs.GeographicCRS; //导入依赖的package包/类
CoordinateReferenceSystem createCrs(String crsName, OperationMethod method,
ParameterValueGroup parameters,
GeodeticDatum datum) throws FactoryException {
final CRSFactory crsFactory = ReferencingFactoryFinder.getCRSFactory(null);
final CoordinateOperationFactory coFactory = ReferencingFactoryFinder.getCoordinateOperationFactory(null);
final HashMap<String, Object> projProperties = new HashMap<String, Object>();
projProperties.put("name", crsName + " / " + datum.getName().getCode());
final Conversion conversion = coFactory.createDefiningConversion(projProperties,
method,
parameters);
final HashMap<String, Object> baseCrsProperties = new HashMap<String, Object>();
baseCrsProperties.put("name", datum.getName().getCode());
final GeographicCRS baseCrs = crsFactory.createGeographicCRS(baseCrsProperties, datum,
DefaultEllipsoidalCS.GEODETIC_2D);
return crsFactory.createProjectedCRS(projProperties, baseCrs, conversion, DefaultCartesianCS.PROJECTED);
}
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:17,代码来源:AbstractUTMCrsProvider.java
示例3: execute
import org.opengis.referencing.crs.GeographicCRS; //导入依赖的package包/类
@Override
public void execute(WfsGetFeatureRequest request, WfsGetFeatureResponse response) throws Exception {
FeatureCollection<SimpleFeatureType, SimpleFeature> features = performWfsQuery(request);
int maxCoordinates = request.getMaxCoordsPerFeature();
double distance = 10;
// Note: features.getSchema() can be null when no features have been found
if (null != features.getSchema()
&& features.getSchema().getCoordinateReferenceSystem() instanceof GeographicCRS) {
distance = 0.0001;
}
WfsFeatureCollectionDto featureCollectionDto = new WfsFeatureCollectionDto();
featureCollectionDto.setBaseUrl(request.getBaseUrl());
featureCollectionDto.setTypeName(request.getTypeName());
List<Feature> dtoFeatures = convertFeatures(features, maxCoordinates, distance);
featureCollectionDto.setFeatures(dtoFeatures);
featureCollectionDto.setBoundingBox(getTotalBounds(dtoFeatures));
response.setFeatureCollection(featureCollectionDto);
log.info("Found " + response.getFeatureCollection().size() + " features for layer " + request.getTypeName());
}
开发者ID:geomajas,项目名称:geomajas-project-client-gwt2,代码行数:20,代码来源:WfsGetFeatureCommand.java
示例4: getCrs
import org.opengis.referencing.crs.GeographicCRS; //导入依赖的package包/类
public static Crs getCrs(String id, CoordinateReferenceSystem base) {
if (base instanceof CompoundCRS) {
return new CompoundCrsImpl(id, (CompoundCRS) base);
}
if (base instanceof GeographicCRS) {
return new GeographicCrsImpl(id, (GeographicCRS) base);
}
if (base instanceof GeodeticCRS) {
return new GeodeticCrsImpl(id, (GeodeticCRS) base);
}
if (base instanceof ProjectedCRS) {
return new ProjectedCrsImpl(id, (ProjectedCRS) base);
}
if (base instanceof GeneralDerivedCRS) {
return new GeneralDerivedCrsImpl(id, (GeneralDerivedCRS) base);
}
if (base instanceof TemporalCRS) {
return new TemporalCrsImpl(id, (TemporalCRS) base);
}
if (base instanceof SingleCRS) {
return new SingleCrsImpl(id, (SingleCRS) base);
}
return new CrsImpl(id, base);
}
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:25,代码来源:CrsFactory.java
示例5: premadeObjects
import org.opengis.referencing.crs.GeographicCRS; //导入依赖的package包/类
/**
* A method with some examples of premade static objects.
*/
void premadeObjects() {
// premadeObjects start
GeographicCRS geoCRS = org.geotools.referencing.crs.DefaultGeographicCRS.WGS84;
GeodeticDatum wgs84Datum = org.geotools.referencing.datum.DefaultGeodeticDatum.WGS84;
PrimeMeridian greenwichMeridian = org.geotools.referencing.datum.DefaultPrimeMeridian.GREENWICH;
CartesianCS cartCS = org.geotools.referencing.cs.DefaultCartesianCS.GENERIC_2D;
CoordinateSystemAxis latAxis = org.geotools.referencing.cs.DefaultCoordinateSystemAxis.GEODETIC_LATITUDE;
// premadeObjects end
}
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:13,代码来源:ReferencingExamples.java
示例6: createCRSByHand1
import org.opengis.referencing.crs.GeographicCRS; //导入依赖的package包/类
/**
* Creates a WGS 84/UTM Zone 10N CRS mostly (uses some premade objects) by hand. Uses the higher
* level FactoryGroup instead of the lower level MathTransformFactory (commented out).
*
* @throws Exception
*/
void createCRSByHand1() throws Exception {
System.out.println("------------------------------------------");
System.out.println("Creating a CRS by hand:");
// createCRSByHand1 start
MathTransformFactory mtFactory = ReferencingFactoryFinder.getMathTransformFactory(null);
CRSFactory crsFactory = ReferencingFactoryFinder.getCRSFactory(null);
GeographicCRS geoCRS = org.geotools.referencing.crs.DefaultGeographicCRS.WGS84;
CartesianCS cartCS = org.geotools.referencing.cs.DefaultCartesianCS.GENERIC_2D;
ParameterValueGroup parameters = mtFactory.getDefaultParameters("Transverse_Mercator");
parameters.parameter("central_meridian").setValue(-111.0);
parameters.parameter("latitude_of_origin").setValue(0.0);
parameters.parameter("scale_factor").setValue(0.9996);
parameters.parameter("false_easting").setValue(500000.0);
parameters.parameter("false_northing").setValue(0.0);
Conversion conversion = new DefiningConversion("Transverse_Mercator", parameters);
Map<String, ?> properties = Collections.singletonMap("name", "WGS 84 / UTM Zone 12N");
ProjectedCRS projCRS = crsFactory.createProjectedCRS(properties, geoCRS, conversion, cartCS);
// createCRSByHand1 end
// parameters.parameter("semi_major").setValue(((GeodeticDatum)geoCRS.getDatum()).getEllipsoid().getSemiMajorAxis());
// parameters.parameter("semi_minor").setValue(((GeodeticDatum)geoCRS.getDatum()).getEllipsoid().getSemiMinorAxis());
// MathTransform trans = mtFactory.createParameterizedTransform(parameters);
// ProjectedCRS projCRS = crsFactory.createProjectedCRS(
// Collections.singletonMap("name", "WGS 84 / UTM Zone 12N"),
// new org.geotools.referencing.operation.OperationMethod(trans),
// geoCRS, trans, cartCS);
System.out.println(" Projected CRS: " + projCRS.toWKT());
System.out.println("------------------------------------------");
// save for later use in createMathTransformBetweenCRSs()
this.utm10NCRS = projCRS;
}
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:43,代码来源:ReferencingExamples.java
示例7: writeHorizontalCrs
import org.opengis.referencing.crs.GeographicCRS; //导入依赖的package包/类
private static void writeHorizontalCrs(MapEncoder<?> map, CoordinateReferenceSystem crs) throws IOException {
String crsType;
if (crs instanceof GeographicCRS) {
crsType = Vals.GEOGRAPHICCRS;
} else if (crs instanceof GeocentricCRS) {
crsType = Vals.GEOCENTRICCRS;
} else if (crs instanceof GeodeticCRS) {
crsType = Vals.GEODETICCRS;
} else if (crs instanceof ProjectedCRS) {
crsType = Vals.PROJECTEDCRS;
} else {
throw new RuntimeException("Unsupported CRS type: " + crs.getClass().getSimpleName());
}
map.put(Keys.TYPE, crsType);
if (crs instanceof DerivedCRS) {
CoordinateReferenceSystem baseCrs = ((DerivedCRS) crs).getBaseCRS();
MapEncoder<?> baseMap = map.startMap(Keys.BASECRS);
writeHorizontalCrs(baseMap, baseCrs);
baseMap.end();
}
String crsUri = Vals.getCrsUri(crs);
if (crsUri != null) {
map.put(Keys.ID, crsUri);
}
}
开发者ID:Reading-eScience-Centre,项目名称:edal-java,代码行数:28,代码来源:DomainWriter.java
示例8: BoundingBoxImpl
import org.opengis.referencing.crs.GeographicCRS; //导入依赖的package包/类
/**
* Creates a {@link BoundingBox} from a {@link CoordinateReferenceSystem},
* where the bounds are the limits of validity of the CRS
*
* @param crs
*/
public BoundingBoxImpl(CoordinateReferenceSystem crs) {
//
// TODO: replace the code below by the following block after Apache SIS 0.8 release:
//
// Envelope envelope = CRS.getDomainOfValidity(crs);
//
Envelope envelope = null;
final GeographicBoundingBox bbox = CRS.getGeographicBoundingBox(crs);
if (bbox != null && !Boolean.FALSE.equals(bbox.getInclusion())) {
final SingleCRS targetCRS = CRS.getHorizontalComponent(crs);
GeographicCRS sourceCRS = ReferencingUtilities.toNormalizedGeographicCRS(targetCRS);
if (sourceCRS != null) {
GeneralEnvelope bounds = new GeneralEnvelope(bbox);
bounds.translate(-CRS.getGreenwichLongitude(sourceCRS), 0);
bounds.setCoordinateReferenceSystem(sourceCRS);
try {
envelope = Envelopes.transform(bounds, targetCRS);
} catch (TransformException e) {
throw new IllegalArgumentException(e);
}
}
}
// End of TODO block
if (envelope == null) {
throw new IllegalArgumentException(
"The given CRS does not specify a domain of validity.");
}
this.minx = envelope.getMinimum(0);
this.maxx = envelope.getMaximum(0);
this.miny = envelope.getMinimum(1);
this.maxy = envelope.getMaximum(1);
this.crs = crs;
}
开发者ID:Reading-eScience-Centre,项目名称:edal-java,代码行数:40,代码来源:BoundingBoxImpl.java
示例9: setCRS
import org.opengis.referencing.crs.GeographicCRS; //导入依赖的package包/类
private void setCRS(VectorLayerInfo info, CoordinateReferenceSystem crs) {
if (crs instanceof GeographicCRS) {
// spherical coordinate system, this is not a projection but probably should be plate carree !
if ("GCS_WGS_1984".equals(crs.getName().getCode())) {
info.setCrs("EPSG:4326");
} else {
throw new IllegalArgumentException("Unknown geographic CRS " + crs + ", expected "
+ DefaultGeographicCRS.WGS84);
}
} else {
info.setCrs("EPSG:" + geoService.getSridFromCrs(crs));
}
}
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:14,代码来源:GeoToolsLayerBeanFactory.java
示例10: IDWElevationInterpolator
import org.opengis.referencing.crs.GeographicCRS; //导入依赖的package包/类
public IDWElevationInterpolator(Geometry geom,
CoordinateReferenceSystem crs) {
this.elevations = gatherElevationPointCloud(geom);
this.scale = crs instanceof GeographicCRS ? 9 : 6;
this.crs = crs;
}
开发者ID:ec-europa,项目名称:sumo,代码行数:7,代码来源:ClipProcess.java
示例11: isSame
import org.opengis.referencing.crs.GeographicCRS; //导入依赖的package包/类
public boolean isSame(double x, double y, CoordinateReferenceSystem crs) {
double tolerance = crs instanceof GeographicCRS ? EPS_DEGREES : EPS_METERS;
return Math.abs(c.x - x) < tolerance && Math.abs(c.x - y) < tolerance;
}
开发者ID:ec-europa,项目名称:sumo,代码行数:5,代码来源:ClipProcess.java
示例12: createCRSByHand2
import org.opengis.referencing.crs.GeographicCRS; //导入依赖的package包/类
/**
* Creates a NAD 27 geographic CRS. Notice that the datum factory automatically adds aliase names to
* the datum (because "North American Datum 1927" has an entry in http://svn.geotools.org
* /geotools/trunk/gt/module/referencing/src/org/geotools/referencing/factory /DatumAliasesTable.txt
* ). Also notice that toWGS84 information (used in a datum transform) was also added to the datum.
*/
void createCRSByHand2() throws Exception {
System.out.println("------------------------------------------");
System.out.println("Creating a CRS by hand:");
// createCRSByHand2 start
CRSFactory crsFactory = ReferencingFactoryFinder.getCRSFactory(null);
DatumFactory datumFactory = ReferencingFactoryFinder.getDatumFactory(null);
CSFactory csFactory = ReferencingFactoryFinder.getCSFactory(null);
Map<String, Object> map = new HashMap<String, Object>();
map.put("name", "Clarke 1866");
Ellipsoid clark1866ellipse = datumFactory.createFlattenedSphere(map, 6378206.4,
294.978698213901, SI.METER);
PrimeMeridian greenwichMeridian = org.geotools.referencing.datum.DefaultPrimeMeridian.GREENWICH;
final BursaWolfParameters toWGS84 = new BursaWolfParameters(DefaultGeodeticDatum.WGS84);
toWGS84.dx = -3.0;
toWGS84.dy = 142;
toWGS84.dz = 183;
map.clear();
map.put("name", "North American Datum 1927");
map.put(DefaultGeodeticDatum.BURSA_WOLF_KEY, toWGS84);
GeodeticDatum clark1866datum = datumFactory.createGeodeticDatum(map, clark1866ellipse,
greenwichMeridian);
System.out.println(clark1866datum.toWKT());
// notice all of the lovely datum aliases (used to determine if two
// datums are the same)
System.out.println("Identified Datum object:");
printIdentifierStuff(clark1866datum);
map.clear();
map.put("name", "<lat>, <long>");
CoordinateSystemAxis latAxis = org.geotools.referencing.cs.DefaultCoordinateSystemAxis.GEODETIC_LATITUDE;
CoordinateSystemAxis longAxis = org.geotools.referencing.cs.DefaultCoordinateSystemAxis.GEODETIC_LONGITUDE;
EllipsoidalCS ellipsCS = csFactory.createEllipsoidalCS(map, latAxis, longAxis);
map.clear();
map.put("name", "NAD 27");
map.put("authority", "9999");
// TODO add an authority code here (should be an identifier)
GeographicCRS nad27CRS = crsFactory.createGeographicCRS(map, clark1866datum, ellipsCS);
// createCRSByHand2 end
System.out.println(nad27CRS.toWKT());
System.out.println("Identified CRS object:");
printIdentifierStuff(nad27CRS);
System.out.println("------------------------------------------");
// save for latter use in createMathTransformBetweenCRSs()
this.nad27CRS = nad27CRS;
}
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:61,代码来源:ReferencingExamples.java
示例13: GeographicCrsImpl
import org.opengis.referencing.crs.GeographicCRS; //导入依赖的package包/类
public GeographicCrsImpl(String id, GeographicCRS base) {
this.id = id;
this.base = base;
}
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:5,代码来源:GeographicCrsImpl.java
示例14: getBaseCRS
import org.opengis.referencing.crs.GeographicCRS; //导入依赖的package包/类
public GeographicCRS getBaseCRS() {
return base.getBaseCRS();
}
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:4,代码来源:ProjectedCrsImpl.java
注:本文中的org.opengis.referencing.crs.GeographicCRS类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论