D 2017-09-13T06:17:17.424 J foundin development J icomment Goal\sof\sthe\snew\stool\swould\sbe:
\r\n\r\n
\r\nPreconditions:
\r\n\r\n
\r\nInput\sParameters:

\r\nFor\sboth\sSource\sand\sDem\r\n\r\n
Optional\sParameter:
\r\n\r\n
\r\nCommands:
\r\n\r\n
\r\n\r\n
\r\nretrieve_dem_points:
\r\nis\scalled\sduring\sgaiaUpdateZ\s(4\stimes,\swhen\sneeded)\sto\sretrieve\sthe\snearest\spoint\sfrom\sa\ssent\sarray\sof\sx/y\spoints\r\n\r\nA\squery\sis\scalled\sto\sthe\sATTACHed\sDatabase,\susing\sthe\sSpatialIndex
\r\n\r\nChecking\sis\sdone\sif\sthe\sreturned\sz\s(or\spossibly,\syet\sunlikely,\sa\sm)\svalue\sis\sdifferent\sfrom\sthe\ssent\svalue.
\r\nCounters\sexist\sin\sall\sfunctions\sto\sinsure\sthat\supdate\swill\sonly\sbe\sdone\swhen\sneeded\r\n\r\n
\r\nAt\spresent\sthe\s'Help'\slooks\slike\sthis:
\r\n
\r\nusage:\sspatialite_updatez\sARGLIST\r\n==============================================================\r\n-h\sor\s--help\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sprint\sthis\shelp\smessage\r\n==========================\sParameters\s========================\r\n\s\s--\s--\s----------------\sDem-Data\sDatabase\s----------------\s--\r\n-ddem\sor\s--dem-path\s\spathname\sto\sthe\sSpatiaLite\sDem\sDB\s\r\n-tdem\sor\s--table-dem\stable_name\s[SpatialTable\sor\sSpatialView]\r\n-gdem\sor\s--geometry-dem-column\scol_name\sthe\sGeometry\scolumn\r\n\t\smust\sbe\sa\sPOINT\sZ\sor\sa\sPOINT\sZM\stype\r\n-rdem\sor\s--dem-resolution\sof\sthe\sdem\spoints\swhile\ssearching\r\n\t\sthe\sautomatic\sresolution\scalculation\sis\sbased\son\sthe\srow_count\r\n\t\swithin\sthe\sextent,\swhich\smay\snot\sbe\scorrect!\r\n\t\sUse\s'-rdem'\sto\sset\sa\srealistic\svalue\r\n\r\n\s\s--\s--\s-----------------\sSource\sDatabase\s-----------------\s--\r\n-d\sor\s--db-path\spathname\sto\sthe\sSpatiaLite\sDB\r\n-t\sor\s--table\stable_name,\s\smust\sbe\sa\sSpatialTable\r\n-g\sor\s--geometry-column\sthe\sGeometry\scolumn\sto\supdate\r\n\t\smust\s\sbe\sa\sZ\sor\sa\sZM\sDimension\stype\r\n\t\suse\sCastToXYZ(geom)\sor\sCastToXYZM(geom)\sto\sconvert\s\r\n\s\s--\s--\s---------------\sGeneral\sParameters\s----------------\s--\r\n-mdem\sor\s--copy-m\s[0=no,\s1=\syes\s[default]\sif\sexists]\r\n\r\n\s\s--\s--\s--------------------\sNotes:\s\s----------------------\s--\r\n-I->\sthe\sZ\svalue\swill\sbe\scopied\sfrom\sthe\snearest\spoint\sfound\r\n-I->\sthe\sSrid\sof\sthe\ssource\sGeometry\sand\sthe\sDem-POINT\scan\sbe\sdifferent\r\n\r\n===========================\sCommands\s===========================\r\n-sniff\s\s\s[default]\sanalyse\ssettings\swithout\sUPDATE\sof\sz-values\s\r\n-update\sPerform\sUPDATE\sof\sz-values\s\r\n
\r\n
\r\nTests:
\r\n\r\n
\r\nberlin_dhh92.db
\r\nWas\sbuild\sfrom\s279\s.xyz\sfiles\sand\scombined\sand\ssorted,
\seach\scontaining\s4000.000\srecords\s(1.116\sbillion)\r\n\r\nWas\sthe\simported\sinto\sa\ssqlite3\sDatabase\r\n
\r\n.mode\scsv\r\n.separator\s"\s"\r\n.import\s2007.berlin.dhh92.xyz\sberlin_dhh92_import\r\n
\r\nA\sSpatialite\sscript\screated\sa\scopy,\spreparing\s2\sGeometries.
\r\nAs\sof\sdate\sonly\s114\smillion\sgeometries,\scovering\san\sarea\sof\s12*12\sKm\shave\sbeen\screated.
\r\n
\r\nberlin_street_segments\r\n\r\n
\r\nSQLite\sversion:\s3.17.0\r\nSpatiaLite\sversion:\s4.5.0-devel\r\n\r\nSource:\ssrid\s3068\r\nSource:\sextent\smin\sx/y(3584.6332144,1452.2834924)\r\n\t\s\s\s\s\s\s\smix\sx/y(48941.5043681,37058.9517384)\r\nSource:\srows_count(soldner_segment)\s42720\r\nSource:\sgeometry_type(1002)\shas_z[1]\r\nSource:\sspatial_index_enabled[1]\r\nSource\s'berlin_admin_geometries.db'\r\nwill\sconvert\sTABLE[berlin_street_segments]\swith\sGEOMETRY-Column[soldner_segment]\sZ-Value\r\n\tfrom\snearest\sPOINT\sfound\sin\r\nSource\sDatabase:\shas\spassed\sall\schecks.\r\n\r\nDem:\ssrid\s25833\r\nDem:\sextent\smin\sx/y(385000.0000000,5814000.0000000)\r\n\t\s\s\s\smax\sx/y(397000.0000000,5826000.0000000)\r\nDem:\srows_count(utm_point)\s1116000000\r\nDem:\sresolution(utm_point)\s0.1290323\r\nDem:\sgeometry_type(1001)\shas_z[1]\r\nDem:\sspatial_index_enabled[1]\r\nSource\s'berlin_admin_geometries.db'\r\nwill\sconvert\sTABLE[berlin_street_segments]\sor\sGEOMETRY-Column[soldner_segment]\sZ-Value\r\n\tfrom\snearest\sPOINT\sfound\sin\r\nDem\s'berlin_dhh92.db'\r\n\sTABLE[berlin_dhh92_2007]\swith\sGEOMETRY-Column[utm_point]\r\n-W->\s-rdem\swas\s\sset.\sUsing;\sresolution(0.9990000),\soverriding\sthe\scalculated\svalue:\s0.1290323\r\nDem\ssrid[25833]:\sis\sdifferent\sfrom\sthe\sSource\ssrid[3068].\r\n\t\sWhen\ssearching\sfor\sthe\snearest\spoint,\sthe\sSource\spoints\swill\sbe\stransformed\sto\ssrid[25833].\r\nDem\sDatabase:\shas\spassed\sall\schecks.\r\n\tDB-file\ssuccessfully\sconverted\s!!!\r\n\r\n-I->\sgeometries\stotal[42716]\schanged[11808]\s;\spoints\stotal[41010]\schanged\sz[41010]\schanged\sm[0]\r\n
\r\n\r\nWhich\stook\sabout\s30\sminutes\sto\scomplete.

\r\nThe\sresults\sshow:\sthat\sof\sthe\s42716\sgeometries,\s11808\swere\supdated\scontaining\s41010\spoints\s-\sall\sof\swhich\swere\supdated.

\r\nA\ssample\sLINESTRING\sthat\swas\supdated:\r\n
\r\nSRID=3068;LINESTRING(24910.98653436587\s21463.5093835775\s35.39999999999999,24948.09927146823\s21394.95263390163\s35.60999999999999)\r\n
\r\n\r\nshows\scorrect\sresults.\r\n

\r\nA\ssecond\srun\stook\sabout\s2\sminutes:\r\n
\r\n-I->\sgeometries\stotal[42716]\schanged[0]\s;\spoints\stotal[41010]\schanged\sz[0]\schanged\sm[0]\r\n
\r\n\r\nshowing\sthat\sno\supdates\swere\smade,\ssince\snothing\shas\schanged.

\r\nAlthough\snot\syet\stested,\sit\sshould\smean\sthat\sif\snew\spoints\sare\sadded\sthat\smay\snot\scontain\sreliable\sresults\r\n\r\n
\r\nConclusion:
\r\nTo\screate\san\sSQL-Command\sfor\sthe\ssame\stask\sis\sunrealistic,\ssince\sit\swould\sbe\svery\stime\sconsuming.

\r\nSo\sadding\sthis\sas\sa\snew\stool\swould\sbe\sjustified.

\r\nIt\scould\salso\sbe\sadapted\swith\sa\s-retrieve\sor\s-fetch\scommand,\r\n
\r\nConsidering\sthe\ssize\sof\sthese\sDatabases,\sa\ssemi-automated\suse\sof\sthem,\swould\sbe\sa\suseful\sextra\stool. J login anonymous J mimetype text/html J private_contact a3ab3a740c17d1a955665bbfeda76d4f8b6739bf J severity Minor J status Open J title Concept\snew\stoll\s'spatialite_updatez' J type Feature_Request K 3743a244cf30c0e424e660af3034bbfbdd4febac U anonymous Z a009f44852c8e5ff6c2657324a08a0b9