本文整理汇总了Java中org.geotools.referencing.ReferencingFactoryFinder.getCRSAuthorityFactory方法的典型用法代码示例。如果您正苦于以下问题:Java ReferencingFactoryFinder.getCRSAuthorityFactory方法的具体用法?Java ReferencingFactoryFinder.getCRSAuthorityFactory怎么用?Java ReferencingFactoryFinder.getCRSAuthorityFactory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.geotools.referencing.ReferencingFactoryFinder
的用法示例。
在下文中一共展示了ReferencingFactoryFinder.getCRSAuthorityFactory方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createFeatureType
import org.geotools.referencing.ReferencingFactoryFinder; //导入方法依赖的package包/类
/**
* Create the schema for your FeatureType cq shapefile
*/
private static SimpleFeatureType createFeatureType() {
SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder();
builder.setName("GeometryError");
try {
CRSAuthorityFactory authorityFactory = ReferencingFactoryFinder.getCRSAuthorityFactory("epsg", null);
builder.setCRS(authorityFactory.createCoordinateReferenceSystem("28992")); // <- Coordinate reference system
} catch(Exception e) {
throw new RuntimeException(e);
}
// add attributes
builder.add("Location", Point.class);
builder.add("InspireId", String.class);
builder.add("Message", String.class);
return builder.buildFeatureType();
}
示例2: getAllSRSCodes
import org.geotools.referencing.ReferencingFactoryFinder; //导入方法依赖的package包/类
/**
* @return A plain array with all EPSG-codes.
*/
public static String[] getAllSRSCodes() {
CRSAuthorityFactory factory = ReferencingFactoryFinder.getCRSAuthorityFactory(SRS.AUTH_EPSG, null);
try {
Set<String> srids = factory.getAuthorityCodes(CoordinateReferenceSystem.class);
String[] epsg_codes = new String[srids.size()];
return srids.toArray(epsg_codes);
} catch (FactoryException e) {
return null;
}
}
示例3: createComboSelectionSRS
import org.geotools.referencing.ReferencingFactoryFinder; //导入方法依赖的package包/类
/**
* Creates the SRS from the selected SRID
*
* @param srid The srid from the selected Entry in Combo
*/
private void createComboSelectionSRS(String srid) {
String authority_epsg = Citations.getIdentifier(Citations.EPSG);
CRSAuthorityFactory factory = ReferencingFactoryFinder.getCRSAuthorityFactory(authority_epsg, null);
try {
if(srid == ""){
selectedSRS = SRS.UNKNOWN;
}else{
selectedSRS = new SRS(authority_epsg, srid, factory.getDescriptionText(srid).toString());
}
} catch (Exception ex) {
selectedSRS = new SRS("GeoKettle", srid, "Custom");
}
}
示例4: getProperties
import org.geotools.referencing.ReferencingFactoryFinder; //导入方法依赖的package包/类
/**
* Fills a {@link SRSInit} object with the correct initialization values
* needed by constructors (authority, description, srid).
*
* Note: The method tries to retrieve as much information from the
* {@link CoordinateReferenceSystem} <code>crs</code> as possible.
*
* @param init Pass the {@link SRSInit} object to allow multiple return-values.
* @param crs The {@link CoordinateReferenceSystem} where the information
* are retrieved from.
*/
private void getProperties(SRSInit init, CoordinateReferenceSystem crs) {
// Try to find srid, authority and description from the CRS.
// Abort if the correct EPSG identifiers were found.
Set<ReferenceIdentifier> identifiers = crs.getIdentifiers();
if (!identifiers.isEmpty()) {
for (ReferenceIdentifier id : identifiers) {
init.auth = Citations.getIdentifier(id.getAuthority());
init.srid = id.getCode();
try {
CRSAuthorityFactory factory = ReferencingFactoryFinder.getCRSAuthorityFactory(init.auth, HINTS);
init.desc = factory.getDescriptionText(init.srid).toString();
this.is_custom = false;
break;
} catch (Exception e) {
this.is_custom = true;
}
}
} else
this.is_custom = true;
// If this is not an EPSG spatial reference system, use WKT to describe it but get
// as much information as possible about the SRS from the WKT.
if (this.is_custom) {
init.srid = Const.NVL(init.srid, Integer.toString(UNKNOWN_SRID));
init.auth = Const.NVL(init.auth, "Custom Authority");
init.desc = Const.NVL(init.desc, "Custom SRS from WKT");
}
}
示例5: GridTransforms
import org.geotools.referencing.ReferencingFactoryFinder; //导入方法依赖的package包/类
public GridTransforms(String espgCode) {
Spatial.initSpatial();
try {
crsFac = ReferencingFactoryFinder.getCRSAuthorityFactory("EPSG", null);
wgs84crs = crsFac.createCoordinateReferenceSystem("4326");
gridcrs = crsFac.createCoordinateReferenceSystem(espgCode);
latLongToGrid = new DefaultCoordinateOperationFactory().createOperation(wgs84crs, gridcrs);
gridToLongLat = new DefaultCoordinateOperationFactory().createOperation(gridcrs, wgs84crs);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例6: initSpatial
import org.geotools.referencing.ReferencingFactoryFinder; //导入方法依赖的package包/类
public static synchronized void initSpatial(){
if(!init){
// ensure geotools uses longitude, latitude order, not latitude, longitude, in the entire application
System.setProperty("org.geotools.referencing.forceXY", "true");
crsFac = ReferencingFactoryFinder.getCRSAuthorityFactory("EPSG", null);
try {
wgs84crs = crsFac.createCoordinateReferenceSystem("4326");
} catch (Throwable e) {
throw new RuntimeException(e);
}
}
}
示例7: transfGeom
import org.geotools.referencing.ReferencingFactoryFinder; //导入方法依赖的package包/类
/**
* Returns a geometry based on the transformation from a source geometry CRS
* to a defined target CRS.
*
*/
private Geometry transfGeom(Geometry g, CoordinateReferenceSystem outputCRS) throws TransformException, NoSuchAuthorityCodeException, FactoryException {
Hints hints = new Hints(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE);
CRSAuthorityFactory factory = ReferencingFactoryFinder.getCRSAuthorityFactory("EPSG", hints);
CoordinateReferenceSystem srcCRS = factory.createCoordinateReferenceSystem("EPSG:4326");
outputCRS = factory.createCoordinateReferenceSystem("EPSG:900913");
MathTransform transform;
transform = CRS.findMathTransform(srcCRS, outputCRS, false);
Geometry trgGeom = JTS.transform(g, transform);
return trgGeom;
}
示例8: GeospatialDatasetImpl
import org.geotools.referencing.ReferencingFactoryFinder; //导入方法依赖的package包/类
/**
* Construct a GeospatialDatasetImpl object.
* <p>
* The constructor for this class was given a friendly access to hide how it
* is implemented and to force users to only use the DataSourceFactory to get
* instances of the GeospatialDataset implementations.
* </p>
*
* @param featureSource
*/
GeospatialDatasetImpl(final DataSource dataSource,
final SimpleFeatureSource featureSource) {
this.dataSource = dataSource;
this.featureSource = featureSource;
final Hints hints = new Hints(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER,
Boolean.TRUE);
crsFactory = ReferencingFactoryFinder.getCRSAuthorityFactory("EPSG", hints);
}