public static String geometryToWKB(Geometry g,CoordinateTransformation transformation){
  StringBuilder wkb=new StringBuilder(BIG_ENDIAN);
  if (g instanceof Point) {
    wkb.append(WKB_POINT);
  }
 else   if (g instanceof LineString) {
    wkb.append(WKB_LINE_STRING);
  }
 else   if (g instanceof MultiLineString) {
    wkb.append(WKB_MULTI_LINE_STRING);
  }
  for (  Coordinate coordinate : g.getCoordinates()) {
    Coord c=transformation.transform(MGC.coordinate2Coord(coordinate));
    wkb.append(Long.toHexString(Double.doubleToRawLongBits(c.getX())));
    wkb.append(Long.toHexString(Double.doubleToRawLongBits(c.getY())));
  }
  return wkb.toString();
}

public static String geometryToWKB ( Geometry g , CoordinateTransformation transformation ) { StringBuilder wkb = new StringBuilder ( BIG_ENDIAN ) ; if ( g instanceof Point ) { wkb . append ( WKB_POINT ) ; } else if ( g instanceof LineString ) { wkb . append ( WKB_LINE_STRING ) ; } else if ( g instanceof MultiLineString ) { wkb . append ( WKB_MULTI_LINE_STRING ) ; } for ( Coordinate coordinate : g . getCoordinates ( ) ) { Coord c = transformation . transform ( MGC . coordinate2Coord ( coordinate ) ) ; wkb . append ( Long . toHexString ( Double . doubleToRawLongBits ( c . getX ( ) ) ) ) ; wkb . append ( Long . toHexString ( Double . doubleToRawLongBits ( c . getY ( ) ) ) ) ; } return wkb . toString ( ) ; }
converts the given geometry into a well - known binary string .
