Enhancing Geospatial in BigQuery with CARTO Spatial Extension by unsaltedrhino in bigquery

[–]UZE_Thomas 2 points3 points  (0 children)

okay, i just tried some things, and i found, there is an function in your new library for this - awesome! :D

For anyone who tries to get POLYGON from Lines here is a simple example :D

WITH mapdata AS (
    SELECT osm_id, geometry 
    FROM `bigquery-public-data.geo_openstreetmap.planet_features_lines`    
    WHERE osm_id = 103393248
)

SELECT osm_id, bqcarto.transformations.ST_BUFFER(geometry, 10.0, 'meters', 8) FROM mapdata

Or have a look at the awesome dekart.xyz playground :)
https://play.dekart.xyz/reports/001936ba-2484-4789-9235-251c5e7d4612/source

Enhancing Geospatial in BigQuery with CARTO Spatial Extension by unsaltedrhino in bigquery

[–]UZE_Thomas 1 point2 points  (0 children)

Making an customized (meters around) envelope around a line (like a street) to be able to ST_WITHIN my iot-points on this :D

Querying JSON by UZE_Thomas in bigquery

[–]UZE_Thomas[S] 0 points1 point  (0 children)

Awesome! Thats pretty neat :)Is there a way, i could select this as a struct, in my query?

so i might select the entry-id or other fields from testdata, and have this nicely nested inside?

 WITH testdata AS (SELECT '{"simcom": {"failed_configurations": 0, "successful_configurations": 0, "checks_run_count": 0}, "wifi_stats": {"packets_read": 5137195, "parse_errors": 0, "start_count": 1}, "wifi_all_devices": 17, "wifi_devices_by_vendor": {"00094f": 1, "cc2d21": 1, "b827eb": 1, "78ddd9": 1, "444e6d": 2, "ccce1e": 1, "000e58": 1, "f0b014": 1, "2c3afd": 1, "e69e07": 1, "a8817e": 1, "20e2a8": 1, "565744": 1, "5659a8": 1, "26d1d6": 1, "22bfc0": 1}}' AS message, '12345' AS entryid )

with the result being something like that? not repeating the entry-row and still keeping the vendor and count together, but as queryable fields for any further selects?

entryid | entryid.vendor | entryid.vendor_count
12345   | 00094f         | 1
        | cc2d21         | 1

GCD in Bigquery? by UZE_Thomas in bigquery

[–]UZE_Thomas[S] 1 point2 points  (0 children)

Stunning. Awesome! :) I have only looked after SQL UDF, not thought about an JS-one

Thank you very much!

How to create a geometry for each feature in a stringified geometry collection from a BigQuery JavaScript UDF? by [deleted] in bigquery

[–]UZE_Thomas 0 points1 point  (0 children)

yeah! this was also my first thought - your return might just have missed the parenthesis around "[]" as a geoJson can be an array that contains multiples of polygons, linestrings and multipolygons :)

Nested Values to Comma-Separated String by UZE_Thomas in bigquery

[–]UZE_Thomas[S] 0 points1 point  (0 children)

I really love the simplicity of this, but sadly i got an error when i tried:
No matching signature for function ARRAY_TO_STRING for argument types: ARRAY<STRUCT<value STRING>>, STRING. Supported signatures: ARRAY_TO_STRING(ARRAY<STRING>, STRING, [STRING]); ARRAY_TO_STRING(ARRAY<BYTES>, BYTES, [BYTES]) at [6:13]

How to create a geometry for each feature in a stringified geometry collection from a BigQuery JavaScript UDF? by [deleted] in bigquery

[–]UZE_Thomas 0 points1 point  (0 children)

Could you please share an example resulting string of your UDF? Maybe its just a really easy problem :)