How to use the geomet.wkb 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
def _update(self):
        """updates the current row"""
        txts = []
        values = []
        for k,v in self._values.items():
            if k.lower() != "objectid" and \
               k.lower() != 'shape':
                txts.append("%s=?" % k)
                values.append(v)
            elif k.lower() == 'shape':
                if isinstance(v, dict) and "coordinates" not in v:
                    v = self._header + dumps(v, False)
                elif isinstance(v, dict) and "coordinates" in v:
                    v = self._gpheader + geometwkb.dumps(obj=v)
                elif isinstance(v, str):
                    gj = geometwkt.loads(v)
                    v = self._gpheader + geometwkb.dumps(obj=gj)
                elif isinstance(v, (bytes, bytearray)):
                    if isinstance(v, (bytearray)):
                        v = bytes(v)
                    if len(v) > 2 and \
                       v[:2] != b'GB':
                        v = self._gpheader + v
                elif v is None:
                    v = self._gpheader + b'0x000000000000f87f'
                else:
                    raise ValueError(("Shape column must be Esri JSON dictionary, "
                                      "WKT, GeoJSON dictionary, or WKB (bytes)"))
                txts.append("%s=?" % k)
                values.append(v)
github achapkowski / pygeopackage / src / geopackage / _geopackage.py View on Github external
"""updates the current row"""
        txts = []
        values = []
        for k,v in self._values.items():
            if k.lower() != "objectid" and \
               k.lower() != 'shape':
                txts.append("%s=?" % k)
                values.append(v)
            elif k.lower() == 'shape':
                if isinstance(v, dict) and "coordinates" not in v:
                    v = self._header + dumps(v, False)
                elif isinstance(v, dict) and "coordinates" in v:
                    v = self._gpheader + geometwkb.dumps(obj=v)
                elif isinstance(v, str):
                    gj = geometwkt.loads(v)
                    v = self._gpheader + geometwkb.dumps(obj=gj)
                elif isinstance(v, (bytes, bytearray)):
                    if isinstance(v, (bytearray)):
                        v = bytes(v)
                    if len(v) > 2 and \
                       v[:2] != b'GB':
                        v = self._gpheader + v
                elif v is None:
                    v = self._gpheader + b'0x000000000000f87f'
                else:
                    raise ValueError(("Shape column must be Esri JSON dictionary, "
                                      "WKT, GeoJSON dictionary, or WKB (bytes)"))
                txts.append("%s=?" % k)
                values.append(v)
        sql = '''UPDATE {table} SET {values} WHERE OBJECTID={oid}'''.format(
            table=self._table_name,
            values=",".join(txts),

geomet

Pure Python conversion library for common geospatial data formats

Apache-2.0
Latest version published 1 year ago

Package Health Score

67 / 100
Full package analysis