presto-geospatial-toolkit/src/main/java/io/prestosql/geospatial/serde/JtsGeometrySerde.java/JtsGeometrySerde/writePolyline
class JtsGeometrySerde:    private static void writePolyline(Geometry geometry, SliceOutput output, boolean multitype)
    {
        int numParts;
        int numPoints = geometry.getNumPoints();
        if (multitype) {
            numParts = geometry.getNumGeometries();
            output.writeByte(GeometrySerializationType.MULTI_LINE_STRING.code());
        }
        else {
            numParts = numPoints > 0 ? 1 : 0;
            output.writeByte(GeometrySerializationType.LINE_STRING.code());
        }

        output.writeInt(EsriShapeType.POLYLINE.code);

        writeEnvelope(geometry, output);

        output.writeInt(numParts);
        output.writeInt(numPoints);

        int partIndex = 0;
        for (int i = 0; i < numParts; i++) {
            output.writeInt(partIndex);
            partIndex += geometry.getGeometryN(i).getNumPoints();
        }

        writeCoordinates(geometry.getCoordinates(), output);
    }