Package org.h2gis.functions.io.utility
Class PRJUtil
- java.lang.Object
-
- org.h2gis.functions.io.utility.PRJUtil
-
public class PRJUtil extends Object
A class to manage PRJ file- Author:
- Erwan Bocher
-
-
Constructor Summary
Constructors Constructor Description PRJUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intgetSRID(File prjFile)Return the SRID value stored in a prj file If the the prj file - is null, - is empty then a default srid equals to 0 is added.static intgetValidSRID(Connection connection, File prjFile)Get a valid SRID value from a prj file.static booleanisSRIDValid(int srid, Connection connection)This method checks if a SRID value is valid according a list of SRID's avalaible on spatial_ref table of the datababase.static voidwritePRJ(Connection connection, int srid, File fileName)Write a prj file according a given SRID code.static voidwritePRJ(Connection connection, org.h2gis.utilities.TableLocation location, String geomField, File fileName)Write a prj file according the SRID code of an input table
-
-
-
Method Detail
-
getSRID
public static int getSRID(File prjFile) throws IOException
Return the SRID value stored in a prj file If the the prj file - is null, - is empty then a default srid equals to 0 is added.- Parameters:
prjFile-- Returns:
- Throws:
IOException
-
getValidSRID
public static int getValidSRID(Connection connection, File prjFile) throws SQLException, IOException
Get a valid SRID value from a prj file. If the the prj file - is null, - doesn't contain a valid srid code, - is empty * then a default srid equals to 0 is added.- Parameters:
connection-prjFile-- Returns:
- Throws:
SQLExceptionIOException
-
writePRJ
public static void writePRJ(Connection connection, org.h2gis.utilities.TableLocation location, String geomField, File fileName) throws SQLException, FileNotFoundException
Write a prj file according the SRID code of an input table- Parameters:
connection- database connectionlocation- input table namegeomField- geometry field namefileName- path of the prj file- Throws:
SQLExceptionFileNotFoundException
-
writePRJ
public static void writePRJ(Connection connection, int srid, File fileName) throws SQLException, FileNotFoundException
Write a prj file according a given SRID code.- Parameters:
connection- database connectionsrid- srid codefileName- path of the prj file- Throws:
SQLExceptionFileNotFoundException
-
isSRIDValid
public static boolean isSRIDValid(int srid, Connection connection) throws SQLExceptionThis method checks if a SRID value is valid according a list of SRID's avalaible on spatial_ref table of the datababase.- Parameters:
srid-connection-- Returns:
- Throws:
SQLException
-
-