Java Code Examples for com.vividsolutions.jts.io.ParseException#getMessage()

The following examples show how to use com.vividsolutions.jts.io.ParseException#getMessage() . 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: GeoWKT.java    From sql-layer with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected void doEvaluate(TExecutionContext context, LazyList<? extends ValueSource> inputs, ValueTarget output) {
    String wkt = inputs.get(0).getString();
    WKTReader reader = (WKTReader)context.preptimeObjectAt(READER_CONTEXT_POS);
    try {
        Geometry geometry = reader.read(wkt);
        output.putObject(geometry);
    } catch(ParseException e) {
        throw new InvalidSpatialObjectException(e.getMessage());
    }
}
 
Example 2
Source File: GeoWKB.java    From sql-layer with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected void doEvaluate(TExecutionContext context, LazyList<? extends ValueSource> inputs, ValueTarget output) {
    byte[] data = new byte[0];

    if (inputs.get(0).hasAnyValue()) {
        Object o = inputs.get(0).getObject();
        if (o instanceof BlobRef) {
            BlobRef blob;
            blob = (BlobRef) o;
            String mode = context.getQueryContext().getStore().getConfig().getProperty(AkBlob.RETURN_UNWRAPPED);
            if (mode.equalsIgnoreCase(AkBlob.UNWRAPPED)){
                data = blob.getBytes();
            }
            else {
                if (blob.isShortLob()) {
                    data = blob.getBytes();
                } else {
                    LobService ls = context.getQueryContext().getServiceManager().getServiceByClass(LobService.class);
                    data = ls.readBlob(context.getQueryContext().getSession(), blob.getId());
                }
            }
        } else if (o instanceof byte[]) {
            data = (byte[])o;
        }
    }
    
    WKBReader reader = (WKBReader)context.preptimeObjectAt(READER_CONTEXT_POS);
    try {
        Geometry geometry = reader.read(data);
        output.putObject(geometry);
    } catch(ParseException e) {
        throw new InvalidSpatialObjectException(e.getMessage());
    }
}
 
Example 3
Source File: KMLWriterTest.java    From jts with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void checkEqual(KMLWriter kmlWriter, String wkt, String expectedKML) {
  try {
    Geometry geom = rdr.read(wkt);
    checkEqual(kmlWriter, geom, expectedKML);
  } catch (ParseException e) {
    throw new RuntimeException("ParseException: " + e.getMessage());
  }
}
 
Example 4
Source File: InvalidHoleRemoverTest.java    From jts with GNU Lesser General Public License v2.1 5 votes vote down vote up
private Geometry read(String wkt) {
  try {
     return reader.read(wkt);
  } catch (ParseException e) {
    throw new RuntimeException(e.getMessage());
  }
  
}
 
Example 5
Source File: SmallHoleRemoverTest.java    From jts with GNU Lesser General Public License v2.1 5 votes vote down vote up
private Geometry read(String wkt) {
  try {
     return reader.read(wkt);
  } catch (ParseException e) {
    throw new RuntimeException(e.getMessage());
  }
  
}
 
Example 6
Source File: GeometryTestCase.java    From jts with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Reads a {@link Geometry} from a WKT string using a custom {@link GeometryFactory}.
 *  
 * @param geomFactory the custom factory to use
 * @param wkt the WKT string
 * @return the geometry read
 */
protected Geometry read(GeometryFactory geomFactory, String wkt) {
  WKTReader reader = new WKTReader(geomFactory);
  try {
     return reader.read(wkt);
  } catch (ParseException e) {
    throw new RuntimeException(e.getMessage());
  }
}
 
Example 7
Source File: GeometryTestCase.java    From jts with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected Geometry read(String wkt) {
  try {
     return reader.read(wkt);
  } catch (ParseException e) {
    throw new RuntimeException(e.getMessage());
  }
}