Class ShapeSerde


  • public class ShapeSerde
    extends Object
    Provides methods to efficiently serialize and deserialize geometry types using shapefile format developed by ESRI. Does not serialize user data attached to the geometry.

    Supports Point, LineString, Polygon, MultiPoint, MultiLineString and MultiPolygon types.

    Compatible with the family of ShapeReader classes.

    First byte contains ShapeType.id. The rest is type specific. Point: 8 bytes for X coordinate, followed by 8 bytes for Y coordinate. LineString is serialized as MultiLineString. MultiLineString: 16 bytes for envelope, 4 bytes for the number of line strings, 4 bytes for total number of vertices, 16 * num-vertices for XY coordinates of all the vertices. Polygons are serialized as MultiPolygon. MultiPolygon: 16 bytes for envelope, 4 bytes for the total number of exterior and interior rings of all polygons, 4 bytes for total number of vertices, 16 * num-vertices for XY coordinates of all the vertices. The vertices are written one polygon at a time, exterior ring first, followed by interior rings.

    • Constructor Detail

      • ShapeSerde

        public ShapeSerde()
    • Method Detail

      • serialize

        public static byte[] serialize​(org.locationtech.jts.geom.Geometry geometry)
      • deserialize

        public static org.locationtech.jts.geom.Geometry deserialize​(com.esotericsoftware.kryo.io.Input input,
                                                                     org.locationtech.jts.geom.GeometryFactory factory)
      • deserialize

        public static org.locationtech.jts.geom.Geometry deserialize​(byte[] input,
                                                                     org.locationtech.jts.geom.GeometryFactory factory)