Class GeoJsonUtils


  • public final class GeoJsonUtils
    extends java.lang.Object
    GeoJson format support for GEOMETRY data type.
    • Field Detail

      • TYPES

        static final java.lang.String[] TYPES
        0-based type names of geometries, subtract 1 from type code to get index in this array.
    • Constructor Detail

      • GeoJsonUtils

        private GeoJsonUtils()
    • Method Detail

      • ewkbToGeoJson

        public static byte[] ewkbToGeoJson​(byte[] ewkb,
                                           int dimensionSystem)
        Converts EWKB with known dimension system to GeoJson.
        Parameters:
        ewkb - geometry object in EWKB format
        dimensionSystem - dimension system of the specified object, may be the same or smaller than its real dimension system. M dimension system is not supported.
        Returns:
        GeoJson representation of the specified geometry
        Throws:
        DbException - on unsupported dimension system
      • geoJsonToEwkb

        public static byte[] geoJsonToEwkb​(byte[] json,
                                           int srid)
        Converts EWKB with known dimension system to GeoJson.
        Parameters:
        json - geometry object in GeoJson format
        srid - the SRID of geometry
        Returns:
        GeoJson representation of the specified geometry
        Throws:
        DbException - on unsupported dimension system
      • readCoordinate

        private static double readCoordinate​(JSONValue[] values,
                                             int index)