This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Latitude and longitude decimal values are bounded by ±90° and ±180° respectively. | |
* This will match only that bound, accepting common uses of commas, points, spaces, | |
* tabs and degree symbols, returning a clean, standardized latitude and longitude array. | |
* @returns [{number}, {number}] Latitude and longitude | |
*/ | |
const parseDecimalLatLon = string => { | |
let isDecimal = /^([-+]?(?:[1-8]?\d(?:(?:.|,){1}\d+)?|90(?:\.0+)?))°?(?:,|;|\t| )+([-+]?(?:180(?:\.0+)?|(?:(?:1[0-7]\d)|(?:[1-9]?\d))(?:(?:\.|\,){1}\d+)?))°?$/ | |
let match = string.match(isDecimal); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const SHEET_NAME = '+para_DB'; | |
const TARGET_COLUMN_NAME = 'categoria'; | |
const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName( SHEET_NAME ); | |
const data = sheet.getDataRange().getValues(); | |
let column = data[0].indexOf(TARGET_COLUMN_NAME); | |
// Transform comma separated strings cell values to PostgresSQL arrays | |
function transformDataToArray() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT json_build_object( | |
'type', 'FeatureCollection', | |
'crs', json_build_object( | |
'type', 'name', | |
'properties', json_build_object( | |
'name', 'EPSG:4326' | |
) | |
), | |
'features', json_agg(ST_AsGeoJSON(t.*)::json) | |
) |