On the off chance it is of use to others. Here is my naively written SQL to add thousands of linked images with a folder to a map: -- Folder containing linked images VALUE @FOLDER NVARCHAR = '1 SOURCE\\LINKED\'; -- --------------------------------------------------------------------------------------------------------------------------- VALUE @QRY1 NVARCHAR = ' CREATE MAP [MAP LINKED] ( PROPERTY \'CoordSystem\' \'EPSG:2193,mfd:{ "Axes": "XY" }\', <QRY> ); '; -- --------------------------------------------------------------------------------------------------------------------------- -- Cleanup DROP MAP [MAP LINKED]; DROP TABLE [TMP]; DROP QUERY [Q1]; SELECT '[' + [NAME] + ']::[' + [NAME] + ']' AS [SRC] INTO [TMP] FROM [mfd_meta] WHERE [PROPERTY] = 'Folder' AND [VALUE] = @FOLDER; ALTER TABLE [TMP] ( ADD [mfd_id] INT64, ADD INDEX [mfd_id_x] BTREE ([mfd_id]) ); -- Build empty query component CREATE QUERY [Q1] ( PROPERTY 'Text' '<TEMPLATE>' ); -- Build Query UPDATE [mfd_meta] SET [VALUE] = ( SELECT StringReverse(StringReplaceNth(StringReverse([STR]), ',', '', 0)) AS [STR] FROM ( SELECT StringReplace(@QRY1, '<QRY>', StringJoinTokens('PROPERTY \'Item.' + CAST([mfd_id] AS NVARCHAR) + '\' \'{ "Entity": "' + [SRC] + '", "Z": ' + CAST([mfd_id] AS NVARCHAR) + ' }\',', CRLF) ) AS [STR] FROM [TMP] ) ) WHERE [NAME] = 'Q1' AND [PROPERTY] = 'Text'; -- Run the insert EXECUTE [Q1]; -- Cleanup DROP TABLE [TMP]; DROP QUERY [Q1];
Landsystems Ltd ... Know your land | www.landsystems.co.nz |