function h3SetToFeature()

in src/geojson2h3.js [190:205]


function h3SetToFeature(hexagons, properties = {}) {
    const polygons = h3.cellsToMultiPolygon(hexagons, true);
    // See if we can unwrap to a simple Polygon.
    const isMultiPolygon = polygons.length > 1;
    const type = isMultiPolygon ? MULTI_POLYGON : POLYGON;
    // MultiPolygon, single polygon, or empty array for an empty hex set
    const coordinates = isMultiPolygon ? polygons : polygons[0] || [];
    return {
        type: FEATURE,
        properties,
        geometry: {
            type,
            coordinates
        }
    };
}