Package org.h2gis.utilities
Class GeometryMetaData
- java.lang.Object
-
- org.h2gis.utilities.GeometryMetaData
-
public class GeometryMetaData extends Object
Extract Geometry MetaData from various geometry signatures
-
-
Field Summary
Fields Modifier and Type Field Description intdimensionGeometry dimension 2 , 3 or 4static intEWKB_MGeometry type mask that indicates presence of dimension M.static intEWKB_SRIDGeometry type mask that indicates presence of SRID.static intEWKB_ZGeometry type mask that indicates presence of dimension Z.StringgeometryTypeFull string representation of the geometry type include z and m dimension e.g POINTZMintgeometryTypeCodeGeometry type and dimension system in OGC geometry code format.booleanhasMIf M Component is availablebooleanhasZIf Z Component is availableStringsfs_geometryTypeSFS String representation of the geometry type only canonical form POINT, LINESTRING...intsfs_geometryTypeCodeSimplified geometry type code without +1000intSRIDEPSG code
-
Constructor Summary
Constructors Constructor Description GeometryMetaData()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static GeometryMetaDatacreateMetadataFromGeometryType(String type)Find geometry metadata according the EWKT canonical form as defined in SQL/MM specification.static GeometryMetaDatacreateMetadataFromGeometryType(String type, int srid)Find geometry metadata according the EWKT canonical form and a SRID as defined in SQL/MM specification.intgetDimension()Return the dimension of the geometry 2 if XZ 3 if XZZ or XYM 4 if XYZMStringgetGeometryType()Return a string representation of the geometry type as defined in SQL/MM specification.intgetGeometryTypeCode()Return an integer code representation of the geometry type as defined in SQL/MM specification.static GeometryMetaDatagetMetaData(byte[] bytes)Read the first bytes of Geometry WKB.static GeometryMetaDatagetMetaData(String geometry)Read the metadata from its string representation The following signatures are allowed : SRID=4326, POINT(0 0) POINT(0 0) GEOMETRY GEOMETRY(POINTZ) GEOMETRY(POINTZ, 4326)static GeometryMetaDatagetMetaData(org.locationtech.jts.geom.Geometry geometry)Read the first bytes of Geometry.static GeometryMetaDatagetMetaDataFromTablePattern(String geometry_pattern)Read the metadata from its string representation The following signatures is allowed : GEOMETRY GEOMETRY(POINTZ) GEOMETRY(POINTZ, 4326)StringgetSfs_geometryType()Get SFS type codeintgetSfs_geometryTypeCode()Return the SFS geometry type codeStringgetSQL()Return the SQL representation of the geometry signatureintgetSRID()Return the SRIDbooleanhasM()true if the geometry as a M dimensionbooleanhasZ()true if the geometry as a Z dimensionvoidinitDimension()Find geometry dimension propertiesvoidinitGeometryType()Find full geometryTypevoidsetDimension(int dimension)Set the dimension of the geometryvoidsetGeometryType(String geometryType)Set the geometry type namevoidsetGeometryTypeCode(int geometryTypeCode)Set full geometry type with +1000voidsetHasM(boolean hasM)True is geometry has MvoidsetHasZ(boolean hasZ)True is geometry has ZvoidsetSfs_geometryType(String sfs_geometryType)Set the SFS geometry type namevoidsetSfs_geometryTypeCode(int sfs_geometryTypeCode)Set SFS type codevoidsetSRID(int SRID)Set the SRID
-
-
-
Field Detail
-
hasZ
public boolean hasZ
If Z Component is available
-
hasM
public boolean hasM
If M Component is available
-
dimension
public int dimension
Geometry dimension 2 , 3 or 4
-
geometryType
public String geometryType
Full string representation of the geometry type include z and m dimension e.g POINTZM
-
sfs_geometryType
public String sfs_geometryType
SFS String representation of the geometry type only canonical form POINT, LINESTRING...
-
SRID
public int SRID
EPSG code
-
EWKB_Z
public static final int EWKB_Z
Geometry type mask that indicates presence of dimension Z.- See Also:
- Constant Field Values
-
EWKB_M
public static final int EWKB_M
Geometry type mask that indicates presence of dimension M.- See Also:
- Constant Field Values
-
EWKB_SRID
public static final int EWKB_SRID
Geometry type mask that indicates presence of SRID.- See Also:
- Constant Field Values
-
geometryTypeCode
public int geometryTypeCode
Geometry type and dimension system in OGC geometry code format.
-
sfs_geometryTypeCode
public int sfs_geometryTypeCode
Simplified geometry type code without +1000
-
-
Method Detail
-
initDimension
public void initDimension()
Find geometry dimension properties
-
initGeometryType
public void initGeometryType()
Find full geometryType
-
getDimension
public int getDimension()
Return the dimension of the geometry 2 if XZ 3 if XZZ or XYM 4 if XYZM- Returns:
-
getGeometryType
public String getGeometryType()
Return a string representation of the geometry type as defined in SQL/MM specification. SQL-MM 3: 5.1.4 and OGC SFS 1.2- Returns:
-
getGeometryTypeCode
public int getGeometryTypeCode()
Return an integer code representation of the geometry type as defined in SQL/MM specification. SQL-MM 3: 5.1.4 and OGC SFS 1.2- Returns:
-
getSRID
public int getSRID()
Return the SRID- Returns:
-
hasM
public boolean hasM()
true if the geometry as a M dimension- Returns:
-
hasZ
public boolean hasZ()
true if the geometry as a Z dimension- Returns:
-
setSfs_geometryTypeCode
public void setSfs_geometryTypeCode(int sfs_geometryTypeCode)
Set SFS type code- Parameters:
sfs_geometryTypeCode-
-
getSfs_geometryType
public String getSfs_geometryType()
Get SFS type code- Returns:
-
setDimension
public void setDimension(int dimension)
Set the dimension of the geometry- Parameters:
dimension-
-
setGeometryTypeCode
public void setGeometryTypeCode(int geometryTypeCode)
Set full geometry type with +1000- Parameters:
geometryTypeCode-
-
setGeometryType
public void setGeometryType(String geometryType)
Set the geometry type name- Parameters:
geometryType-
-
setSRID
public void setSRID(int SRID)
Set the SRID- Parameters:
SRID-
-
setSfs_geometryType
public void setSfs_geometryType(String sfs_geometryType)
Set the SFS geometry type name- Parameters:
sfs_geometryType-
-
setHasM
public void setHasM(boolean hasM)
True is geometry has M- Parameters:
hasM-
-
setHasZ
public void setHasZ(boolean hasZ)
True is geometry has Z- Parameters:
hasZ-
-
getSQL
public String getSQL()
Return the SQL representation of the geometry signature- Returns:
-
getMetaData
public static GeometryMetaData getMetaData(byte[] bytes)
Read the first bytes of Geometry WKB. Note this method read the SRID from the EWKB mask It's better to use getMetaData(geometry) to get all metadata- Parameters:
bytes- WKB Bytes- Returns:
- Geometry MetaData
-
getMetaData
public static GeometryMetaData getMetaData(org.locationtech.jts.geom.Geometry geometry)
Read the first bytes of Geometry.- Parameters:
geometry-- Returns:
- Geometry MetaData
-
getMetaData
public static GeometryMetaData getMetaData(String geometry)
Read the metadata from its string representation The following signatures are allowed : SRID=4326, POINT(0 0) POINT(0 0) GEOMETRY GEOMETRY(POINTZ) GEOMETRY(POINTZ, 4326)- Parameters:
geometry- string representation- Returns:
- Geometry MetaData
-
getMetaDataFromTablePattern
public static GeometryMetaData getMetaDataFromTablePattern(String geometry_pattern)
Read the metadata from its string representation The following signatures is allowed : GEOMETRY GEOMETRY(POINTZ) GEOMETRY(POINTZ, 4326)- Parameters:
geometry_pattern- pattern representation- Returns:
- Geometry MetaData
-
createMetadataFromGeometryType
public static GeometryMetaData createMetadataFromGeometryType(String type)
Find geometry metadata according the EWKT canonical form as defined in SQL/MM specification. SQL-MM 3: 5.1.4 and OGC SFS 1.2- Parameters:
type- : geometry type- Returns:
- GeometryMetaData
-
createMetadataFromGeometryType
public static GeometryMetaData createMetadataFromGeometryType(String type, int srid)
Find geometry metadata according the EWKT canonical form and a SRID as defined in SQL/MM specification. SQL-MM 3: 5.1.4 and OGC SFS 1.2- Parameters:
type- : geometry typesrid- : srid value- Returns:
- GeometryMetaData
-
getSfs_geometryTypeCode
public int getSfs_geometryTypeCode()
Return the SFS geometry type code- Returns:
-
-