private Geometry readTextObject() throws IOException { try { mifText_ = mif_.getToken(' ', true, true); } catch (final ParseException e) { throw new IOException(e.getMessage()); } final Coordinate c1 = readMIFCoordinate(); final Coordinate c2 = readMIFCoordinate(); final Coordinate p = new Coordinate((c1.x + c2.x) / 2, (c1.y + c2.y) / 2); return geomFactory_.createPoint(p); }
@Override public void parseValue(XmlObject value, MapEposEvent result) { Geometry geom; try { geom = GMLGeometryFactory.parseGeometry(value); } catch (ParseException e) { logger.warn(e.getMessage(), e); return; } if (geom != null) { result.put(MapEposEvent.GEOMETRY_KEY, geom); } }
private Geometry readTextObject() throws IOException { try { mifText = mif.getToken(' ', true, true); } catch (ParseException e) { throw new IOException(e.getMessage()); } Coordinate c1 = readMIFCoordinate(); Coordinate c2 = readMIFCoordinate(); Coordinate p = new Coordinate((c1.x + c2.x) / 2, (c1.y + c2.y) / 2); return geomFactory.createPoint(p); } }
private static Geometry extractGeometry(Object g0) { if (g0 instanceof Geometry) { //geometry given -> cast return (Geometry) g0; } else { //parse string WKTReader r = new WKTReader(); try { return r.read(g0.toString()); } catch (ParseException e) { logger.warn(e.getMessage(), e); } } return null; }
@Override public JTSGeometryBinding parse(InputStream input, String mimeType, String schema) { try { Geometry g = new WKTReader().read(new InputStreamReader(input)); return new JTSGeometryBinding(g); } catch (ParseException e) { LOGGER.error(e.getMessage(), e); }finally{ try { input.close(); } catch (IOException e) { LOGGER.error(e.getMessage(), e); } } return null; }
throw new IOException(_evt.getMessage());
public FeatureCollection open(final InputStream _in) throws IOException{ if (gmlInput_ == null) { return null; } try { final InputStreamReader inputStreamReader = new InputStreamReader(_in, CtuluLibFile.getUTF8Charset()); return read(new BufferedReader(inputStreamReader), "inputStream"); } catch (final ParseException _evt) { FuLog.error(_evt); throw new IOException(_evt.getMessage()); } catch (final SchemaException _evt) { FuLog.error(_evt); throw new IOException(_evt.getMessage()); } finally {} }
logger.warn(e.getMessage(), e);
geom = GMLGeometryFactory.parseGeometry(children[0]); } catch (ParseException e) { logger.warn(e.getMessage(), e);
"An error has occurred while accessing provided data", e); } catch (ParseException e) { LOGGER.error(e.getMessage(), e); throw new RuntimeException( "An error has occurred while accessing provided data", e);
public GMLInputTemplate getInputTemplate(final InputStream _f) throws IOException { InputStreamReader inputStreamReader = null; try { inputStreamReader = new InputStreamReader(_f, CtuluLibFile.getUTF8Charset()); return inputTemplate(inputStreamReader); } catch (final IOException _evt) { FuLog.error(_evt); throw _evt; } catch (final ParseException _evt) { FuLog.error(_evt); throw new IOException(_evt.getMessage()); } catch (final SAXException _evt) { FuLog.error(_evt); throw new IOException(_evt.getMessage()); } catch (final ParserConfigurationException _evt) { FuLog.error(_evt); throw new IOException(_evt.getMessage()); } finally { // if (inputStreamReader != null) inputStreamReader.close(); } }
public FeatureCollection open(final File _f) throws IOException { final GMLInputTemplate input = getInputTemplate(_f); if (input == null) { return null; } setInputTemplate(input); InputStreamReader inputStreamReader = null; try { inputStreamReader = new InputStreamReader(getInputStream(_f), CtuluLibFile.getUTF8Charset()); return read(new BufferedReader(inputStreamReader), _f.getName()); } catch (final ParseException _evt) { FuLog.error(_evt); throw new IOException(_evt.getMessage()); } catch (final SchemaException _evt) { FuLog.error(_evt); throw new IOException(_evt.getMessage()); } finally { if (inputStreamReader != null) { inputStreamReader.close(); } } }
@Override public T intersects( String propertyName, String wkt ) { logEntry( "intersects", propertyName, wkt ); boolean isBbox = false; try { WKTReader reader = new WKTReader(); isBbox = reader.read( wkt ).isRectangle(); } catch ( ParseException e ) { LOGGER.warn( "WKT could not be parsed into geometry object [{}]: " + e.getMessage() ); } return callHandleGeoMethod( propertyName, wkt, null, isBbox ? GeospatialFilterOptions.BBOX : GeospatialFilterOptions.INTERSECTS, null ); }
org.opengis.filter.expression.Literal geometry(Token start, Token end) throws ExpressionException { if (reader == null) reader = new WKTReader(); try { Geometry g = reader.read(input.substring(start.beginColumn - 1,end.endColumn)); return factory.literal(g); } catch (com.vividsolutions.jts.io.ParseException e) { throw new ExpressionException(e.getMessage(),start); } catch (Exception e) { throw new ExpressionException("Error building WKT Geometry",start,e); } }
private void initRead() throws IOException { if (!init_) { init_ = true; try { final GMLReader reader = new GMLReader(); final FeatureCollection collection = reader.open(f_); if (collection != null) { it_ = collection.features(); } else { it_ = null; } type_ = reader.gmlInput_.toFeatureSchema(); } catch (final SAXException _evt) { FuLog.error(_evt); throw new IOException(_evt.getMessage()); } catch (final ParseException _evt) { FuLog.error(_evt); throw new IOException(_evt.getMessage()); } catch (final SchemaException _evt) { FuLog.error(_evt); throw new IOException(_evt.getMessage()); } } }
/** * Builds geometry * * @param geometry * @return a geometry * @throws CQLException */ public Literal buildGeometry(final IToken geometry) throws CQLException { try { String wktGeom = scanExpression(geometry); // transforms wkt to vividsolution geometry String vividGeom = transformWKTGeometry(wktGeom); WKTReader reader = new WKTReader(); Geometry g = reader.read(vividGeom); Literal literal = filterFactory.literal(g); return literal; } catch (com.vividsolutions.jts.io.ParseException e) { throw new CQLException(e.getMessage(), geometry, e, this.cqlSource); } catch (Exception e) { throw new CQLException("Error building WKT Geometry: " + e.getMessage(),geometry, e, this.cqlSource); } }
/** * Builds geometry * * @param geometry * @return a geometry * @throws CQLException */ private Literal buildGeometry(final Token geometry) throws CQLException { try { String wktGeom = scanExpression(geometry); // transforms wkt to vividsolution geometry String vividGeom = transformWKTGeometry(wktGeom); Geometry g = WKT_READER.read(vividGeom); Literal literal = filterFactory.literal(g); return literal; } catch (com.vividsolutions.jts.io.ParseException e) { throw new CQLException(e.getMessage(), geometry, this.cqlSource); } catch (Exception e) { throw new CQLException("Error building WKT Geometry", geometry, e, this.cqlSource); } }
@Override public void save(WizardDescriptor wizardDescriptor) { Operation operation; try { operation = saveWizardContent(wizardDescriptor); planningEventProducer.triggerEvent(new OperationPlanEvent(operation, PlanEventKey.NEW_OPERATION)); } catch (RemedyNotFoundException ex) { LOG.error(ex.getMessage(), ex); } catch (ProductionUnitNotFoundException ex) { LOG.error(ex.getMessage(), ex); } catch (ParseException ex) { LOG.error(ex.getMessage(), ex); } }
ir.addPreparedArgument( new SQLIdentifier( slot.getColumn() ), wkt, sb.toString() ); } catch ( ParseException e ) { String msg = "Could not write as WKB " + geom + ": " + e.getMessage(); LOG.debug( msg, e ); throw new IllegalArgumentException();
LOGGER.warn( "WKT could not be parsed into a [{}] object wkt=[{}]: [{}]", supportedGeoOptions, wkt, e.getMessage() );