dep_package/Hicore/hicore/shp.hpp
// the function is inline here deliberately for reference
/**
 * \brief Read in-memory shapefile, also serves as a reference to write read functions for custom
 * data structure
 *
 * \param shp The shapefile reader
 * \param buffer Pointer to the memory to read
 * \param file_size The size of the memory in bytes
 * \return The result data
 */
the function is inline here deliberately for reference
\brief Read in-memory shapefile, also serves as a reference to write read functions for custom
data structure

\param shp The shapefile reader
\param buffer Pointer to the memory to read
\param file_size The size of the memory in bytes
\return The result data
the function is inline here deliberately for reference \ brief Read in - memory shapefile also serves as a reference to write read functions for custom data structure \ param shp The shapefile reader \ param buffer Pointer to the memory to read \ param file_size The size of the memory in bytes \ return The result data
inline GeoData Read(Shapefile &shp, uint8_t *buffer, uint64_t file_size = 0) {
    GeoData data;
    auto shp_meta = shp.ReadShpMeta(buffer, file_size);
    data.Grow(shp_meta.size / 6);         
    data.extents.Grow(shp_meta.size / 8); 
    auto cursor = shp.ReadMeta(data, buffer);
    while (cursor < buffer + shp_meta.size) {
        shp.UpdateSummary(data, cursor);
        shp.ReadExtent(data.extents, cursor);
        cursor = shp.ReadFeature(data, data.feature_count, cursor, data.feature_type);
    }
    return data;
}
inline GeoData Read ( Shapefile & shp , uint8_t * buffer , uint64_t file_size = 0 ) { GeoData data ; auto shp_meta = shp . ReadShpMeta ( buffer , file_size ) ; data . Grow ( shp_meta . size / 6 ) ; data . extents . Grow ( shp_meta . size / 8 ) ; auto cursor = shp . ReadMeta ( data , buffer ) ; while ( cursor < buffer + shp_meta . size ) { shp . UpdateSummary ( data , cursor ) ; shp . ReadExtent ( data . extents , cursor ) ; cursor = shp . ReadFeature ( data , data . feature_count , cursor , data . feature_type ) ; } return data ; }
the function is inline here deliberately for reference
 \brief Read in-memory shapefile, also serves as a reference to write read functions for custom
 data structure
the function is inline here deliberately for reference \ brief Read in - memory shapefile also serves as a reference to write read functions for custom data structure
// heuristic, about 1.3 * original file size // heuristic, 1 * original file size