Java Code Examples for org.opengis.referencing.FactoryException#printStackTrace()

The following examples show how to use org.opengis.referencing.FactoryException#printStackTrace() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DBScanIT.java    From geowave with Apache License 2.0 6 votes vote down vote up
private SimpleFeatureBuilder getBuilder() {
  final SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder();
  typeBuilder.setName("test");
  typeBuilder.setSRS(ClusteringUtils.CLUSTERING_CRS);
  try {
    typeBuilder.setCRS(CRS.decode(ClusteringUtils.CLUSTERING_CRS, true));
  } catch (final FactoryException e) {
    e.printStackTrace();
    return null;
  }
  // add attributes in order
  typeBuilder.add("geom", Point.class);
  typeBuilder.add("name", String.class);
  typeBuilder.add("count", Long.class);

  // build the type
  return new SimpleFeatureBuilder(typeBuilder.buildFeatureType());
}
 
Example 2
Source File: KMLConnection.java    From GeoTriples with Apache License 2.0 5 votes vote down vote up
@Override
public String getCRS() {
	try {
		return org.geotools.gml2.bindings.GML2EncodingUtils
				.epsgCode(CRS.decode("4326"));
	} catch (FactoryException e) {
		System.out.println("Error getting CRS for KML which is trivially 4326 , KMLConnection");
		e.printStackTrace();
	}
	return "";
}
 
Example 3
Source File: Projection.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
MathTransform computeProjection(final IScope scope) {
	MathTransform crsTransformation = null;
	if (initialCRS == null) { return null; }
	try {
		crsTransformation = CRS.findMathTransform(initialCRS, getTargetCRS(scope), true);
	} catch (final FactoryException e) {
		e.printStackTrace();
		return null;
	}
	return crsTransformation;
}
 
Example 4
Source File: MosaicDialog.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
private boolean verifyTargetCrs(MosaicFormModel formModel) {
    try {
        final CoordinateReferenceSystem crs = formModel.getTargetCRS();
        if (crs == null) {
            showErrorDialog("No 'Coordinate Reference System' selected.");
            return false;
        }
    } catch (FactoryException e) {
        e.printStackTrace();
        showErrorDialog("No 'Coordinate Reference System' selected.\n" + e.getMessage());
        return false;
    }
    return true;
}
 
Example 5
Source File: ShapefileAssistantPage2.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
@Override
public AbstractLayerSourceAssistantPage getNextPage() {
    final LayerSourcePageContext context = getContext();
    try {
        final Product product = SnapApp.getDefault().getSelectedProduct(VIEW);
        final GeoPos referencePos = ProductUtils.getCenterGeoPos(product);
        final CoordinateReferenceSystem crs = crsSelectionPanel.getCrs(referencePos);
        context.setPropertyValue(ShapefileLayerSource.PROPERTY_NAME_FEATURE_COLLECTION_CRS, crs);
        return new ShapefileAssistantPage3();
    } catch (FactoryException e) {
        e.printStackTrace();
        context.showErrorDialog("Could not create CRS:\n" + e.getMessage());
    }
    return null;
}