public void setBoundsStr(String boundsStr) { if (boundsStr == null) { setBounds(null); } else { Matcher matcherEnvelope = patternEnvelope.matcher(boundsStr); if (!matcherEnvelope.matches()) { throw new IllegalArgumentException( "Envelope not in correct format: minx,miny,maxx,maxy"); } double minx = Double.parseDouble(matcherEnvelope.group(1)); double miny = Double.parseDouble(matcherEnvelope.group(2)); double maxx = Double.parseDouble(matcherEnvelope.group(3)); double maxy = Double.parseDouble(matcherEnvelope.group(4)); try { setBounds( new ReferencedEnvelope( minx, maxx, miny, maxy, CRS.decode("EPSG:4326", true))); } catch (FactoryException e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); } } }
} catch (FactoryException e) { throw new RuntimeException( "Unable to decode SRS name. Cause: " + e.getMessage()); } catch (FactoryException e) { throw new RuntimeException( "Unable to decode SRS name. Cause: " + e.getMessage());
+ e.getMessage()); } catch (FactoryException e) { throw new RuntimeException("Unable to decode SRS name. Cause: " + e.getMessage());
+ e.getMessage()); } catch (FactoryException e) { throw new RuntimeException("Unable to decode SRS name. Cause: " + e.getMessage());
LOGGER.log(Level.FINER, e.getMessage(), e);
public void actionPerformed(ActionEvent e) { String code = JOptionPane.showInputDialog( button, "Coordinate Reference System:", "EPSG:4326" ); try{ CoordinateReferenceSystem crs = CRS.decode( code ); setCRS( crs ); } catch(FactoryException fe){ JOptionPane.showMessageDialog( button, fe.getMessage(), fe.getClass().toString(), JOptionPane.ERROR_MESSAGE ); return; } } });
public String getDescription() { try { return getCrs(null).toString(); } catch (FactoryException e) { return e.getMessage(); } }
public String getDescription() { try { return getCrs(null).toString(); } catch (FactoryException e) { return e.getMessage(); } }
public CoordinateReferenceSystem getCRS() { try { return CRS.decode(featureSetDescription.getSRS()); } catch (NoSuchAuthorityCodeException e) { LOGGER.log(Level.INFO, e.getMessage(), e); } catch (FactoryException e) { LOGGER.log(Level.INFO, e.getMessage(), e); } return null; }
crs = CRS.decode("EPSG:31276"); } catch (FactoryException e1) { fail(e1.getMessage());
public CoordinateReferenceSystem getFeatureCrs() { CoordinateReferenceSystem crs = null; try { crs = crsSelectionPanel.getCrs(ProductUtils.getCenterGeoPos(product)); } catch (FactoryException e) { visatApp.showErrorDialog(title, "Can not create Coordinate Reference System.\n" + e.getMessage()); } return crs; }
public CoordinateReferenceSystem getFeatureCrs() { CoordinateReferenceSystem crs = null; try { crs = crsSelectionPanel.getCrs(ProductUtils.getCenterGeoPos(product)); } catch (FactoryException e) { Dialogs.showError(title, "Cannot create coordinate reference system.\n" + e.getMessage()); } return crs; }
private WFSResponse executeGetFeatures(final Query query, final Transaction transaction, final ResultType resultType) throws IOException { final String outputFormat = this.outputFormat == null ? wfs .getDefaultOutputFormat(GET_FEATURE) : this.outputFormat; String srsName = adaptQueryForSupportedCrs(query); try { invertAxisInFilterIfNeeded(query, CRS.decode(srsName)); } catch (NoSuchAuthorityCodeException e) { LOGGER.log(Level.FINER, e.getMessage(), e); } catch (FactoryException e) { LOGGER.log(Level.FINER, e.getMessage(), e); } GetFeature request = new GetFeatureQueryAdapter(query, outputFormat, srsName, resultType); final WFSResponse response = sendGetFeatures(request); return response; }
private void setMapGeoCoding(Product product) { try { GeoCoding geoCoding = new CrsGeoCoding(DefaultGeographicCRS.WGS84, new Rectangle(0, 0, SIZE, SIZE), new AffineTransform(I2M)); product.setGeoCoding(geoCoding); } catch (FactoryException e) { fail(e.getMessage()); } catch (TransformException e) { fail(e.getMessage()); } }
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; }
private boolean verifyTargetCrs(S2tbxMosaicFormModel 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; }
private boolean verfiyTargetCrs(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; }
public static SimpleFeatureType schemaToFeatureType(StructType schema, String typeName) { final SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder(); typeBuilder.setName(typeName); typeBuilder.setNamespaceURI(BasicFeatureTypes.DEFAULT_NAMESPACE); try { typeBuilder.setCRS(CRS.decode("EPSG:4326", true)); } catch (final FactoryException e) { LOGGER.error(e.getMessage(), e); } final AttributeTypeBuilder attrBuilder = new AttributeTypeBuilder(); for (StructField field : schema.fields()) { AttributeDescriptor attrDesc = attrDescFromStructField(attrBuilder, field); typeBuilder.add(attrDesc); } return typeBuilder.buildFeatureType(); }
@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; }
@Override public AbstractLayerSourceAssistantPage getNextPage() { final LayerSourcePageContext context = getContext(); try { final Product product = context.getAppContext().getSelectedProduct(); 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; }