private List createSubgraphs(PlanarGraph graph) {
   List subgraphList = new ArrayList();
   for (Iterator i = graph.getNodes().iterator(); i.hasNext(); ) {
     Node node = (Node) i.next();
     if (!node.isVisited()) {
       BufferSubgraph subgraph = new BufferSubgraph();
       subgraph.create(node);
       subgraphList.add(subgraph);
     }
   }
   /**
    * Sort the subgraphs in descending order of their rightmost coordinate. This ensures that when
    * the Polygons for the subgraphs are built, subgraphs for shells will have been built before
    * the subgraphs for any holes they contain.
    */
   Collections.sort(subgraphList, Collections.reverseOrder());
   return subgraphList;
 }
  public Geobuf.Data makeFeatureCollection(Collection<GeobufFeature> featureCollection) {
    Geobuf.Data.Builder data =
        Geobuf.Data.newBuilder()
            .setPrecision(this.precision)
            // TODO don't hardwire
            .setDimensions(2);

    Geobuf.Data.FeatureCollection.Builder fc = Geobuf.Data.FeatureCollection.newBuilder();

    // deduplicate keys
    List<String> keys = new ArrayList<>();

    featureCollection.stream().map(f -> this.makeFeature(f, keys)).forEach(fc::addFeatures);

    fc.addAllValues(Collections.emptyList());
    fc.addAllCustomProperties(Collections.emptyList());

    data.setFeatureCollection(fc);
    data.addAllKeys(keys);

    return data.build();
  }