Package org.h2.util.geometry
Class GeoJsonUtils
- java.lang.Object
-
- org.h2.util.geometry.GeoJsonUtils
-
public final class GeoJsonUtils extends java.lang.Object
GeoJson format support for GEOMETRY data type.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GeoJsonUtils.GeoJsonTarget
Converter output target that writes a GeoJson.
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.lang.String[]
TYPES
0-based type names of geometries, subtract 1 from type code to get index in this array.
-
Constructor Summary
Constructors Modifier Constructor Description private
GeoJsonUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]
ewkbToGeoJson(byte[] ewkb, int dimensionSystem)
Converts EWKB with known dimension system to GeoJson.static byte[]
geoJsonToEwkb(byte[] json, int srid)
Converts EWKB with known dimension system to GeoJson.private static void
parse(JSONObject o, GeometryUtils.Target target, int type)
private static void
parse(JSONValue v, GeometryUtils.Target target)
private static void
parseCoordinate(JSONValue v, GeometryUtils.Target target, int index, int total)
private static void
parseGeometryCollection(JSONObject o, GeometryUtils.Target target)
private static void
parseLineString(JSONArray a, GeometryUtils.Target target)
private static void
parsePolygon(JSONArray a, GeometryUtils.Target target)
private static void
parseRing(JSONValue[] points, GeometryUtils.Target target)
private static double
readCoordinate(JSONValue[] values, int index)
-
-
-
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 formatdimensionSystem
- 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 formatsrid
- the SRID of geometry- Returns:
- GeoJson representation of the specified geometry
- Throws:
DbException
- on unsupported dimension system
-
parse
private static void parse(JSONValue v, GeometryUtils.Target target)
-
parse
private static void parse(JSONObject o, GeometryUtils.Target target, int type)
-
parseGeometryCollection
private static void parseGeometryCollection(JSONObject o, GeometryUtils.Target target)
-
parseLineString
private static void parseLineString(JSONArray a, GeometryUtils.Target target)
-
parsePolygon
private static void parsePolygon(JSONArray a, GeometryUtils.Target target)
-
parseRing
private static void parseRing(JSONValue[] points, GeometryUtils.Target target)
-
parseCoordinate
private static void parseCoordinate(JSONValue v, GeometryUtils.Target target, int index, int total)
-
readCoordinate
private static double readCoordinate(JSONValue[] values, int index)
-
-