src/sources/geojson.js
function getCentroidFeatureForPolygon (coordinates, properties, newProperties) {
    let centroid = Geo.centroid(coordinates);
    if (!centroid) {
        return;
    }

    // clone properties and mixix newProperties
    let centroid_properties = {};
    Object.assign(centroid_properties, properties, newProperties);

    return {
        type: 'Feature',
        properties: centroid_properties,
        geometry: {
            type: 'Point',
            coordinates: centroid
        }
    };
}
function getCentroidFeatureForPolygon (coordinates, properties, newProperties) {
    let centroid = Geo.centroid(coordinates);
    if (!centroid) {
        return;
    }

    // clone properties and mixix newProperties
    let centroid_properties = {};
    Object.assign(centroid_properties, properties, newProperties);

    return {
        type: 'Feature',
        properties: centroid_properties,
        geometry: {
            type: 'Point',
            coordinates: centroid
        }
    };
}
function getCentroidFeatureForPolygon ( coordinates , properties , newProperties ) { let centroid = Geo . centroid ( coordinates ) ; if ( ! centroid ) { return ; } // clone properties and mixix newProperties let centroid_properties = { } ; Object . assign ( centroid_properties , properties , newProperties ) ; return { type : 'Feature' , properties : centroid_properties , geometry : { type : 'Point' , coordinates : centroid } } ; }
Helper function to create centroid point feature from polygon coordinates and provided feature meta-data
Helper function to create centroid point feature from polygon coordinates and provided feature meta - data