Search in sources :

Example 1 with GeoJSONWriter

use of org.wololo.jts2geojson.GeoJSONWriter in project teiid by teiid.

the class GeometryUtils method geometryToGeoJson.

public static ClobType geometryToGeoJson(GeometryType geometry) throws FunctionExecutionException {
    Geometry jtsGeometry = getGeometry(geometry);
    GeoJSONWriter writer = new GeoJSONWriter();
    try {
        GeoJSON geoJson = writer.write(jtsGeometry);
        ClobType result = new ClobType(new ClobImpl(geoJson.toString()));
        result.setType(Type.JSON);
        return result;
    } catch (Exception e) {
        throw new FunctionExecutionException(e);
    }
}
Also used : ClobType(org.teiid.core.types.ClobType) FunctionExecutionException(org.teiid.api.exception.query.FunctionExecutionException) GeoJSON(org.wololo.geojson.GeoJSON) GeoJSONWriter(org.wololo.jts2geojson.GeoJSONWriter) ClobImpl(org.teiid.core.types.ClobImpl) SQLException(java.sql.SQLException) ParseException(com.vividsolutions.jts.io.ParseException) IOException(java.io.IOException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) SAXException(org.xml.sax.SAXException) FunctionExecutionException(org.teiid.api.exception.query.FunctionExecutionException)

Aggregations

ParseException (com.vividsolutions.jts.io.ParseException)1 IOException (java.io.IOException)1 SQLException (java.sql.SQLException)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 FunctionExecutionException (org.teiid.api.exception.query.FunctionExecutionException)1 ClobImpl (org.teiid.core.types.ClobImpl)1 ClobType (org.teiid.core.types.ClobType)1 GeoJSON (org.wololo.geojson.GeoJSON)1 GeoJSONWriter (org.wololo.jts2geojson.GeoJSONWriter)1 SAXException (org.xml.sax.SAXException)1