Search in sources :

Example 1 with WKBHexFileReader

use of com.revolsys.geometry.wkb.WKBHexFileReader in project com.revolsys.open by revolsys.

the class IOUtil method readGeometriesFromWKBHexString.

public static Geometry readGeometriesFromWKBHexString(final String wkb, final GeometryFactory geomFact) throws ParseException, IOException {
    final WKBReader reader = new WKBReader(geomFact);
    final WKBHexFileReader fileReader = new WKBHexFileReader(new StringReader(wkb), reader);
    final List geomList = fileReader.read();
    if (geomList.size() == 1) {
        return (Geometry) geomList.get(0);
    }
    return geomFact.geometryCollection(geomList);
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) StringReader(java.io.StringReader) List(java.util.List) WKBHexFileReader(com.revolsys.geometry.wkb.WKBHexFileReader) WKBReader(com.revolsys.geometry.wkb.WKBReader)

Aggregations

Geometry (com.revolsys.geometry.model.Geometry)1 WKBHexFileReader (com.revolsys.geometry.wkb.WKBHexFileReader)1 WKBReader (com.revolsys.geometry.wkb.WKBReader)1 StringReader (java.io.StringReader)1 List (java.util.List)1