i have geometri s2 id level 14 :3344456192620494848 i want to convert it to polygon like this format : POLYGON((105.77741241455078 -5.778056992974798, 105.77741241455078 -5.77633413305314, 105.77474160766602 -5.77633413305314, 105.77474160766602 -5.778056992974798, 105.77741241455078 -5.778056992974798))
anyone can help?
query in google bigquery
You'll typically use S2 JavaScript port wrapped in BigQuery UDF.
Take a look at a few functions doing similar stuff:
Carto's UDF that converts long/lat pair + level to S2 cell boundary
jslibs.s2.latLngToCornerLatLngs
My
gislib.s2.s2CellIdToLatLng
that converts cellid taken as string, basically s2 uint64 cellid reinterpreted as signed int64 - same way as used by BigQuery S2_ functions. Note that integer s2 cellid already contains its level encoded, so the function does not take level argument.You can click button 'Edit persisted function' and see how it is done, even if you don't have permissions to actually edit it.