How to use the geomet.wkb.dumps function in geomet

To help you get started, we’ve selected a few geomet examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github achapkowski / pygeopackage / src / geopackage / _geopackage.py View on Github external
:returns: Boolean

        """
        if _HASGEOMET == False and geom_format.lower() in ['wkt', 'geojson']:
            raise ValueError(("The package `geomet` is required to work with "
                              "WKT and GeoJSON. Run `pip install geomet` to install."))
        if isinstance(row, _Row):
            row = row._values
        values = None
        flds = {fld.lower(): fld for fld in row.keys()}
        if 'shape' in flds:
            if isinstance(row[flds['shape']], dict) and geom_format.lower() == "esrijson":
                row[flds['shape']] = self._gpheader + dumps(row[flds['shape']], False)
            elif isinstance(row[flds['shape']], dict) and geom_format.lower() == "geojson":
                row[flds['shape']] = self._gpheader + geometwkb.dumps(obj=row[flds['shape']])
            elif isinstance(row[flds['shape']], str) and geom_format.lower() == "wkt":
                gj = geometwkt.loads(row[flds['shape']])
                row[flds['shape']] = self._gpheader + geometwkb.dumps(obj=gj)
            elif isinstance(row[flds['shape']], (bytes, bytearray)):
                if isinstance(row[flds['shape']], (bytearray)):
                    row[flds['shape']] = bytes(row[flds['shape']])
                if len(row[flds['shape']]) > 2 and \
                   row[flds['shape']][:2] != b'GB':
                    row[flds['shape']] = self._gpheader + row[flds['shape']]
            elif row[flds['shape']] is None:
                row[flds['shape']] = self._gpheader + b'0x000000000000f87f'
            else:
                raise ValueError(("Shape column must be Esri JSON dictionary, "
                                  "WKT, GeoJSON dictionary, or WKB (bytes)"))
        if isinstance(row, dict):
            keys = row.keys()

geomet

Pure Python conversion library for common geospatial data formats

Apache-2.0
Latest version published 10 months ago

Package Health Score

74 / 100
Full package analysis