Class GeoJsonWriteDriver


  • public class GeoJsonWriteDriver
    extends Object
    A simple GeoJSON driver to write a spatial table to a GeoJSON file. GeoJSON is a format for encoding a variety of geographic data structures. A GeoJSON object may represent a geometry, a feature, or a collection of features. GeoJSON supports the following geometry types: POINT, LINESTRING, POLYGON, MULTIPOINT, MULTILINESTRING, MULTIPOLYGON, and GEOMETRYCOLLECTION. Syntax: { "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry":{"type": "Point", "coordinates": [102.0, 0.5]}, "properties": {"prop0": "value0"} } ]}
    Author:
    Erwan Bocher, Hai Trung Pham
    • Constructor Detail

      • GeoJsonWriteDriver

        public GeoJsonWriteDriver​(Connection connection)
        A simple GeoJSON driver to write a spatial table to a GeoJSON file.
        Parameters:
        connection - database connection
    • Method Detail

      • write

        public void write​(org.h2gis.api.ProgressVisitor progress,
                          ResultSet rs,
                          File fileName,
                          String encoding,
                          boolean deleteFile)
                   throws SQLException,
                          IOException
        Write a resulset to a geojson file
        Parameters:
        progress - Progress visitor following the execution.
        rs - input resulset
        fileName - the output file
        encoding - file encoding
        deleteFile - true to delete the file if exist
        Throws:
        SQLException
        IOException
      • write

        public void write​(org.h2gis.api.ProgressVisitor progress,
                          String tableName,
                          File fileName,
                          String encoding,
                          boolean deleteFile)
                   throws SQLException,
                          IOException
        Write the spatial table to GeoJSON format.
        Parameters:
        progress - Progress visitor following the execution.
        tableName - table name
        fileName - input file
        encoding - file encoding
        deleteFile - true to delete the file if exist
        Throws:
        SQLException
        IOException
      • isSupportedPropertyType

        public boolean isSupportedPropertyType​(String columnName,
                                               int sqlTypeId,
                                               String sqlTypeName)
                                        throws SQLException
        Return true is the SQL type is supported by the GeoJSON driver.
        Parameters:
        columnName - column name
        sqlTypeId - sql type id
        sqlTypeName - sql type name
        Returns:
        true if the column is supported
        Throws:
        SQLException