com.ibm.tivoli.maximo.map

Class GeometryUtils

  • java.lang.Object
    • com.ibm.tivoli.maximo.map.GeometryUtils


  • public class GeometryUtils
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor and Description
      GeometryUtils() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static java.util.List calculateGeometryGeoHashCover(byte[] geometryBytes) 
      static java.lang.Long calculateMBRGeoHash(byte[] geometryBytes) 
      static java.lang.Long calculatePointGeoHash(java.lang.Double y, java.lang.Double x) 
      static java.lang.String convertFromBinaryToGeoJSON(byte[] bytes)
      Convert from Binary to GeoJSON String format
      static java.lang.String convertFromBinaryToWKT(byte[] bytes)
      Convert from Binary format to String WKT
      static byte[] convertFromGeoJSONToBinary(java.lang.String geoJSOString)
      Convert from GeoJSON string to Binary format
      static java.lang.String convertFromGeoJSONToWKT(java.lang.String geoJSONString)
      Convert from GeoJSON String format to WKT String
      static byte[] convertFromWKTToBinary(java.lang.String wkt)
      Convert from WKT String to Binary format
      static java.lang.String convertFromWKTToGeoJSON(java.lang.String wkt)
      Convert from WKT String to GeoJSON String
      static java.lang.String convertToExternalFormat(byte[] data, java.lang.String mboName)
      Convert the binary data to the External format geometry for the Mbo
      static byte[] convertToInternalFormat(java.lang.String geometryString, java.lang.String mboName)
      Convert the External geometry to the binary format that is used in the DB
      static java.lang.String createBoundingBoxGeohashClause(java.lang.Double[] bboxValues) 
      static java.lang.String createBoundingBoxWhereClause(java.lang.String objectName, java.lang.Double bboxMinLong, java.lang.Double bboxMinLat, java.lang.Double bboxMaxLong, java.lang.Double bboxMaxLat) 
      static java.lang.String findGeometryHashTablename(java.lang.String mboName) 
      static java.lang.String getGeoHashCenter(java.lang.Long hash, int bitDepth, java.lang.String externalFormat) 
      static java.lang.String getGeoHashCenter(java.lang.Long hash, java.lang.String externalFormat)
      Get center latitude/longitude from the hash
      static int getProperHashDepthLevel(double minLong, double maxLong)
      Get the proper hash depth level based on longitude.
      static boolean isGeometryField(java.lang.String mboName, java.lang.String fieldName) 
      static java.lang.Double[] parseBBoxParam(java.lang.String bboxParam)
      Parse bboxQuery parameter
      static byte[] reGenerateBinary(byte[] geometry)
      Method to generate again the binary value Useful when lib changes the metadata that is stored in the bynary
      static java.lang.String retrieveGeometryTypeFromBinary(byte[] binaryGeometry) 
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GeometryUtils

        public GeometryUtils()
    • Method Detail

      • reGenerateBinary

        public static byte[] reGenerateBinary(byte[] geometry)
                                       throws MXApplicationException
        Method to generate again the binary value Useful when lib changes the metadata that is stored in the bynary
        Returns:
        Throws:
        MXApplicationException
      • convertFromWKTToBinary

        public static byte[] convertFromWKTToBinary(java.lang.String wkt)
                                             throws MXApplicationException,
                                                    com.ibm.research.st.STException
        Convert from WKT String to Binary format
        Parameters:
        -
        Returns:
        Throws:
        MXApplicationException
        com.ibm.research.st.STException
      • convertFromGeoJSONToBinary

        public static byte[] convertFromGeoJSONToBinary(java.lang.String geoJSOString)
                                                 throws MXApplicationException,
                                                        com.ibm.research.st.STException
        Convert from GeoJSON string to Binary format
        Parameters:
        geoJSOString -
        Returns:
        Throws:
        MXApplicationException
        com.ibm.research.st.STException
      • convertFromBinaryToWKT

        public static java.lang.String convertFromBinaryToWKT(byte[] bytes)
                                                       throws MXApplicationException
        Convert from Binary format to String WKT
        Parameters:
        bytes -
        Returns:
        Throws:
        MXApplicationException
      • convertFromGeoJSONToWKT

        public static java.lang.String convertFromGeoJSONToWKT(java.lang.String geoJSONString)
                                                        throws MXApplicationException
        Convert from GeoJSON String format to WKT String
        Parameters:
        geoJSONString -
        Returns:
        Throws:
        MXApplicationException
      • convertFromBinaryToGeoJSON

        public static java.lang.String convertFromBinaryToGeoJSON(byte[] bytes)
                                                           throws MXApplicationException
        Convert from Binary to GeoJSON String format
        Parameters:
        bytes -
        Returns:
        Throws:
        MXApplicationException
      • convertFromWKTToGeoJSON

        public static java.lang.String convertFromWKTToGeoJSON(java.lang.String wkt)
                                                        throws MXApplicationException
        Convert from WKT String to GeoJSON String
        Parameters:
        wkt -
        Returns:
        Throws:
        MXApplicationException
      • isGeometryField

        public static boolean isGeometryField(java.lang.String mboName,
                                              java.lang.String fieldName)
        Parameters:
        mboName -
        fieldName -
        Returns:
      • convertToExternalFormat

        public static java.lang.String convertToExternalFormat(byte[] data,
                                                               java.lang.String mboName)
                                                        throws MXApplicationException
        Convert the binary data to the External format geometry for the Mbo
        Parameters:
        data -
        mboName -
        Returns:
        Throws:
        MXApplicationException
      • convertToInternalFormat

        public static byte[] convertToInternalFormat(java.lang.String geometryString,
                                                     java.lang.String mboName)
                                              throws MXApplicationException
        Convert the External geometry to the binary format that is used in the DB
        Parameters:
        geometryString -
        mboName -
        Returns:
        Throws:
        MXApplicationException
      • createBoundingBoxWhereClause

        public static java.lang.String createBoundingBoxWhereClause(java.lang.String objectName,
                                                                    java.lang.Double bboxMinLong,
                                                                    java.lang.Double bboxMinLat,
                                                                    java.lang.Double bboxMaxLong,
                                                                    java.lang.Double bboxMaxLat)
        Parameters:
        objectName -
        bboxMinLong -
        bboxMinLat -
        bboxMaxLong -
        bboxMaxLat -
        Returns:
      • createBoundingBoxGeohashClause

        public static java.lang.String createBoundingBoxGeohashClause(java.lang.Double[] bboxValues)
                                                               throws MXApplicationException
        Parameters:
        bboxValues -
        Returns:
        Throws:
        MXApplicationException
      • findGeometryHashTablename

        public static java.lang.String findGeometryHashTablename(java.lang.String mboName)
        Parameters:
        mboName -
        Returns:
      • getGeoHashCenter

        public static java.lang.String getGeoHashCenter(java.lang.Long hash,
                                                        java.lang.String externalFormat)
                                                 throws MXApplicationException
        Get center latitude/longitude from the hash
        Parameters:
        hash - truncated hash
        externalFormat -
        Returns:
        center latitude/longitude
        Throws:
        MXApplicationException
      • getGeoHashCenter

        public static java.lang.String getGeoHashCenter(java.lang.Long hash,
                                                        int bitDepth,
                                                        java.lang.String externalFormat)
                                                 throws MXApplicationException
        Parameters:
        hash - truncated hash
        bitDepth - bit depth
        externalFormat -
        Returns:
        center latitude/longitude
        Throws:
        MXApplicationException
      • parseBBoxParam

        public static java.lang.Double[] parseBBoxParam(java.lang.String bboxParam)
                                                 throws MXApplicationException
        Parse bboxQuery parameter
        Parameters:
        bboxParam -
        Returns:
        parsed min and max latitude/longitude
        Throws:
        MXApplicationException
      • getProperHashDepthLevel

        public static int getProperHashDepthLevel(double minLong,
                                                  double maxLong)
        Get the proper hash depth level based on longitude.
        Parameters:
        minLong -
        maxLong -
      • retrieveGeometryTypeFromBinary

        public static java.lang.String retrieveGeometryTypeFromBinary(byte[] binaryGeometry)
        Parameters:
        binaryGeometry -
        Returns: