GeoJsonRead
Signatures
GeoJsonRead(VARCHAR path);
GeoJsonRead(VARCHAR path, BOOLEAN deleteTable);
GeoJsonRead(VARCHAR path, VARCHAR tableName);
GeoJsonRead(VARCHAR path, VARCHAR tableName, BOOLEAN deleteTable);
GeoJsonRead(VARCHAR path, VARCHAR tableName, VARCHAR fileEncoding);
GeoJsonRead(VARCHAR path, VARCHAR tableName, VARCHAR fileEncoding, BOOLEAN deleteTable);
Description
Reads a GeoJSON file from path and creates the corresponding spatial table tableName. This .geojson file may be zipped in a .gz file (in this case, the GeoJsonRead driver will unzip on the fly the .gz file).
Warning
The input geometries coordinates have to be exprimed with one of these 3 options:
XandY,X,YandZ,X,Y,ZandM.
Define fileEncoding to force encoding (useful when the header is missing encoding information) (default value is ISO-8859-1).
If:
the
tablenameparameter is not specified, then the resulting table has the same name as the GeoJSON file.the
deleteTableparameter istrueand tabletableNamealready exists in the database, then tabletableNamewill be removed / replaced by the new one. Else (nodeleteTableparameter ordeleteTableequal tofalse), an error indicating that the tabletableNamealready exists will be throwned.
Note
Warning on the input file name
When a tablename is not specified, special caracters in the input file name are not allowed. The possible caracters are as follow: A to Z, _ and 0 to 9.
Examples
1. Case with path
CALL GeoJsonRead('/home/user/data.geojson');
→ Here data.geojson will produce a table named data.
CALL GeoJsonRead('/home/user/data.geojson.gz');
→ Here data.geojson.gz will produce a table named data_geojson.
2. Case with tableName
CALL GeoJsonRead('/home/user/data.geojson', 'NEW_DATA');
→ Here data.geojson will produce a table named NEW_DATA.
3. Case with fileEncoding
CALL GeoJsonRead('/home/user/data.geojson', 'NEW_DATA', 'utf-8');
4. Case with deleteTable
Load the data.geojson file
CALL GeoJsonRead('/home/user/data.geojson');
→ the table data is created.
Now, load once again, using deleteTable = true
CALL GeoJsonRead('/home/user/data.geojson', true);
→ the already existing data table is removed / replaced.
Now, load once again, using deleteTable = false
CALL GeoJsonRead('/home/user/data.geojson', false);
→ Error message: The table "DATA" already exists.