How to use the geomet.InvalidGeoJSONException 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 ADEQUATeDQ / portalmonitor / odpw / core / dataset_converter.py View on Github external
if spatial_text:
                g.add((spatial_ref, SKOS.prefLabel, Literal(spatial_text)))

            if spatial_geom:
                # GeoJSON
                g.add((spatial_ref,
                       LOCN.geometry,
                       Literal(spatial_geom, datatype=GEOJSON_IMT)))
                # WKT, because GeoDCAT-AP says so
                try:
                    g.add((spatial_ref,
                           LOCN.geometry,
                           Literal(wkt.dumps(json.loads(spatial_geom),
                                             decimals=4),
                                   datatype=GSP.wktLiteral)))
                except (TypeError, ValueError, InvalidGeoJSONException):
                    pass

        # License
        license_id = self._get_dataset_value(dataset_dict, 'license_id', default='')
        license_url = self._get_dataset_value(dataset_dict, 'license_url', default='')
        license_title = self._get_dataset_value(dataset_dict, 'license_title', default='')
        license = None
        if license_id or license_url or license_title:
            if license_url and bool(urlparse.urlparse(license_url).netloc):
                license = URIRef(license_url)
            else:
                id_string = dataset_ref.n3() + DCT.license.n3() + license_id + license_url + license_title
                bnode_hash = hashlib.sha1(id_string.encode('utf-8'))
                license = BNode(bnode_hash.hexdigest())
                # maybe a non-valid url
                if license_url:
github ADEQUATeDQ / portalmonitor / odpw / utils / dataset_converter.py View on Github external
if spatial_text:
                g.add((spatial_ref, SKOS.prefLabel, Literal(spatial_text)))

            if spatial_geom:
                # GeoJSON
                g.add((spatial_ref,
                       LOCN.geometry,
                       Literal(spatial_geom, datatype=GEOJSON_IMT)))
                # WKT, because GeoDCAT-AP says so
                try:
                    g.add((spatial_ref,
                           LOCN.geometry,
                           Literal(wkt.dumps(json.loads(spatial_geom),
                                             decimals=4),
                                   datatype=GSP.wktLiteral)))
                except (TypeError, ValueError, InvalidGeoJSONException):
                    pass

        # License
        license_id = self._get_dataset_value(dataset_dict, 'license_id')
        license_url = self._get_dataset_value(dataset_dict, 'license_url')
        license_title = self._get_dataset_value(dataset_dict, 'license_title')
        license = None
        if license_id or license_url or license_title:
            if license_url and bool(urlparse.urlparse(license_url).netloc):
                license = URIRef(license_url)
            else:
                license = BNode()
                # maybe a non-valid url
                if license_url:
                    g.add((license, RDFS.comment, Literal(license_url)))

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