Esempio n. 1
0
    def to_bytes(cls, geom: BaseGeometry) -> List[int]:
        geom_name = str(geom.__class__.__name__).lower()

        try:
            appr_parser = cls.parsers[geom_name]
        except KeyError:
            raise KeyError(f"Parser for geometry {geom_name}")
        return appr_parser.serialize(geom, BinaryBuffer())
Esempio n. 2
0
 def to_bytes(self):
     from geo_pyspark.utils.binary_parser import BinaryBuffer
     bin_buffer = BinaryBuffer()
     bin_buffer.put_double(self.minx)
     bin_buffer.put_double(self.maxx)
     bin_buffer.put_double(self.miny)
     bin_buffer.put_double(self.maxy)
     return bin_buffer.byte_array
Esempio n. 3
0
    def to_bytes(cls, geom: BaseGeometry) -> List[int]:
        from geo_pyspark.sql.types import GeometryType
        geom_name = str(geom.__class__.__name__).lower()

        try:
            appr_parser = PARSERS[geom_name]
            geom.__UDT__ = GeometryType()
        except KeyError:
            raise KeyError(f"Parser for geometry {geom_name} is not available")
        return appr_parser.serialize(geom, BinaryBuffer())