Class GeoJsonReaderDriver


  • public class GeoJsonReaderDriver
    extends Object
    Driver to import a GeoJSON file into a spatial table. Supported geometries are POINT, LINESTRING, POLYGON and GEOMETRYCOLLECTION. The driver requires all Feature objects in a collection to have the same schema of properties. To build the table schema the first feature of the FeatureCollection is parsed. If the GeoJSON format does not contain any properties, a default primary key is added.
    Author:
    Erwan Bocher, Hai Trung Pham
    • Constructor Detail

      • GeoJsonReaderDriver

        public GeoJsonReaderDriver​(Connection connection,
                                   File fileName,
                                   String encoding,
                                   boolean deleteTable)
        Driver to import a GeoJSON file into a spatial table.
        Parameters:
        connection - database connection
        fileName - input file
        encoding - file encoding
        deleteTable - true to delete the table
    • Method Detail

      • read

        public String read​(org.h2gis.api.ProgressVisitor progress,
                           String tableReference)
                    throws SQLException,
                           IOException
        Read the GeoJSON file.
        Parameters:
        progress - Progress visitor following the execution.
        tableReference - output table name
        Returns:
        table name or null
        Throws:
        SQLException
        IOException