<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Breitsch on Medium]]></title>
        <description><![CDATA[Stories by Breitsch on Medium]]></description>
        <link>https://medium.com/@breitsch2?source=rss-2218ff386d6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*jcKCe_2ifveaZloC</url>
            <title>Stories by Breitsch on Medium</title>
            <link>https://medium.com/@breitsch2?source=rss-2218ff386d6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 20:42:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@breitsch2/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[From Bayes Theorem to Confusion Matrix]]></title>
            <link>https://medium.com/@breitsch2/from-bayes-theorem-to-confusion-matrix-c2f5a790a3d1?source=rss-2218ff386d6------2</link>
            <guid isPermaLink="false">https://medium.com/p/c2f5a790a3d1</guid>
            <category><![CDATA[bayesian-statistics]]></category>
            <category><![CDATA[bayesian-machine-learning]]></category>
            <dc:creator><![CDATA[Breitsch]]></dc:creator>
            <pubDate>Tue, 29 Sep 2026 15:46:45 GMT</pubDate>
            <atom:updated>2026-11-19T15:26:10.522Z</atom:updated>
            <content:encoded><![CDATA[<p>A <strong>confusion matrix</strong> supplies empirical counts of errors, while Bayes’ theorem explains how those error rates and the class prevalence determine the probability that a positive prediction is actually correct. But there is a transformation from Bayes to CM and vice versa.</p><p>The study has 7 parts (Tutorial 199 of maXbox Starter Series):</p><ol><li>Confusion Matrix</li><li>Where Bayes enters</li><li>Numerical Example (PoC)</li><li>Important Distinction</li><li>Explainer Video</li><li>Source Code Demo (Interactive maXbox Java Script)</li><li>Conclusion and Short History</li></ol><p>The key distinction is:</p><ul><li><strong>False-positive rate</strong>: “Among truly negative cases, how many were incorrectly flagged?”</li><li><strong>Precision / positive predictive value</strong>: “Among all cases flagged positive, how many are real truly positive?”</li></ul><p>These are not the same quantity.</p><p>Confusion Matrix Fundamental Metrics and Definitions</p><p>To understand this connection, it is critical to distinguish between metrics that evaluate negative cases versus metrics that evaluate flagged cases:</p><ul><li><strong>False-Positive Rate (FPR):</strong> Answers the question, <em>“Among truly negative cases, how many were incorrectly flagged?”</em></li><li><strong>Precision / Positive Predictive Value (PPV):</strong> Answers the question, <em>“Among all cases flagged positive, how many are actually true positives?”</em></li><li><strong>Recall / True Positive Rate (TPR):</strong> Answers the question, <em>“Among all actual positive cases, how many were correctly identified?”</em></li><li><strong>Prevalence:</strong> The baseline proportion of positive cases within the total population.</li></ul><p>For a binary classifier:</p><p>The standard metrics are true positive rate, false positive rate and precision:</p><p>Precision=PPV=TP/(FP+TP​).</p><p>A confusion matrix records these counts directly; for scikit-learn’s binary convention, false positives are actual class 0 predicted as class 1.[ <a href="https://scikit-learn.org/stable/modules/generated/sklearn.metrics.confusion_matrix.html">scikit-learn</a>]</p><p>Where Bayes enters</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/0*Lr6rdxQFNSC89swB" /></figure><p>Substituting the confusion-matrix quantities:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/0*_rqsLDzCRlp32VXW" /></figure><p>This is the direct connection. Precision is the Bayesian posterior probability of a real positive after observing a positive prediction.</p><p>Numerical example</p><p>Suppose an object detector has:</p><ul><li>False-positive rate = 0.05</li><li>Positive prevalence = 0.01, meaning only 1% of image regions really contain the object.</li></ul><p>Then for Bayes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/0*UsB9tARdLFLKs236" /></figure><p>So the precision is only about <strong>15.4%</strong>, despite a respectable 90% recall and only 5% false-positive rate.</p><p>For 10,000 tested regions:</p><p>Therefore:</p><p><strong>Precision=90/(495+90)​=15.4%.</strong></p><p>The detector generates many more false alarms than correct detections because negative cases vastly outnumber positive ones. This prevalence effect is why precision is sensitive to class imbalance, whereas FPR is normalized only by the number of actual negatives.[ <a href="https://scikit-learn.org/stable/auto_examples/model_selection/plot_precision_recall.html">scikit-learn</a>][ <a href="https://www.cloudspress.com/confusion-matrix-in-machine-learning-tp-fp-fn-tn-metrics-and-examples/">cloudspress</a>]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/901/0*uclH0b67rSZU6Utt" /></figure><p>Why false positives matter so much</p><p>A small FPR can produce many false positives when the negative population is large.</p><p>For an object detector searching for a rare object-say a railway signal in a large aerial image-even an FPR of 0.1% may cause numerous false detections if millions of candidate regions are examined.</p><p>That creates two different operational questions:</p><ul><li><strong>FPR</strong>: How often does the detector falsely flag a truly negative location?</li><li><strong>Precision</strong>: When the detector flags a location, how often is the alert correct?</li></ul><p>For an operator reviewing alerts, precision is usually the more intuitive measure. For comparing discrimination across thresholds and datasets, ROC analysis uses TPR versus FPR. For rare-object detection, precision-recall curves are often more informative because they show the effect of prevalence and false discoveries.[ <a href="https://www.cloudspress.com/confusion-matrix-in-machine-learning-tp-fp-fn-tn-metrics-and-examples/">cloudspress</a>][ <a href="https://lucdemortier.github.io/articles/16/PerformanceMetrics">lucdemortier.github</a>]</p><p>Relation to your correlated-object model</p><p>Suppose a local detector proposes a weak fence:</p><p>A nearby car is then used as contextual evidence. The contextual model should estimate something like:</p><p>After applying the context, perhaps the score becomes 0.72. That value is a <strong>model score or posterior-like probability</strong>, not automatically a measured precision.</p><p>To verify whether 0.72 is meaningful, evaluate the final context-aware detector on labelled data and build a new confusion matrix. The contextual algorithm may:</p><ul><li>convert some previous false negatives into true positives;</li><li>convert some previous false positives into true positives;</li><li>or create new false positives if the correlation rule is too strong.</li></ul><p>Thus, you need separate confusion matrices for:</p><ol><li>The local detector alone.</li><li>The detector after correlated-object rescoring.</li></ol><p>Then compare:</p><p>ΔTP,ΔFP,ΔFN,ΔTN,</p><p>as well as precision, recall, FPR, and calibration.</p><p>Important distinction</p><p>A detector’s internal Bayesian or softmax probability and its empirical confusion-matrix precision are different:</p><p>P(\text{true object}\mid\text{image and context})</p><p>is the model’s posterior estimate, while</p><p>is the observed fraction of correct positive predictions on a particular labelled evaluation set.</p><p>They coincide only approximately if:</p><ul><li>the probability is well calibrated;</li><li>the evaluation data has the same prevalence as the deployment data;</li><li>the threshold and object-matching rules are identical;</li><li>the test data represents real operating conditions.</li></ul><p>Conclusion <strong>So, in one straight sentence:</strong></p><blockquote><em>The confusion matrix measures false positives directly; Bayes’ theorem converts the false-positive rate, recall, and prevalence into the </em><strong><em>posterior probability</em></strong><em> that a positive prediction is genuine-namely called </em><strong><em>precision</em></strong><em> of confusion matrix!</em></blockquote><ul><li>At 0.01 prevalence, even 90% sensitivity + 95% specificity<br>yields only ~15% precision.</li><li>Raising specificity (lowering FPR) is far more effective<br>than raising sensitivity when the positive class is rare.</li><li>This is the Bayesian reason why threshold tuning and<br>false-positive minimization matter in imbalanced detection.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/0*ZTAW0gkE_-k8AALF" /></figure><blockquote><em>The infographic visually maps the mathematical connection between Bayes’ Theorem and the confusion matrix, illustrating how recall, false positive rate (FPR), and class prevalence combine to calculate precision. It highlights the numerical example demonstrating how a low class prevalence (1%) leads to a precision of 15.4% despite a 90% recall and a low 5% FPR.</em></blockquote><blockquote><em>Max Kleiner, 29/09/2026</em></blockquote><p>Explainer Video</p><p>The video will synthesize the key mathematical concepts, error metrics, and probability calculations.</p><p>Source Code Demo</p><p>Here <strong>is</strong> a self-contained maXbox <strong>program</strong> that demonstrates how <strong>class</strong> imbalance destroys <br>precision, using the Bayesian relationship we discussed. It computes precision from sensitivity, <br>specificity, <strong>and</strong> prevalence, <strong>then</strong> simulates a confusion matrix at different prevalence levels so you <br>can see the effect numerically.</p><p><a href="https://sourceforge.net/projects/maxbox5/files/examples/1499_bayes_confusionmatrix1.txt/download">https://sourceforge.net/projects/maxbox5/files/examples/1499_bayes_confusionmatrix1.txt/download</a></p><p>It <strong>then</strong> simulates a population <strong>of</strong> 10,000 at five prevalence levels — from balanced (50%) down <strong>to</strong> 0.01% — <strong>and</strong> prints the resulting TP, FP, TN, FN counts.</p><p>The <strong>final</strong> section shows that at 1% prevalence, improving specificity from 0.95 <strong>to</strong> 0.9999 raises precision from ~15% <strong>to</strong> ~90%, w <strong>hile</strong> improving sensitivity from 0.90 <strong>to</strong> 0.999 barely moves precision. This <strong>is</strong> the practical consequence <strong>of</strong> the Bayes denominator: <br> when negatives vastly outnumber positives, the false-positive term dominates, <strong>and</strong> only reducing FPR helps.</p><p>Interactive Form Demo App</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/0*2DxtPytwkgyEcaiL" /></figure><p><strong>Script Highlights:</strong></p><ul><li><strong>Bayesian Precision &amp; Confusion Matrix Modeling:</strong> Translates the mathematical bridge connecting Recall, False Positive Rate (FPR), and Class Prevalence into empirical confusion matrix counts ($TP$, $FP$, $TN$, $FN$)12.</li><li><strong>Interactive maXbox GUI:</strong> Provides editable controls (TEdit) for total population, class prevalence ($P(A)$), recall ($TPR$), and false positive rate ($FPR$), outputting detailed step-by-step calculations to a structured log view34.</li><li><strong>The Precision Paradox Visualized:</strong> Demonstrates why a 1% class prevalence yields a precision of only <strong>15.4%</strong> ($90 / (90 + 495)$) despite a 90% recall and a low 5% false positive rate34.</li></ul><p>Interactive Form Demo App V2</p><p>New Features in Version 2:</p><ul><li><strong>Embedded</strong> <strong>TImage</strong> <strong>Canvas Plotter:</strong> Plots a real-time <strong>Precision vs. False Positive Rate (FPR)</strong> curve directly on the right-hand panel of the maXbox form [15].</li><li><strong>Dynamic Operating Point Callout:</strong> Highlights the active FPR and Precision (e.g., <strong>FPR = 5.0%</strong>, <strong>Precision = 15.4%</strong>) with a red coordinate marker and data label [15].</li><li><strong>Prevalence Comparison Curve:</strong> Overlay a reference curve for a higher prevalence (5.0%) alongside the active setting (1.0%), visually illustrating how rare target classes cause precision to drop steeply as FPR increases [15].</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/852/0*Gfj-6mSV5sfoPAPr" /></figure><p>Interactive Form Demo App V2.1</p><p>What was added in Version 2.1:</p><ul><li><strong>Real-Time TrackBar Slider (TrkFPR):</strong> Adds a dynamic slider allowing you to sweep the False Positive Rate continuously from <strong>0.0% to 20.0%</strong> (with 0.1% step resolution).</li><li><strong>Interactive Axis Crosshairs &amp; Moving Dot:</strong> As you drag the slider, red crosshairs trace from the FPR and Precision axes to the red operating point, updating its coordinates on the plot in real time.</li><li><strong>Synchronized Event Handlers:</strong> Editing either the numerical FPR text box or dragging the trackbar automatically syncs both controls and recalculates the confusion matrix and plot without lag.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/0*8JU1QZpSLVW5f5xU" /></figure><p>Web Solution</p><p>This interactive web application translates the mathematical bridge between <strong>Bayes’ Theorem</strong> and the <strong>Confusion Matrix</strong> into a real-time web calculator</p><p><a href="https://raw.githack.com/maxkleiner/maXbox5/main/assets/bayesmatrix.htm">https://raw.githack.com/maxkleiner/maXbox5/main/assets/bayesmatrix.htm</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RXKr9na9O-5ZFjGz" /></figure><p><a href="http://www.softwareschule.ch/examples/machinelearning54.htm">Bayes’ Theorem &amp; Confusion Matrix Studio</a> <a href="http://www.softwareschule.ch/examples/machinelearning53.htm">ML Probability Threshold &amp; Confusion Matrix Simulator</a> Short History</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/995/0*-tFLVjBRW00dg6IK" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/461/0*A_-9JrteMylAvvla" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/791/0*QxwGRhK4fplgM4vQ" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4yaT7cBrTcBPZqWI" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gEgUtIpgvB9xBYhH" /></figure><h3>FP versus FN</h3><p>There is no universal answer-whether a <strong>false positive</strong> (Type I error) or a <strong>false negative</strong> (Type II error) is “worse” depends entirely on the context and the consequences. <a href="https://www.digitalepibook.com/ch2.html">digitalepibook</a></p><p>Key Terms</p><ul><li><strong>False Positive (Type I error):</strong> The test indicates “something is there” when it is not (e.g., an alarm without a fire). <a href="https://blog.minitab.com/en/blog/understanding-statistics/which-statistical-error-is-worse-type-1-or-type-2">blog.minitab</a></li><li><strong>False Negative (Type II error):</strong> The test indicates “nothing is there” when something actually is (e.g., no alarm during an actual fire). <a href="https://blog.minitab.com/en/blog/understanding-statistics/which-statistical-error-is-worse-type-1-or-type-2">blog.minitab</a></li></ul><p>When is one worse than the other?</p><h3>Medicine / Diagnostics</h3><ul><li>For <strong>serious, treatable diseases</strong> (e.g., certain types of cancer), a <strong>false negative is usually worse</strong>: the disease is overlooked, treatment is delayed, and the harm can be significant. <a href="https://www.digitalepibook.com/ch2.html">digitalepibook</a></li><li>For <strong>routine screenings</strong> or cases where follow-up confirmatory tests are performed, a <strong>false positive may be more acceptable</strong>: it causes stress and additional costs but is usually corrected later. <a href="https://www.researchprospect.com/type-1-and-type-2-errors/">researchprospect</a></li></ul><p>Software Testing / CI Pipelines</p><ul><li>A <strong>false negative</strong> (test passes even though a genuine defect exists) is typically considered more dangerous: bugs reach production, customers are affected, and trust and revenue can suffer. <a href="https://www.testmuai.com/blog/false-positive-and-false-negative/">testmuai</a></li><li>A <strong>false positive</strong> (test fails even though everything is fine) primarily consumes developers’ time and patience, but rarely blocks delivery permanently once the false alarm is identified. <a href="https://www.testmuai.com/blog/false-positive-and-false-negative/">testmuai</a></li></ul><p>Law / Security</p><ul><li>In <strong>criminal law</strong>, a <strong>false positive</strong> is often viewed as <strong>worse</strong>: an innocent person is convicted (Type I error), which is why the burden of proof is set high. <a href="https://www.researchprospect.com/type-1-and-type-2-errors/">researchprospect</a></li><li>With <strong>security alarm systems</strong>, both can be problematic:</li><li>Many false positives → “alarm fatigue,” waste of resources.</li><li>False negatives → real danger goes undetected.<br>Which side carries more weight depends on the specific threat situation. <a href="https://www.linkedin.com/posts/drmelvinsanicas_statistics-healthcare-diagnostics-activity-7296449704878362625-cSgF">linkedin</a></li></ul><p>Practical Rule of Thumb</p><p>Instead of asking “Which error is generally worse?”, the more useful question is:</p><blockquote><em>What are the </em><strong><em>costs</em></strong><em> of a false positive versus a false negative in </em>this<em> scenario? This determines whether the test should be set to be more </em><strong><em>sensitive</em></strong><em> (few false negatives, more false positives) or more </em><strong><em>specific</em></strong><em> (few false positives, more false negatives). </em><a href="https://blog.minitab.com/en/blog/understanding-statistics/which-statistical-error-is-worse-type-1-or-type-2"><em>blog.minitab</em></a></blockquote><p>If you tell me what kind of test it is (medical, software test, security, statistics, etc.), I can specifically assess which type of error is typically considered more serious in your case.</p><p>False positives and false negatives are not symmetrical “accuracy mistakes.” They allocate harm differently: one may inconvenience, delay, or wrongly accuse an innocent case; the other may miss a genuinely dangerous case. The right operating threshold is therefore a <strong>policy and safety decision</strong>, not merely a model-accuracy optimization.</p><p>Matrix</p><p>Domain False positive (FP) False negative (FN) Practical asymmetry and cost How thresholds are tuned Catastrophic “wrong-error” lesson</p><p><strong>Medical screening — fatal condition</strong></p><p>A healthy person screens positive for a life-threatening disease</p><p>A person with the disease screens negative</p><p>FN can mean delayed treatment, preventable metastasis, transmission, or death. FP causes anxiety, imaging/biopsy, cost, and sometimes procedure harm-but is usually more reversible than a missed rapidly fatal disease</p><p>Use a <strong>sensitive, low initial threshold</strong> for screening; follow with a more specific confirmatory test. Thresholds vary by age, symptoms, family history, prevalence, and availability of effective early treatment</p><p>In high-risk cancer, lowering sensitivity to avoid unnecessary workups can miss treatable disease. The safety pattern is therefore “screen broadly, confirm carefully,” rather than treating one negative low-sensitivity screen as definitive</p><p><strong>Airport luggage screening</strong></p><p>Harmless luggage alarms: secondary inspection, missed flights, queues, staff workload, passenger frustration</p><p>A bag containing an explosive or weapon passes screening</p><p>FN is potentially mass-casualty aviation terrorism; thus baggage screening normally accepts substantial FPs and secondary-search burden. Yet FPs cannot grow without limit, because overloaded screeners and queues can themselves degrade detection</p><p>Set a conservative detection threshold for explosives; combine machine detection with manual resolution, random screening, trace detection, passenger-bag matching, red-team tests, and measured alarm/detection/throughput requirements. The threshold depends on threat intelligence and consequences, not convenience alone</p><p>Pan Am Flight 103 is the devastating consequence of insufficient baggage-control safeguards: the bomb was in checked baggage, 270 people were killed, and an official investigation cited severe shortcomings in screening and passenger/baggage controls. The inquiry found that an unaccompanied bag should have been rejected or opened and inspected. [ <a href="https://library.syracuse.edu/digital/guides_pa103/pdf/103TUCKER0008.pdf">library.syracuse</a>][ <a href="https://scholar.lib.vt.edu/VA-news/ROA-Times/issues/1991/rt9103/910323/03230052.htm">scholar.lib.vt</a>]</p><p><strong>Financial fraud detection</strong></p><p>Legitimate payment is declined, account frozen, customer must prove identity, merchant loses sale, customer may miss rent, travel, payroll, or urgent purchases</p><p>Fraudulent payment/transfer is approved</p><p>A missed fraud event can create direct loss, chargebacks, mule-network propagation, regulatory exposure, and customer distrust. But FP costs can be acute and unequal: a false decline of a low-value discretionary purchase differs materially from freezing a small business’s operating account</p><p>Tune by expected loss, not raw fraud rate: transaction amount, customer history, merchant/category risk, device/location novelty, velocity, account takeover indicators, and customer-impact sensitivity. Use step-up authentication or a temporary hold for ambiguous cases rather than a hard decline; monitor approval rate, fraud loss, appeals, and vulnerable-customer outcomes</p><p>A common catastrophic pattern is optimizing only fraud-loss prevention: overly aggressive automated holds can cut legitimate users off from essential funds or disrupt merchants at scale. The countervailing catastrophe is underweighting FN: fraud systems tend to lower thresholds for high-value, fast-moving, or account-takeover patterns because a single missed event can compound rapidly across linked accounts.</p><p>The threshold logic</p><p>Assume a system emits a risk score s, and it acts when s \ge t.</p><ul><li><strong>Lowering</strong> the threshold t generally catches more real positives: fewer false negatives, more false positives.</li><li><strong>Raising</strong> t generally reduces false positives, but misses more genuine cases: more false negatives.</li><li>The operational choice should minimize <strong>expected harm</strong>, not maximize accuracy:</li></ul><p>Expected harm(t)=CFP​⋅FP(t)+CFN​⋅FN(t)+Cdelay​(t)+Cworkflow​(t)</p><p>The last two terms matter in real systems. A luggage scanner that alarms on nearly everything, a SOC producing millions of alerts, or a CI pipeline that is perpetually red can create a secondary failure: people bypass, ignore, or cannot process the system.</p><p>Why the domains differ</p><p>Three factors determine which error should dominate threshold design:</p><p>Factor When false negatives dominate When false positives dominate</p><p><strong>Severity</strong></p><p>Missed bomb, untreated lethal disease, undetected intrusion</p><p>Wrongful incarceration, destructive overtreatment, unjustified account freeze</p><p><strong>Reversibility</strong></p><p>Harm grows rapidly or cannot be undone after a miss</p><p>State action is hard to reverse: prison, surgery, loss of livelihood</p><p><strong>Base rate</strong></p><p>Rare threats mean even strong systems may generate many FPs</p><p>Rare conditions can make a positive result weak evidence without confirmation</p><p><strong>Second-stage review</strong></p><p>Cheap confirmatory review makes a sensitive first-stage screen sensible</p><p>Costly or harmful follow-up requires a more specific first-stage threshold</p><p><strong>System scale</strong></p><p>One miss may propagate: malware, fraud networks, production defects</p><p>One FP applied at scale can harm thousands or millions of innocent cases</p><p>For example, airport security legitimately tolerates much more secondary screening than criminal justice tolerates erroneous conviction, because a bag alarm can be resolved before boarding, whereas imprisonment cannot fully restore years wrongly taken. Conversely, a missed explosive device is so consequential that screening cannot be tuned purely for passenger convenience.</p><p>Design patterns that avoid both failures</p><ul><li><strong>Separate detection from final action.</strong> Use a sensitive initial screen, then a specific confirmation process. Medicine uses screening plus diagnostic workup; fraud systems use step-up authentication; security operations use alert triage and evidence correlation.</li><li><strong>Tune by harm class, not one global score.</strong> A suspected fraudulent CHF 5 coffee purchase should not receive the same action as a novel six-figure international transfer; a failed UI snapshot should not block deployment like an authorization-bypass regression.</li><li><strong>Measure the hidden costs.</strong> Track not only precision and recall but investigation time, queue length, appeal/reversal rates, time-to-detection, time-to-containment, test flakiness, user abandonment, and downstream injury.</li><li><strong>Preserve a human appeal or override path</strong> where false positives restrict liberty, access to money, medical treatment, or travel.</li><li><strong>Test the whole socio-technical loop.</strong> Many catastrophes arise not because a detector had zero signal, but because alerts were ignored, evidence was overstated, releases were not verified across environments, or responders lacked a fast safe action.</li></ul><p>The central lesson is that minimizing one statistical error blindly can create the larger real-world disaster. In high-consequence systems, the correct question is: <strong>which mistake is more harmful here, to whom, how quickly, and can it be repaired?</strong></p><p>Here’s the structured comparison matrix covering all six domains. The document includes a compact matrix table plus detailed analysis for each domain.</p><p>Key findings across all six domains <strong>The direction of the asymmetry flips depending on what’s at stake:</strong></p><ul><li><strong>Medical screening (fatal conditions):</strong> False negatives are far worse — a missed cancer can be terminal. Thresholds tune for high sensitivity, accepting that ~1,376 women per 1,000 screened will have at least one false positive over a lifetime. Catastrophic case: the Irish CervicalCheck scandal, where 209 women received false-negative smear results and 18 died.[<a href="https://www.uspreventiveservicestaskforce.org/uspstf/recommendation/breast-cancer-screening">uspreventiveservicestaskforce</a>][<a href="https://www.bbc.com/news/world-europe-44659869">bbc</a>]</li><li><strong>Medical screening (non-fatal/slow conditions):</strong> The asymmetry inverts — overtreatment harm from false positives can rival delayed-diagnosis harm. The PSA overtreatment era led the USPSTF to recommend against routine screening in 2012, later revised to individualized decision-making.</li><li><strong>Criminal justice:</strong> False positives (wrongful convictions) are treated as far worse than false negatives (guilty acquittals). Blackstone’s ratio: “better that ten guilty persons escape than that one innocent suffer”. Threshold: “beyond a reasonable doubt.” Catastrophic case: Salem witch trials (1692).[<a href="https://en.wikipedia.org/wiki/Blackstone%27s_ratio">en.wikipedia</a>]</li><li><strong>Cybersecurity:</strong> False negatives should be worse, but alert fatigue paradoxically pushes organizations toward tolerating them. Target’s FireEye system generated alerts that were ignored — 40 million cards compromised, CEO and CIO resigned.[<a href="https://en.wikipedia.org/wiki/2013_Target_data_breach">en.wikipedia</a>]</li><li><strong>CI/CD testing:</strong> False negatives (defective code in production) cost far more than false positives (blocked deployments). Knight Capital lost $440M in 45 minutes due to untested deployment code.[<a href="https://en.wikipedia.org/wiki/Knight_Capital_Group">en.wikipedia</a>]</li><li><strong>Airport screening:</strong> Extreme FN &gt;&gt; FP asymmetry. Pan Am 103 (270 dead) resulted from using X-ray instead of mandated hand-searching of unaccompanied bags.[<a href="https://en.wikipedia.org/wiki/Pan_Am_Flight_103">en.wikipedia</a>]</li><li><strong>Financial fraud:</strong> Context-dependent. Bangladesh Bank lost $81M because the system flagged 30 transactions for review but 5 were approved anyway — the blocking threshold was set too high.[<a href="https://en.wikipedia.org/wiki/Bangladesh_Bank_heist">en.wikipedia</a>]</li></ul><p>The synthesis identifies four drivers of threshold design: base rate, reversibility, downstream review capacity, and externalities.<strong> The most dangerous pattern across all case studies is not detection failure but detection followed by discard — systems that flagged the threat correctly but where organizational processes failed to act on the signal.</strong></p><p>Das gefährlichste Muster über alle Fallstudien hinweg ist nicht das Ausbleiben der Erkennung, sondern die Erkennung gefolgt von einer Verwerfung — also Systeme, die die Bedrohung zwar korrekt identifizierten, bei denen jedoch organisatorische Prozesse versagten, auf das Signal zu reagieren.</p><p>El patrón más peligroso en todos los estudios de caso no es el fallo en la detección, sino la detección seguida del descarte: sistemas que identificaron correctamente la amenaza, pero en los que los procesos organizativos no lograron actuar ante la señal.</p><p>Le schéma le plus dangereux, parmi toutes les études de cas, n’est pas l’échec de la détection, mais la détection suivie d’un rejet : des systèmes ayant correctement signalé la menace, mais pour lesquels les processus organisationnels n’ont pas permis d’agir en conséquence.</p><p>すべての事例に共通する最も危険なパターンは、脅威の検知そのものの失敗ではなく、検知したにもかかわらずその情報が破棄されてしまうケースです。つまり、システムは脅威を正しく特定していたものの、組織のプロセスがそのシグナルに基づいて適切に対処できなかったという状況です。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/909/0*P8g1Pd0D5_mpFE_e" /></figure><p><a href="https://www.perplexity.ai/computer/tasks/2d4f41de-5ce6-4a42-b214-1029aacee23e">False Positive vs False Negative Matrix</a></p><p>I can’t write lyrics in the exact style of any specific artist or existing song, but I can create an original song text about false positives. Here’s a short, original piece you can use or adapt:</p><p><a href="https://youtu.be/0KSOIwv9o0o">https:<em>//youtu.be/0KSOIwv9o0o</em></a></p><p>Song <strong>Title: “False Positive”</strong></p><p><em>(Verse 1)</em><br>The screen lights up, a red alert sign,<br>Something’s wrong, the code won’t align.<br>My heart jumps first, then doubt sets in-<br>Is this the bug, or did we win?</p><p><em>(Pre-Chorus)</em><br>Every alarm that screams in the night,<br>Might just be shadows playing with light.</p><p><em>(Chorus)</em><br>False positive, you fooled me again,<br>Crying “danger” where there’s no sin.<br>I chase a ghost through lines of code,<br>While silence hums on the other road.<br>False positive, you steal my time,<br>Painting crime where there is no crime.</p><p><em>(Verse 2)</em><br>In labs and logs and tests we trust,<br>But numbers lie if they must.<br>A signal spark, a blip, a trace-<br>Then nothing left but empty space.</p><p><em>(Pre-Chorus)</em><br>Every warning that breaks the calm,<br>Might be a storm without any harm.</p><p><em>(Chorus)</em><br>False positive, you fooled me again,<br>Crying “danger” where there’s no sin.<br>I run through noise that looks like truth,<br>While real errors hide in the booth.<br>False positive, you blur the line,<br>Between “all clear” and “cross the line.”</p><p><em>(Bridge)</em><br>If I tune the threshold low, I’ll miss the real,<br>If I push it high, I’ll never feel.<br>Between the two, I walk the wire,<br>Balancing doubt and false desire.</p><p><em>(Final Chorus)</em><br>False positive, you’re part of the game,<br>A trick of the test, a glitch in the name.<br>I’ll learn your shape, I’ll read between,<br>The lies you hide inside the screen.<br>False positive, you’ll never win-<br>I’ll find the truth beneath the spin.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*m6gB23gEw1gWKgsa" /></figure><p><em>Originally published at </em><a href="https://teetrains.wordpress.com/2026/09/29/from-bayes-theorem-to-confusion-matrix/"><em>http://teetrains.wordpress.com</em></a><em> on September 29, 2026.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c2f5a790a3d1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How does the concept of correlated objects in image detection work in detail?]]></title>
            <link>https://medium.com/@breitsch2/how-does-the-concept-of-correlated-objects-in-image-detection-work-in-detail-285527397a9b?source=rss-2218ff386d6------2</link>
            <guid isPermaLink="false">https://medium.com/p/285527397a9b</guid>
            <category><![CDATA[geospatial]]></category>
            <category><![CDATA[geo-intelligence]]></category>
            <category><![CDATA[geoinformatics]]></category>
            <dc:creator><![CDATA[Breitsch]]></dc:creator>
            <pubDate>Wed, 23 Sep 2026 16:24:45 GMT</pubDate>
            <atom:updated>2026-09-23T16:24:45.223Z</atom:updated>
            <content:encoded><![CDATA[<p>Das Konzept korrelierter Objekte verbindet die lokale Erkennung eines Objekts mit Kontextwissen über andere Objekte im selben Bild. Ein Objekt wird also nicht nur danach beurteilt, <em>wie es selbst aussieht</em>, sondern auch danach, ob seine Nachbarschaft, Lage, Größe und Szene semantisch plausibel sind.[<a href="https://link.springer.com/article/10.1007/s10462-025-11186-x?error=cookies_not_supported&amp;code=712b0a8b-b679-46c8-b406-04ae9b7e6c9e">link.springer</a>][<a href="https://arxiv.org/pdf/1906.02534.pdf">arxiv</a>]</p><p>Das beschriebene Konzept stammt im Kern aus der <strong>probabilistischen Kontextklassifikation</strong> bzw. <em>relationalen Bildanalyse</em>. Dabei wird ein Bild nicht als Sammlung unabhängiger Objekte behandelt: Die Klassenzuweisung eines Segments oder Objekts wird anhand seiner Nachbarn und deren wahrscheinlicher Klassen nachträglich verstärkt oder abgeschwächt.[<a href="http://www.kreissl.info/bilderkennung">kreissl</a>]</p><p><strong>Beispiel einer Semantischen Segmentierung</strong></p><p>In einem Luftbild könnte ein längliches graues Segment allein mehrdeutig sein: Straße, Bahnlinie oder befestigter Weg.</p><ul><li>Erkennt das System daneben regelmäßig parallele Linien, Schottertextur und ein langgestrecktes Fahrzeugobjekt, steigt die Wahrscheinlichkeit für „Bahntrassee“.</li><li>Erkennt es dagegen Fahrspuren, parkende Autos und Gebäudezufahrten, wird „Straße“ wahrscheinlicher.</li><li>Erkennt es angrenzende Wasserflächen und Ufervegetation, kann „Uferweg“ plausibler werden.</li></ul><p>Die Nachbarn „beweisen“ die Klasse nicht, aber sie verändern die <strong>Wahrscheinlichkeitsverteilung</strong>. Das ist der entscheidende Unterschied zu einer rein lokalen Objekterkennung.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/0*UmvJVFRlBn-ht_KU.jpeg" /></figure><p>Grundidee</p><p>Ein Detektor liefert zunächst für jede gefundene Region eine Klasse, Bounding Box und lokale Konfidenz:</p><p>KandidatLokale KlasseLokale KonfidenzRegion AZaun0,58Region BAuto0,94Region CStraße0,89</p><p>Ohne Kontext wäre „Zaun“ mit 0,58 nur ein unsicherer Fund. Nun wertet das System aus:</p><ul><li>Tritt die Klasse „Zaun“ in solchen Szenen häufig zusammen mit Autos und Straßen auf?</li><li>Befindet sich das Auto in einer erwartbaren relativen Position zum Zaun?</li><li>Haben Zaun und Auto plausible Größen und Abstände?</li><li>Passt das gesamte Objektmuster zur vermuteten Szene, etwa Parkplatz, Werkareal oder Grenzanlage?</li></ul><p>Wenn diese Beziehungen in den Trainingsdaten häufig vorkamen, kann das System die Zaun-Hypothese hochstufen. Die Korrelation ist daher keine bloße Bildähnlichkeit, sondern eine gelernte statistische Abhängigkeit zwischen Objektklassen, Positionen und Szenen. Co-Occurrence bezeichnet insbesondere das gemeinsame Auftreten; räumlicher Kontext umfasst Abstand, Richtung, Orientierung, Überlappung, Adjazenz und relative Lage.[<a href="https://link.springer.com/article/10.1007/s10462-025-11186-x?error=cookies_not_supported&amp;code=712b0a8b-b679-46c8-b406-04ae9b7e6c9e">link.springer</a>]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/0*wzJa_Sl0XPtm5TZ6" /><figcaption>Die Autos machen den Zaun wahrscheinlicher</figcaption></figure><p>Welche Korrelationen genutzt werden</p><p>In der Praxis werden mehrere Arten kombiniert:</p><p>KontextartFrageBeispielSemantische KoexistenzWelche Klassen treten häufig gemeinsam auf?Auto und Straße; Lokomotive und GleisRäumliche RelationWo liegt Objekt B relativ zu Objekt A?Ein Signal steht nahe oder neben einem GleisDistanz/AdjazenzSind die Objekte ausreichend nahe bzw. verbunden?Wagen stehen entlang desselben GleisverlaufsRelative GrößePasst das Größenverhältnis?Ein Auto ist deutlich kleiner als ein ParkplatzarealOrientierungStimmen Richtungen überein?Fahrzeuge und Fahrspuren verlaufen ähnlichSzenenkontextPasst das Objekt zu einer übergeordneten Szene?Schiff bei Wasser/Hafen statt in einem WohngebietHierarchischer KontextPasst „Teil–Ganzes“?Räder, Fenster, Dach und Gleisumfeld stützen „Zug“</p><p>Ein Auto ist beispielsweise nicht allein deshalb als Auto glaubwürdig, weil es rechteckig und metallisch aussieht. Die Hypothese wird plausibler, wenn sich das Objekt auf einer Straße befindet, eine passende Größe hat und nahe anderer Fahrzeuge erscheint. Umgekehrt kann ein sehr sicher erkannter Kontext auch schwächere Objektkandidaten wieder sichtbar machen. Studien zu Kontextdetektion unterscheiden daher ausdrücklich semantische Koexistenz, räumliche Lagebeziehungen und Größenkontext.[<a href="https://arxiv.org/pdf/1906.02534.pdf">arxiv</a>][<a href="https://ar5iv.labs.arxiv.org/html/2302.05011">ar5iv.labs.arxiv</a>]</p><p>Mathematisches Modell</p><p>Angenommen, es gibt n Objektkandidaten. Für Kandidat i sucht das System ein Klassenlabel y_i, etwa „Zaun“, „Auto“ oder „Straße“. Es maximiert dann nicht nur die Einzelwahrscheinlichkeit P(y_i\mid x_i), wobei x_i die lokalen Bildmerkmale sind, sondern die gemeinsame Bewertung aller Labels:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*2zmJMP7wzzcFZUn4" /></figure><pre>P(y_1,\ldots,y_n \mid x_1,\ldots,x_n,R)</pre><p>R steht für die räumlichen Beziehungen zwischen den Kandidaten, etwa Distanz, Richtung und Überlappung.</p><p>Eine übliche Darstellung als Optimierungsfunktion lautet:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/0*Dqp46hEHrg3hUIwt" /></figure><pre>\underset{y}{\operatorname{argmax}}\left[\sum_i U_i(y_i,x_i)+\lambda\sum_{(i,j)\in E} V_{ij}(y_i,y_j,r_{ij})+\mu \, G(y,S)\right]</pre><p>argmax​​i∑​Ui​(yi​,xi​)+λ(i,j)∈E∑​Vij​(yi​,yj​,rij​)+μG(y,S)​</p><p>Dabei gilt:</p><ul><li>U_i: lokale Evidenz des Detektors für Kandidat i, etwa „dieser Ausschnitt sieht zu 0,58 wie ein Zaun aus“.</li><li>V_{ij}: paarweiser Kontextterm für zwei Objekte i und j; er bewertet, ob Klassen und räumliche Relation zusammenpassen.</li><li>r_{ij}: gemessene Relation, beispielsweise „Auto 3 m vor Zaun“, „Objekt links von Straße“ oder „parallel zu Gleisachse“.</li><li>E: Menge der berücksichtigten Objektpaare, häufig nur räumliche Nachbarn, damit das Verfahren effizient bleibt.</li><li>G: globaler Szenenterm, der die Objektmenge gegen eine Szene wie „Bahnhof“, „Hafen“, „Parkplatz“ oder „Wohngebiet“ prüft.</li><li>\lambda und \mu: Gewichtungen, wie stark lokale Erkennung, paarweiser Kontext und Gesamtszene zählen.</li></ul><p>Conditional Random Fields, kurz CRFs, sind ein klassischer Ansatz für genau diese Aufgabe. Sie modellieren eine große Menge voneinander abhängiger Labels und werden bei der semantischen Segmentierung eingesetzt, um Korrelationen zwischen Pixeln oder Regionen explizit zu berücksichtigen. Das CoLA-Verfahren (<em>Co-occurrence, Location and Appearance</em>) kombiniert beispielsweise lokale Bildmerkmale, gemeinsames Auftreten und relative Positionen in einem CRF, um Labels so zu wählen, dass sie zugleich zum Segmentinhalt und zueinander passen.[<a href="https://www.robots.ox.ac.uk/~tvg/publications/2017/CRFMeetCNN4SemanticSegmentation.pdf">robots.ox.ac</a>][<a href="https://vision.ucsd.edu/sites/default/files/publications/pdfs/Object%20Categorization%20using%20Co-Occurrence,%20Location%20and%20Appearance.pdf">vision.ucsd</a>]</p><p>Schritt für Schritt</p><ol><li><strong>Objektkandidaten erzeugen</strong><br>Ein Detektor wie YOLO, Faster R-CNN oder ein Segmentierungsmodell liefert Boxen bzw. Regionen, Klassenwahrscheinlichkeiten und Merkmale. Ein Kandidat kann mehrere plausible Labels besitzen, nicht nur sein Top-1-Ergebnis.</li><li><strong>Relationale Merkmale berechnen</strong><br>Für jedes relevante Paar berechnet das System beispielsweise:r_{ij}= (\Delta x,\Delta y,\text{Abstand},\text{Überlappung}, \text{Größenverhältnis},\text{Winkeldifferenz})In GeoAI kommen zusätzlich georeferenzierte Distanz, Höhenlage, Straßen-/Gleisnähe, Flächenklasse sowie zeitliche Veränderung hinzu.</li><li><strong>Korrelationen lernen oder Regeln definieren</strong><br>Aus annotierten Bildern oder Geodaten entsteht etwa eine Tabelle:P(\text{Gleis}\mid\text{Lokomotive}) \quad \text{hoch}P(\text{Straße}\mid\text{Auto}) \quad \text{hoch}P(\text{Fahrleitungsmast nahe Gleis}\mid\text{elektrifizierte Bahn}) \quad \text{hoch}Ein statistisches Modell lernt dabei nicht nur, <em>dass</em> zwei Klassen zusammen vorkommen, sondern auch typische Relationen: „Objekt B liegt innerhalb bestimmter Positions- und Distanzbereiche relativ zu A.“</li><li><strong>Scores aktualisieren</strong><br>Aus lokaler Evidenz und Kontext wird ein neuer Score gebildet. Anschaulich:\text{Score}_{neu}(\text{Zaun}) = \text{Score}_{lokal}(\text{Zaun}) + \lambda\cdot \text{Plausibilität}(\text{Zaun},\text{Auto},r)Ist das Auto tatsächlich in einer für die Domäne erwartbaren Lage, steigt der Score. Ist es weit entfernt, auf der falschen Seite oder in einer unpassenden Umgebung, bleibt der Bonus klein oder wird negativ.</li><li><strong>Gemeinsame Entscheidung finden</strong><br>Weil A B beeinflusst und B wiederum A beeinflusst, reicht ein einziger Korrekturschritt oft nicht. Klassische Modelle verwenden dafür Message Passing bzw. Belief Propagation; dabei geben benachbarte Knoten iterativ Evidenz weiter, bis sich die Wahrscheinlichkeiten stabilisieren. Ein Beispiel für einen hierarchischen CRF-Ablauf bildet Regionen als Knoten, gewichtet Kanten über ihre Ähnlichkeit und führt anschließend Belief Propagation aus.[<a href="https://www.cs.ubc.ca/~murphyk/Papers/reynoldsCRV07.pdf">cs.ubc</a>]</li><li><strong>Schwellenwert und Plausibilitätsprüfung</strong><br>Erst danach wird entschieden, ob eine Erkennung ausgegeben, unterdrückt, umklassifiziert oder für menschliche Prüfung markiert wird. Das ist wichtig: Ein Kontextbonus sollte eine schwache Erkennung nicht automatisch zur scheinbaren Gewissheit machen.</li></ol><p>Beispiel: Bahninfrastruktur</p><p>Für Luft- oder Drohnenbilder wäre ein domänenspezifischer Graph besonders wirkungsvoll:</p><p>ObjektErwartete KorrelationenGleisParallel zu anderem Gleis; verbunden mit Weichen; nahe SchotterbettFahrleitungsmastIn regelmäßigen Abständen und nahe einer GleisachseBahnsteigParallel zum Gleis;</p><p>nahe Bahnhofsdach oder ZugangZugLängliche Objektgruppe, auf Gleisachse ausgerichtetSignalIn geringem Abstand zum Gleis; meist in typischer Ausrichtung</p><p>Angenommen, das Modell erkennt eine Reihe schlanker vertikaler Objekte jeweils nur mit 0,45 als „Fahrleitungsmast“. Entdeckt es gleichzeitig ein Gleis mit hoher Sicherheit und liegen die Kandidaten in annähernd regelmäßigen Intervallen parallel dazu, kann die Kombination die Mast-Hypothesen stärken. Finden sich dieselben Pfosten hingegen auf einer Baumreihe weit weg vom Gleis, wäre ein solcher Bonus unangebracht.</p><p>Grenzen und robuste Umsetzung</p><p>Kontext ist ein zusätzlicher Evidenzkanal, kein Ersatz für visuelle Belege. Drei Risiken sind besonders relevant:</p><ul><li><strong>Scheinkorrelationen</strong>: Ein Modell kann zufällige Trainingsmuster lernen, etwa Autos stets mit bestimmten Kameraperspektiven oder Regionen zu verknüpfen oder ein Auto nahe dem Zaun die <strong>Scheinkorrelation</strong> Parkplatz bedeuten.</li><li><strong>Domänenwechsel</strong>: Was in Trainingsbildern normal ist, gilt nicht zwingend für andere Länder, Jahreszeiten, Sensoren oder historische Luftbilder.</li><li><strong>Fehlerfortpflanzung</strong>: Eine falsche, aber hoch bewertete Erkennung kann ihre Nachbarn fälschlich „bestätigen“.</li></ul><p>Robust wird das Verfahren, wenn es lokale und kontextuelle Wahrscheinlichkeiten getrennt protokolliert, Beziehungen nur innerhalb sinnvoller Distanzen verwendet, den Kontextterm begrenzt und ungewöhnliche Kombinationen als Review-Fälle markiert statt sie zwangsweise umzuklassifizieren. Ein aktueller Überblick über kontextbasierte Objektdetektion hebt genau die Bedeutung paarweiser räumlicher Beziehungen, Co-Occurrence-Statistiken und deren Kombination mit graphischen Modellen wie CRFs hervor.[<a href="https://link.springer.com/article/10.1007/s10462-025-11186-x?error=cookies_not_supported&amp;code=712b0a8b-b679-46c8-b406-04ae9b7e6c9e">link.springer</a>]</p><p><strong>Semantische Segmentierung</strong> mit probabilistischen Modellen weist <strong>jedem Pixel</strong> eines Bildes eine Klassenwahrscheinlichkeit zu und entscheidet anschließend gemeinsam für alle Pixel, welche Beschriftung insgesamt am plausibelsten ist. Im Unterschied zur isolierten Pixelklassifikation berücksichtigt das Modell daher Bildinhalt, räumliche Nachbarschaft, Farb- und Texturähnlichkeit sowie Objektgrenzen. Conditional Random Fields (CRFs) und Markov Random Fields (MRFs) sind die klassischen Modelle dafür.</p><h4>Was gilt: Wenn Auto dann Zaun oder wenn Zaun dann Auto?</h4><p>Es gilt nicht pauschal „Auto ⇒ Zaun“ oder „Zaun ⇒ Auto“. In einer korrelationsbasierten Bildanalyse können <strong>beide bedingten Wahrscheinlichkeiten</strong> modelliert werden — sie sind aber normalerweise verschieden und keine Kausalbehauptungen.[<a href="https://plato.stanford.edu/archives/fall2026/entries/bayes-theorem/">plato.stanford</a>][<a href="https://plato.stanford.edu/archives/spr2018/entries/causation-probabilistic/">plato.stanford</a>]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*YC1WUOvkPyYkPzfh.png" /></figure><p>Die richtige Richtung</p><p>Wenn Sie einen unsicheren Zaun-Kandidaten prüfen und ein Auto bereits relativ sicher erkannt wurde, lautet die relevante Frage:</p><pre>P(\text{Zaun}\mid \text{Auto}, r)</pre><p>also: <em>Wie wahrscheinlich ist ein Zaun, wenn ein Auto in der räumlichen Relation </em><em>r beobachtet wurde?</em></p><p>Das ist der Fall:</p><blockquote><strong><em>Auto als Evidenz ⇒ Zaun-Score neu bewerten.</em></strong></blockquote><p>Umgekehrt, wenn das Auto unsicher ist, aber ein Zaun sicher erkannt wurde, prüfen Sie:</p><pre>P(\text{Auto}\mid \text{Zaun}, r)</pre><p>also:</p><blockquote><strong><em>Zaun als Evidenz ⇒ Auto-Score neu bewerten.</em></strong></blockquote><p>Beide Richtungen sind gültige Inferenzschritte. Welche Sie gerade verwenden, hängt davon ab, welches Objekt die Evidenz und welches die zu bestätigende Hypothese ist.</p><p>Die Wahrscheinlichkeiten sind asymmetrisch</p><p>Die beiden Aussagen sind nicht gleich:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*t435yhNC_qxSZ91f" /></figure><pre>P(\text{Zaun}\mid\text{Auto})</pre><pre>\neq</pre><pre>P(\text{Auto}\mid\text{Zaun}).</pre><p>Das liegt daran, dass Autos in sehr vielen Situationen vorkommen, in denen kein Zaun zu sehen ist: Straßen, Parkhäuser, Plätze, Autobahnen, Innenstädte oder landwirtschaftliche Wege. Ein Auto ist daher oft nur ein schwacher Hinweis auf einen Zaun.</p><p>Ein Zaun kann hingegen häufiger ein Hinweis auf ein in der Nähe befindliches Auto sein — beispielsweise bei Parkplätzen, Industriearealen, Depots, Grenzanlagen oder privaten Grundstücken. Aber auch das ist abhängig von Trainingsgebiet, Blickwinkel, Kartenausschnitt und Objektdefinition. Ein langer Weidezaun ist beispielsweise kein guter Hinweis auf Autos.</p><p>EvidenzAbgefragte HypotheseTypische AussageAuto erkanntZaun unsicher„Erhöht ein Auto an dieser Position die Zaunwahrscheinlichkeit?“Zaun erkanntAuto unsicher„Erhöht ein Zaun an dieser Position die Autowahrscheinlichkeit?“Auto und Zaun erkanntGesamtszene„Ist die Kombination samt Geometrie plausibel?“</p><p>Entscheidend: die räumliche Relation</p><p>In einem brauchbaren Modell reicht eine reine Klassenbeziehung nicht aus. Statt nur</p><pre>P(\text{Zaun}\mid\text{Auto})</pre><p>braucht man eher:</p><pre>P(\text{Zaun}\mid\text{Auto}, r, s).</pre><p>Dabei bezeichnet:</p><ul><li>r: die konkrete Relation — Abstand, Richtung, Seite, Berührung, relative Größe, Orientierung.</li><li>s: den Szenenkontext — zum Beispiel Parkplatz, Straßenzug, Bahnhof, landwirtschaftliche Fläche oder Industrieareal.</li></ul><p>Praktisch könnte das heißen:</p><pre>P(\text{Zaun}\mid</pre><pre>\text{Auto},\;</pre><pre>\text{Auto 2–8 m vor dem Kandidaten},\;</pre><pre>\text{Parkplatz})</pre><p>ist hoch, während</p><pre>P(\text{Zaun}\mid</pre><pre>\text{Auto},\;</pre><pre>\text{Auto 150 m entfernt},\;</pre><pre>\text{offene Autobahn})</pre><p>nahe am allgemeinen Basiswert bleibt.</p><p>Das Kontextmodell soll also nicht die unlogische Regel „Jedes Auto impliziert einen Zaun“ lernen, sondern eine konditionale, geometrisch eingeschränkte Beziehung.</p><p>Bayes’sche Sicht</p><p>Häufig kennt oder lernt man leichter die Wahrscheinlichkeit, ein Auto zu sehen, <strong>wenn tatsächlich ein Zaun vorhanden ist</strong>:</p><pre>P(\text{Auto}\mid\text{Zaun},r).</pre><p>Für die eigentliche Bestätigung eines Zauns bei beobachtetem Auto benötigt man aber die Gegenrichtung:</p><pre>P(\text{Zaun}\mid\text{Auto},r).</pre><p>Bayes liefert die Umrechnung:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/619/0*2aNmAeNZW__Ju5k0" /></figure><pre>P(\text{Zaun}\mid\text{Auto},r)</pre><pre>=</pre><pre>\frac{</pre><pre>P(\text{Auto}\mid\text{Zaun},r)</pre><pre>\cdot</pre><pre>P(\text{Zaun}\mid r)</pre><pre>}{</pre><pre>P(\text{Auto}\mid r)</pre><pre>}.</pre><p>Hier zählt besonders der Prior P(\text{Zaun}\mid r): Selbst wenn Autos häufig nahe Zäunen stehen, kann ein Zaun in einer bestimmten Bilddomäne insgesamt selten sein. Dann wird ein einzelnes Auto den Zaun-Score nur begrenzt erhöhen. Der Satz von Bayes verknüpft genau die „direkte“ bedingte Wahrscheinlichkeit P(H\mid E) mit der umgekehrten Wahrscheinlichkeit P(E\mid H) und dem Basiswissen über die Hypothese.[<a href="https://plato.stanford.edu/archives/fall2026/entries/bayes-theorem/">plato.stanford</a>]</p><p>In CRF- und Graphmodellen</p><p>Ein CRF speichert die Beziehung oft nicht als gerichtete Regel „Wenn A, dann B“, sondern als symmetrischen paarweisen Kompatibilitätsterm:</p><pre>\psi_{ij}(y_i,y_j,r_{ij}).</pre><p>Dieser Term gibt einer gemeinsamen Labelkombination eine geringe Energie, wenn sie plausibel ist, etwa:</p><pre>(\text{Zaun},\text{Auto},r_{\text{plausibel}})</pre><p>und eine hohe Energie, wenn sie unwahrscheinlich ist.</p><p>Bei der Inferenz fließt die Evidenz dann in <strong>beide Richtungen</strong> durch die Kante:</p><ul><li>ein sichereres Auto kann einen Zaun-Kandidaten stärken;</li><li>ein sicherer Zaun kann einen Auto-Kandidaten stärken;</li><li>zwei unsichere Kandidaten können sich moderat gegenseitig stützen;</li><li>zwei widersprüchliche Kandidaten oder eine unplausible Geometrie schwächen die Kombination.</li></ul><p>Das ist kein logisches „Wenn-dann“, sondern ein gewichteter Konsistenzbeitrag. Der Wert wird zusammen mit den lokalen CNN-/Detektor-Scores optimiert, statt eine Klasse zwanghaft aus der anderen abzuleiten.</p><p>Wichtig: Korrelation ist keine Ursache</p><p>„Autos treten häufig in Zaunnähe auf“ bedeutet nicht, dass Autos Zäune erzeugen oder Zäune Autos verursachen. Beide können wegen einer dritten, nicht unmittelbar beobachteten Ursache gemeinsam auftreten — beispielsweise Parkplatz als <strong>Scheinkorrelation</strong>, Industrieareal, gesichertes Gelände oder Grundstück. Probabilistische Abhängigkeit allein kann die Kausalrichtung nicht bestimmen; auch gemeinsame Drittursachen können die beobachtete Korrelation erklären.[<a href="https://plato.stanford.edu/archives/spr2018/entries/causation-probabilistic/">plato.stanford</a>]</p><p>Die praktisch korrekte Regel lautet deshalb:</p><blockquote><em>Nutze das sicherere, räumlich passend erkannte Objekt als Evidenz, um die </em><strong><em>bedingte Wahrscheinlichkeit</em></strong><em> eines unsicheren Objektkandidaten neu zu gewichten — in der Richtung, die der aktuellen Fragestellung entspricht.</em></blockquote><h4>Lernen im neuronalen Netz</h4><p>Die „Wahrscheinlichkeiten“ entstehen im neuronalen Netz nicht durch fest programmierte Regeln wie „Auto bedeutet Zaun“, sondern aus trainierten Gewichten. Das Netz berechnet zunächst für jedes Pixel, jedes Segment oder jeden Objektkandidaten ungeeichte Werte (<em>Logits</em>); erst eine Softmax- oder Sigmoid-Funktion macht daraus Werte, die als Klassenwahrscheinlichkeiten interpretiert werden können.</p><p>Für drei Klassen könnte ein Netz beispielsweise ausgeben:</p><p>KlasseLogitZaun2,1Auto0,8Vegetation−0,5</p><p>Ein Logit ist noch keine Wahrscheinlichkeit. Er darf negativ sein, muss sich nicht auf 1 summieren und ist vor allem ein relativer Evidenzscore.</p><p>Aus den Beispiel-Logits ergibt sich ungefähr:</p><p>KlasseSoftmax-WahrscheinlichkeitZaun0,75Auto0,20Vegetation0,05</p><p>Das Netz würde „Zaun“ wählen, weil dessen Wahrscheinlichkeit am größten ist.</p><p>Bei Objektdetektion können Klassen einander aber überlappen: Ein Pixel kann gleichzeitig zu „Fahrzeug“ und „militärisches Fahrzeug“ passen, oder ein Bildausschnitt kann mehrere Attribute haben. Dann verwendet ein Modell oft pro Klasse eine unabhängige Sigmoid-Funktion:</p><p>P(yi,c=1∣I,θ)=σ(zi,c)=11+exp⁡(−zi,c).P(yi,c​=1∣I,θ)=σ(zi,c​)=1+exp(−zi,c​)1​.</p><p>Anders als Softmax zwingt Sigmoid die Klassenwerte nicht dazu, zusammen 1 zu ergeben.</p><p>4. Wie das Netz lernt</p><p>Beim Training besitzt jedes Bild Referenzdaten (<em>Ground Truth</em>):</p><ul><li>Für Segmentierung: eine Klassenmaske pro Pixel.</li><li>Für Detektion: Objektklasse plus Bounding Box, Maske oder Keypoints.</li><li>Für Kontextlernen: zusätzlich Beziehungen, Szene-Labels oder indirekt viele Beispiele, in denen typische räumliche Anordnungen auftreten.</li></ul><p>Für ein korrekt als Zaun annotiertes Pixel soll das Netz beispielsweise P(Zaun)P(Zaun) erhöhen. Die Standard-Loss-Funktion ist Cross-Entropy:</p><p>Li=−log⁡P(yi=c∗∣I,θ),Li​=−logP(yi​=c∗∣I,θ),</p><p>wobei c∗c∗ die richtige Klasse ist.</p><p>Ist der Zaun korrekt mit 0,95 bewertet, ist der Verlust klein:</p><p>−log⁡(0,95</p><p>−log(0,95)≈0,051.</p><p>Liegt die Zaunwahrscheinlichkeit nur bei 0,10, ist der Verlust groß:</p><p>−log⁡(0,10)≈2,303.−log(0,10)≈2,303.</p><p>Mittels Backpropagation berechnet das Trainingsverfahren, welche Gewichte zu diesem Fehler beigetragen haben. Ein Optimierer wie SGD oder Adam passt sie in kleinen Schritten an. Wiederholt über viele annotierte Beispiele entsteht ein Parametervektor θθ, der die bedingte Verteilung</p><p>P(y∣I,θ)P(y∣I,θ)</p><p>approximiert. Softmax plus Cross-Entropy entspricht dabei dem direkten Lernen einer diskriminativen Klassenwahrscheinlichkeit pro Pixel oder Region.openaccess.thecvf+1</p><p>5. Wo Objektkorrelation hineinkommt</p><p>Es gibt drei verbreitete Stufen — von implizit bis explizit.</p><p>AnsatzWie der Kontext eingehtErgebnisGroßes RezeptivfeldTiefe CNN-Schichten „sehen“ einen größeren BildbereichDas Netz kann lernen: typische Straßen- oder Parkplatzstruktur macht ein Auto plausiblerAttention / TransformerBildregionen bzw. Objekt-Queries gewichten einanderEin Objektkandidat kann Information anderer Regionen aufnehmenRelationsmodul / Graphnetz / CRFBeziehungen zwischen Kandidaten werden ausdrücklich modelliertLokale Scores werden mithilfe von Klassen-, Lage- und Szenenrelationen aktualisiert</p><p>In einem Detektionsnetz mit Relationsmodul wird aus mehreren Objektkandidaten ein Satz von Merkmalsvektoren f1,…,fnf1​,…,fn​. Für Kandidat ii wird Information der anderen Kandidaten aggregiert:</p><p>f~i=fi+∑j≠iαijWvfj.f~​i​=fi​+j=i∑​αij​Wv​fj​.</p><ul><li>WvfjWv​fj​ ist die transformierte Information von Objekt jj.</li><li>αijαij​ ist ein gelernter Aufmerksamkeitswert: Wie relevant ist Objekt jj für die Bewertung von ii?</li><li>fifi​ bleibt erhalten, damit der Kontext lokale visuelle Evidenz ergänzt und nicht ersetzt.</li></ul><p>Relation Networks für Objektdetektion nutzen genau diesen Gedanken: Objektbeziehungen werden für die Neubewertung von Detektionen verwendet; als Beispiele nennen sie gemeinsame Vorkommen und räumliche Beziehungen.<a href="https://openaccess.thecvf.com/content_cvpr_2018/papers/Hu_Relation_Networks_for_CVPR_2018_paper.pdf">openaccess.thecvf</a></p><p>6. Wie αijαij​ berechnet wird</p><p>Ein Attention-Modul bildet aus jedem Objektkandidaten drei Darstellungen:</p><p>qi=Wqfi,kj=Wkfj,vj=Wvfj.qi​=Wq​fi​,kj​=Wk​fj​,vj​=Wv​fj​.</p><p>Zusätzlich wird die Geometrie zwischen beiden Boxen erfasst:</p><p>gij=(xj−xiwi,yj−yihi,log⁡wjwi,log⁡hjhi).gij​=(wi​xj​−xi​​,hi​yj​−yi​​,logwi​wj​​,loghi​hj​​).</p><p>Der Aufmerksamkeitswert kann dann so berechnet werden:</p><p>αij=softmax⁡j(qi⊤kjd+h(gij)).αij​=softmaxj​(d​qi⊤​kj​​+h(gij​)).</p><p>h(gij)h(gij​) ist ein kleines neuronales Netz, das lernt, welche Geometrien relevant sind. Dadurch kann das Modell lernen:</p><ul><li>Ein Objekt direkt neben einem Kandidaten ist relevanter als eines weit entfernt.</li><li>Ein kleines Objekt auf einer Straße kann ein Fahrzeugkontext sein.</li><li>Längliche, parallele Elemente können sich im Bahnkontext gegenseitig stützen.</li><li>Ein Objekt in unpassender Lage liefert einen geringen oder sogar indirekt negativen Beitrag.</li></ul><p>Danach berechnet eine Klassifikationsschicht aus f~if~​i​ neue Logits und Softmax-/Sigmoid-Wahrscheinlichkeiten. Wichtig: Das Netz muss nicht explizit als Regel gespeichert haben „Auto ⇒ Zaun“. Es kann aus Beispielen lernen, dass bestimmte visuelle und geometrische Konstellationen den Zaun-Logit im Mittel erhöhen oder senken.</p><p>7. Beispiel mit Zaun und Auto</p><p>Nehmen wir einen Zaun-Kandidaten ii mit lokalem Featurevektor fZaunfZaun​. Ohne Kontext erhält er:</p><p>zZaun=0,4.zZaun​=0,4.</p><p>Ein sicher erkannter Auto-Kandidat jj liegt in einer aus den Trainingsdaten typischen Position. Die Relationseinheit liefert etwa:</p><p>αZaun,Auto=0,32.αZaun,Auto​=0,32.</p><p>Nach Kontextaggregation kann sich der Zaun-Logit erhöhen:</p><p>zZaun′=zZaun+ΔzKontext=0,4+0,9=1,3.</p><p>zZaun′​=zZaun​+ΔzKontext​=0,4+0,9=1,3.</p><p>Die endgültige Wahrscheinlichkeit hängt von allen konkurrierenden Klassen ab. Mit Softmax kann der Zaun dadurch zum Beispiel von 0,42 auf 0,71 steigen.</p><p>Diese Zahlen sind nur eine Illustration. In einem realen Modell werden αα, die Gewichte und der Scorebeitrag nicht von Hand gewählt, sondern aus Daten gelernt.</p><p>8. Probabilistische Modelle nach dem Netz</p><p>Eine klassische Alternative oder Ergänzung ist:</p><ol><li>Das Segmentierungsnetz erzeugt pro Pixel Klassenwahrscheinlichkeiten.</li><li>Diese werden in Unary-Energien überführt:</li></ol><p>ψu(yi=c)=−log⁡PNetz(yi=c∣I).ψu​(yi​=c)=−logPNetz​(yi​=c∣I).</p><ol><li>Ein CRF verbindet Pixel oder Regionen und bewertet Labelkombinationen anhand von Bildnähe, Farbe, Textur und gegebenenfalls Objektrelationen.</li><li>Iterative Inferenz erzeugt eine neue, räumlich konsistentere Wahrscheinlichkeitskarte.</li></ol><p>Das Netz liefert hier die lokale Evidenz; das CRF übernimmt die explizite Nachbarschafts- und Grenzmodellierung. In CRF-RNN-Ansätzen lassen sich die Inferenzschritte sogar als wiederkehrende Netzschicht formulieren und zusammen mit dem CNN Ende-zu-Ende trainieren.<a href="https://openaccess.thecvf.com/content_iccv_2015/papers/Zheng_Conditional_Random_Fields_ICCV_2015_paper.pdf">openaccess.thecvf</a></p><p>9. „Wahrscheinlichkeit“ ist nicht automatisch Sicherheit</p><p>Ein Softmaxwert von 0,95 bedeutet technisch: Das Modell gibt der Klasse relativ zu seinen anderen Klassen eine sehr hohe Bewertung. Es bedeutet nicht automatisch, dass die Aussage in 95 von 100 realen Fällen korrekt sein muss.</p><p>Neural Netze können überkonfident sein, besonders bei:</p><ul><li>unbekannten Sensoren, Kamerahöhen oder Auflösungen</li><li>anderen Ländern, Landschaften oder Jahreszeiten</li><li>seltenen Objekten und ungewöhnlichen Blickwinkeln</li><li>Daten außerhalb der Trainingsverteilung.</li></ul><p>Für belastbare Anwendungen prüft man deshalb <strong>Kalibrierung</strong>, beispielsweise mit einem getrennten Validierungs-/Testdatensatz und Verfahren wie Temperature Scaling. Zusätzlich sollten lokale Evidenz, Kontextbeitrag und finale Konfidenz getrennt gespeichert werden — besonders sinnvoll bei GEOINT, Infrastrukturinspektion oder sicherheitsrelevanten Entscheidungen.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=285527397a9b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WSIndex]]></title>
            <link>https://medium.com/@breitsch2/wsindex-27801f27b9ab?source=rss-2218ff386d6------2</link>
            <guid isPermaLink="false">https://medium.com/p/27801f27b9ab</guid>
            <category><![CDATA[sentiment-analysis]]></category>
            <dc:creator><![CDATA[Breitsch]]></dc:creator>
            <pubDate>Wed, 16 Sep 2026 13:23:15 GMT</pubDate>
            <atom:updated>2026-09-16T19:45:22.698Z</atom:updated>
            <content:encoded><![CDATA[<p>WSI stands for World Sentiment Index and is the research of compute a world sentiment index with the formula WSI =( (birthrate * single people) / loneliness index).</p><p>Single people or in one word singlehood. You can compute that formula, but it is <strong>not yet a meaningful or comparable “world sentiment” index</strong> unless you define compatible units and normalize the inputs. As written:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/308/0*xjKci0ic6vN4KkHz" /></figure><p>where B is birth rate, S is the share of single people, and L is a loneliness measure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bQyWIcl7E_HYwOzNfISpgg.jpeg" /></figure><p>Define the inputs</p><p>Use the same geographic unit and year for all three variables:</p><p>Variable Recommended definition Typical unit</p><p>Crude birth rate</p><p>births per 1,000 population per year</p><p>Share of adults who are single, using one consistent definition</p><p>proportion from 0 to 1</p><p>Share reporting loneliness, or a standardized loneliness scale</p><p>proportion from 0 to 1</p><p>Crude birth rate is commonly expressed as annual live births per 1,000 people, but it is strongly affected by the population’s age structure. A younger country can have a higher crude birth rate even without higher individual fertility.[ <a href="https://ourworldindata.org/grapher/crude-birth-rate">ourworldindata</a>]</p><p>For “single people,” decide whether you mean:</p><ul><li>unmarried adults,</li><li>adults not currently partnered,</li><li>people living alone, or</li><li>one-person households.</li></ul><p>These are different measures. Single-person households are often used as an internationally available proxy for solitary living, but they do not mean the occupant is necessarily single or lonely.[ <a href="https://ourworldindata.org/social-connections-and-loneliness">ourworldindata</a>]</p><p>Avoid percentages in raw form</p><p>Convert percentage values to proportions before calculating:</p><p>Then:</p><p>That result means only “birth-rate units times the single-share, divided by the loneliness-share.” It is <strong>not dimensionless</strong>, so comparing it across countries requires caution.</p><p>A better normalized index</p><p>For country comparisons, normalize each variable against a common reference-such as the dataset mean, median, or a 0–100 min-max scale.</p><p>A simple ratio-to-world-average approach:</p><p>Interpretation:</p><ul><li>100 = roughly the reference/world-average profile</li><li>&gt;100 = higher birth rate and/or larger single share relative to loneliness</li><li>&lt;100 = lower birth rate and/or higher loneliness relative to the reference</li></ul><p>Use a small safeguard for L, otherwise countries with near-zero reported loneliness cause extreme scores:</p><p>For example, \epsilon=0.1.</p><p>Important conceptual caveat</p><p>This formula implicitly treats more single people as positive, more births as positive, and loneliness as negative. That is a value choice rather than an empirically established measure of sentiment. Loneliness is also not measured consistently worldwide: a major review found usable population-level estimates for 113 countries/territories, often with different age groups, instruments, and survey years.[ <a href="https://pmc.ncbi.nlm.nih.gov/articles/PMC8826180/">pmc.ncbi.nlm.nih</a>]</p><p>If your intended meaning is “social wellbeing despite living alone,” a more defensible construction would make the denominator a broader negative-social-outcomes component and use directly comparable survey data. OECD evidence, for example, finds loneliness differs substantially by relationship status and household situation; across its covered countries, single people were more likely to report loneliness than partnered people.[ <a href="https://www.oecd.org/en/publications/social-connections-and-loneliness-in-oecd-countries_6df2d6a0-en/full-report/inequalities-in-social-connections-who-is-least-connected_46895541.html">oecd</a>]</p><p>A clear label would be: <strong>Birth-Singleness-Loneliness Composite (BSLC)</strong>, rather than “World Sentiment Index,” unless you later validate it against established wellbeing or life-satisfaction measures.</p><p>Best official source: WHO</p><p>The <strong>World Health Organization (WHO)</strong> is currently the main official source for global loneliness statistics. Its 2025 <strong>Commission on Social Connection</strong> report provides the most comprehensive recent global estimates:</p><ul><li>About <strong>15.8% of people worldwide</strong>, or approximately <strong>one in six</strong>, report loneliness.</li><li>The estimate covers different age groups and world regions.</li><li>Loneliness is higher among adolescents and young adults-about <strong>21%</strong>-than among older age groups.</li><li>About <strong>24.3%</strong> of people in low-income countries report loneliness, compared with approximately <strong>11%</strong> in high-income countries.</li><li>For older people, WHO reports a global loneliness estimate of approximately <strong>11.8%</strong>.[<a href="https://www.who.int/news-room/questions-and-answers/item/social-connection">who</a>][<a href="https://www.who.int/activities/reducing-social-isolation-and-loneliness-among-older-people">who</a>]</li></ul><p>The primary publication is <em>From loneliness to social connection: Charting a path to healthier societies</em>, issued by the WHO Commission on Social Connection in 2025.[ <a href="https://iris.who.int/handle/10665/381746">iris.who</a>][ <a href="https://www.who.int/publications/i/item/978240112360">who</a>]</p><p>Other useful official or quasi-official sources</p><h3>Gallup World Poll and Meta</h3><p>The <strong>Gallup World Poll</strong>, in collaboration with Meta, provides large-scale international survey data. Its loneliness question asks respondents how lonely they feel, with answers such as “very lonely” or “fairly lonely.” A WHO document cites a 2023 Gallup/Meta estimate of <strong>24% of the global population</strong> feeling very or fairly lonely.[ <a href="https://apps.who.int/gb/MSPI/pdf_files/2024/03/Item2_07-03.pdf">apps.who</a>]</p><p>This source is useful for country comparisons, but it may not be directly comparable with WHO’s 15.8% estimate because the question wording, survey population, fieldwork period, and calculation method differ.</p><h3>WHO Global Health Observatory</h3><p>The <strong>WHO Global Health Observatory</strong> is the appropriate place to look for downloadable health indicators and standardized country-level datasets. However, loneliness is still a developing statistical indicator and is not yet available with the same regular, uniform country coverage as indicators such as mortality, fertility, or life expectancy.</p><p>For a rigorous index, check whether the relevant WHO dataset includes:</p><ul><li>country or territory;</li><li>survey year;</li><li>age range;</li><li>sex;</li><li>question wording;</li><li>response scale;</li><li>loneliness definition;</li><li>sampling methodology.</li></ul><h3>United Nations and UN agencies</h3><p>The <strong>United Nations</strong> does not currently appear to provide a single, regularly updated, globally comparable loneliness indicator equivalent to its population, fertility, or poverty databases. UN agencies may publish relevant data on:</p><ul><li>household size;</li><li>living alone;</li><li>social isolation;</li><li>older persons;</li><li>mental health;</li><li>social protection;</li><li>family and household structure.</li></ul><p>These are useful supporting variables, but they should not be treated as direct measurements of loneliness. Living alone, for example, is not equivalent to feeling lonely.</p><p>Research datasets with broad coverage</p><p>The most extensive country coverage currently comes from research syntheses rather than a single official statistical database. A systematic review in the <em>BMJ</em> compiled nationally representative loneliness estimates from <strong>113 countries or territories</strong>, but it found serious gaps:</p><ul><li>adolescent data existed for 77 countries;</li><li>young-adult data existed for 30 countries;</li><li>middle-aged-adult data existed for 32 countries;</li><li>older-adult data existed for 40 countries;</li><li>adult data outside Europe were particularly limited.[<a href="https://www.bmj.com/content/376/bmj-2021-067068">bmj</a>]</li></ul><p>This dataset is valuable for historical or academic analysis, but it combines surveys using different instruments, age groups, and years. It should therefore not be treated as a perfectly harmonized annual world panel.</p><p>Recommendation for your WSI</p><p>For your World Sentiment Index, use the WHO 2025 estimate as the <strong>global reference value</strong>, but do not automatically mix it with country values from unrelated surveys.</p><p>A defensible approach would be:</p><ol><li>Use one loneliness question or scale consistently across all countries.</li><li>Use the same reference year, or apply a clearly documented time window.</li><li>Separate age groups, especially adolescents, working-age adults, and older adults.</li><li>Store the loneliness percentage as a proportion: 16% becomes 0.16.</li><li>Record a data-quality flag for countries without nationally representative data.</li><li>Avoid filling missing countries with the global average unless you explicitly model the uncertainty.</li></ol><p>For a global benchmark, you could use:</p><p>based on the WHO estimate of approximately 15.8%.[ <a href="https://www.who.int/news-room/questions-and-answers/item/social-connection">who</a>]</p><p>However, for a country-level WSI, the best practical source is likely a harmonized Gallup/Meta series or a standardized WHO-linked dataset, provided that the country observations use comparable wording and methodology.</p><p>What is the correlation between birth rate and single people?</p><p>There is generally a <strong>negative relationship between the share of people who are unpartnered and the birth rate</strong>, but it is not universal and depends strongly on how “single” is defined.</p><p>Main relationship</p><p>Births usually occur within a partnership-marriage or cohabitation-so a larger share of people without a partner tends to mean fewer potential parents and fewer births. Recent demographic research finds that declining partnership rates contributed to declining fertility, particularly through fewer first births.[ <a href="https://link.springer.com/article/10.1007/s12546-025-09382-1?error=cookies_not_supported&amp;code=835ef0d1-4633-4a64-b42b-2c1fa7637056">link.springer</a>][ <a href="https://pmc.ncbi.nlm.nih.gov/articles/PMC9127029/">pmc.ncbi.nlm.nih</a>]</p><p>A simplified relationship is:</p><p>where:</p><ul><li>B = overall fertility or birth rate;</li><li>P = proportion of people in a partnership;</li><li>F_P = fertility among partnered people;</li><li>F_S = fertility among unpartnered people.</li></ul><p>Because F_P is usually substantially higher than F_S, a decline in P normally lowers B.</p><p>Why the correlation is not simply “more marriage = more births”</p><p>The word “single” can conceal several different situations:</p><p>Never partnered</p><p>Usually associated with fewer births</p><p>Temporarily unpartnered</p><p>May have little effect over the life course</p><p>Divorced or separated</p><p>Often associated with delayed or foregone births</p><p>Cohabiting but unmarried</p><p>Can have fertility close to that of married couples in some countries</p><p>Single parent</p><p>Already has children, so this is not a measure of childlessness</p><p>Living alone</p><p>Not equivalent to being unpartnered</p><p>In countries where cohabitation is socially accepted, many births occur outside marriage but still within stable couples. OECD evidence reports that births outside marriage are increasingly common, and that a large proportion occur to cohabiting rather than truly unpartnered parents.[ <a href="https://link.springer.com/article/10.1007/s12546-025-09382-1?error=cookies_not_supported&amp;code=835ef0d1-4633-4a64-b42b-2c1fa7637056">link.springer</a>][ <a href="https://www.demographic-research.org/volumes/vol19/6/19-6.pdf">demographic-research</a>]</p><p>Cross-country pattern</p><p>Historically, countries with low marriage rates often also had low fertility. However, this relationship changed in parts of Europe:</p><ul><li>In countries such as France, Sweden, Norway, Iceland, and Slovenia, cohabitation is common and births outside marriage are relatively frequent.</li><li>These countries can have relatively high fertility despite lower marriage rates.</li><li>In countries where people remain unpartnered for longer and cohabitation is less likely to lead to children, lower partnership rates are more strongly associated with low fertility.</li></ul><p>Research on Europe describes this as a shift from a formerly negative relationship between marriage and fertility to a more positive relationship between partnership formation and fertility, regardless of whether the partnership is formal marriage or cohabitation.[ <a href="https://www.demographic-research.org/volumes/vol19/6/19-6.pdf">demographic-research</a>]</p><p>Correlation versus causation</p><p>A country-level correlation does not prove that being single directly causes a low birth rate. Both may be influenced by:</p><ul><li>housing costs;</li><li>economic insecurity;</li><li>education and employment;</li><li>age at first partnership;</li><li>access to contraception;</li><li>childcare availability;</li><li>gender equality;</li><li>cultural acceptance of non-marital births;</li><li>fertility intentions;</li><li>migration and population age structure.</li></ul><p>For example, a country may have a low birth rate because people postpone parenthood, which also leaves more people temporarily single at younger ages. In that case, delayed fertility and delayed partnering partly reflect the same underlying conditions.</p><p>Recent analysis of Nordic countries found that lower fertility within partnerships explained more of the decline in first births than changing partnership patterns alone, although reduced partnering still made a measurable contribution.[ <a href="https://pmc.ncbi.nlm.nih.gov/articles/PMC9127029/">pmc.ncbi.nlm.nih</a>]</p><p>Implication for your WSI</p><p>If “single people” means <strong>unpartnered adults</strong>, you should expect the birth-rate component and the single-person component to be partly inversely related. Multiplying them in</p><p>may therefore produce a counterintuitive result: countries with <strong>more single people and fewer births</strong> could receive a lower score because the birth-rate term dominates.</p><p>For analysis, I would recommend using:</p><p>rather than “share of unmarried people.” The OECD Family Database is a useful source for comparable family and partnership indicators, while UN Population Division data provides fertility and birth-related demographic estimates.[ <a href="https://www.oecd.org/en/data/datasets/oecd-family-database.html">oecd</a>][ <a href="https://www.un.org/development/desa/pd/content/fertility-and-marriage-0">un</a>]</p><p>Before calculating the index, compute the actual correlation on matched country-year observations:</p><p>Use the same year, age range, population definition, and geographic coverage for both variables. A Spearman rank correlation may be preferable if the relationship is non-linear or affected by outliers.</p><p>The OECD Family &amp; Fertility Atlas dashboard</p><p>Build a dashboard comparing the proportion of single individuals versus total fertility rates across 35 OECD countries from 2000 to 2025. Include visualizations mapping the rise in non-marital births, the share of children living with single parents (vs cohabiting parents), and the correlation between the decline in partnership rates and national birth rate declines. Extract data from the OECD Family Database to highlight which countries show decoupling of marriage and childbearing, and identify if single-parent household growth explains significant fertility variance</p><p>The OECD Family &amp; Fertility Atlas dashboard is ready in the attached preview. It covers 35 OECD countries with 7 sections of visualizations, statistical analysis, and a sortable data table — all built from OECD Family Database indicators (SF2.1, SF2.4, SF1.2, SF3.1, SF1.1).</p><p><strong>Key findings the dashboard surfaces:</strong></p><ul><li>31 of 35 countries saw TFR decline since 2000; only Hungary, Czechia, Slovak Republic, and Slovenia bucked the trend</li><li>Non-marital births rose in 32/35 countries, with Portugal, Spain, and Mexico showing the largest increases</li><li>Portugal, Italy, and Spain lead the “decoupling” of marriage and childbearing</li><li>Single-parent child-share growth shows low explanatory power for TFR variance (R² = 0.03), while marriage and non-marital changes together explain more (R² = 0.32–0.43)</li></ul><p>The dashboard is fully responsive (verified at 375px mobile and 1400px desktop), with working theme toggle, sortable TFR chart, sortable data table, and direct links to the source Excel files.</p><p>What would you like to do next?</p><ul><li>Keep iterating on the preview</li><li>Publish it to a pplx.app link</li><li>Deploy it via the Vercel connector</li><li>Open the attached app to share it (the Share dropdown has an “Allow remix” option so viewers can fork and build their own version)</li></ul><p>What has the greater correlation impact: single people causes less birthrate or less birthrate causes single people (singlehood)?</p><p>That’s a causation question our correlational data can’t settle on its own — but let me ground the answer in what the numbers actually show plus the demographic literature on causal direction.</p><p>The academic literature is clear that neither direction can be cleanly identified from cross-country correlational data — but the evidence leans toward <strong>delayed partnership formation (and delayed marriage) being a larger driver of fertility decline</strong> than the reverse.</p><p>Here’s the specific evidence behind that conclusion:</p><p><strong>Evidence that singlehood drives down birth rates more strongly (partnership → fertility):</strong></p><ul><li>A demographic review of partnership dynamics and fertility found that partnership postponement generally reduces or delays fertility, especially where non-marital childbearing is uncommon — for example, in Italy and Spain, where childbearing outside marriage remains rare, marriage postponement is a direct brake on fertility. A Sweden-Spain comparison showed later partnership formation in Spain explained a substantial portion of its lower fertility.[<a href="https://www.demographic-research.org/volumes/vol52/7/52-7.pdf">demographic-research</a>]</li><li>A Finnish decomposition study cited there found that declining marriage rates accounted for <strong>19% of the decline in first-birth rates from 2000–2018</strong>, while declining fertility within partnerships explained the rest.</li><li>Research on the Second Demographic Transition frames rising singlehood and delayed union formation as upstream causes of delayed and reduced childbearing, especially in East Asia, where marriage postponement began well before cohabitation became common.[<a href="https://genus.springeropen.com/articles/10.1186/s41118-020-00077-4">genus.springeropen</a>]</li></ul><p><strong>Evidence that declining fertility also feeds back into singlehood (fertility → partnership):</strong></p><ul><li>The same review notes that people who don’t plan to have children soon feel less need to find a partner, and that pregnancy often motivates cohabitation or marriage — meaning the relationship runs in both directions.</li><li>In several post-socialist countries, fertility decline followed an economic shock rather than a shift in marriage behavior, suggesting that in some contexts fertility moves first.</li><li>The review explicitly flags that partnership formation and childbearing are <strong>jointly determined</strong> by shared confounders like education, economic stability, and religiosity — characteristics that predispose people to delay both marriage and parenthood.</li></ul><p><strong>The key takeaway from the academic literature is that these aren’t independent processes to rank by causation — they’re part of a single feedback loop with shared upstream drivers</strong> (economic uncertainty, female education, rising individualism, cost of living). Trying to isolate “singlehood causes low birth rates” vs. “low birth rates cause singlehood” is a false dichotomy — the Second Demographic Transition framework treats both as joint symptoms of deeper cultural and structural change, not as one being the upstream cause of the other.[ <a href="https://www.pnas.org/doi/abs/10.1073/pnas.1420441111">pnas</a>]</p><p>Our dashboard’s R²=0.32 result (marriage rate changes predicting TFR changes) is consistent with this — a moderate correlation, not a decisive causal arrow.</p><p><em>Originally published at </em><a href="https://maxbox6.wordpress.com/wsindex/"><em>http://maxbox6.wordpress.com</em></a><em> on September 16, 2026.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=27801f27b9ab" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GEO Intelligence]]></title>
            <link>https://medium.com/@breitsch2/geo-intelligence-a2b19aae10ff?source=rss-2218ff386d6------2</link>
            <guid isPermaLink="false">https://medium.com/p/a2b19aae10ff</guid>
            <category><![CDATA[machine-learning-tools]]></category>
            <category><![CDATA[machine-learning-ai]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Breitsch]]></dc:creator>
            <pubDate>Sun, 22 Mar 2026 10:24:24 GMT</pubDate>
            <atom:updated>2026-05-15T09:39:33.041Z</atom:updated>
            <content:encoded><![CDATA[<p>We set the focus on 4–5 APIs to extract information from maps or pictures. Geospatial <a href="https://www.sciencedirect.com/topics/computer-science/artificial-intelligence">Artificial Intelligence</a> (GeoAI), as the integration of geospatial studies and AI, has become one of the fastest-developing research directions in spatial data science and <a href="https://www.sciencedirect.com/topics/earth-and-planetary-sciences/geography">geography</a>.</p><ol><li>Object Detection API</li><li>Image to Text API</li><li>Language Translator</li><li>Country, Capital API</li><li>Image Random Generator (to train data)</li></ol><p>Lets take a look at the following scene:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/0*n9ifcGV3MrNCyol4" /></figure><p>You see houses, cars, a fence, maybe something like a human being, you see clouds and trees and also an unidentified object bottom right behind the fence (maybe a bench). Also hidden information (as a white watermark) is behind the fence above two cars from “© 2025 Google” or a white and red marked torch, could be a train barrier. So the quesion is: Where it is in the meaning of the location? A first approach could be a similarity search or a simple object detection, but the challenge is growing.</p><p>The second are correlated objects. True intelligence can be the ability to confirm the probability of one object by a second, correlated object. In the example of the <strong>fence</strong> above, there are usually <strong>cars</strong> in front of the fence; so the probabilty of a fence gains in addition!</p><p>This rapid change in the field calls for a <a href="https://www.sciencedirect.com/topics/computer-science/deep-understanding">deeper understanding</a> of the recent developments and envision where the field is going in the near future. So lets practice with the first API. The Object Detection API provides fast and accurate image object recognition using advanced neural networks developed by machine learning experts. Given an input image, return a list of detected objects labels, confidence percentages and bounding boxes. Objects with confidence less than 0.3 (30%) are filtered out.</p><pre>function PyCodeGeoJSON_ObjectDetect(imgpath, aAPIKey: string): string; begin with TPythonEngine.Create(Nil) do begin //pythonhome:= &#39;C:\Users\User\AppData\Local\Programs\Python\Python314\&#39;; try loadDLL; autofinalize:= false; ExecString(&#39;import requests, geojson&#39;); //execstr(&#39;point = geojson.Point((8.5417, 47.3769)) # (longitude, latitude))&#39;); ExecStr(&#39;url= &quot;https://api.api-ninjas.com/v1/objectdetection&quot;&#39;); ExecStr(&#39;image_file_descriptor = open(&quot;&#39;+imgpath+&#39;&quot;,&quot;rb&quot;)&#39;); ExecStr(&#39;headers= {&quot;X-Api-Key&quot;:&quot;&#39;+aAPIKey+&#39;&quot;}&#39;); ExecStr(&#39;files = {&quot;image&quot;: image_file_descriptor} &#39;); ExecStr(&#39;r = requests.post(url, headers=headers, files=files)&#39;); result:= (EvalStr(&#39;r.json()&#39;)); except raiseError; finally Free; end; end; end;</pre><pre>function PyCodeGeoJSON_ObjectDetect(imgpath, aAPIKey: string): string;<br>begin<br>  with TPythonEngine.Create(Nil) do begin<br>  //pythonhome:= &#39;C:\Users\User\AppData\Local\Programs\Python\Python314\&#39;;<br>  try<br>    loadDLL;<br>    autofinalize:= false;<br>    ExecString(&#39;import requests, geojson&#39;);<br>    //execstr(&#39;point = geojson.Point((8.5417, 47.3769))  # (longitude, latitude))&#39;);<br>    ExecStr(&#39;url= &quot;https://api.api-ninjas.com/v1/objectdetection&quot;&#39;); <br>    ExecStr(&#39;image_file_descriptor = open(&quot;&#39;+imgpath+&#39;&quot;,&quot;rb&quot;)&#39;);  <br>    ExecStr(&#39;headers= {&quot;X-Api-Key&quot;:&quot;&#39;+aAPIKey+&#39;&quot;}&#39;); <br>    ExecStr(&#39;files = {&quot;image&quot;: image_file_descriptor}  &#39;);<br>    ExecStr(&#39;r = requests.post(url, headers=headers, files=files)&#39;);<br>    result:= (EvalStr(&#39;r.json()&#39;)); <br>  except<br>    raiseError;        <br>  finally      <br>    Free;<br>  end; <br> end;<br>end; </pre><p>Real Python Template:</p><pre>import requests api_url = &#39;https://api.api-ninjas.com/v1/objectdetection&#39; image_file_descriptor = open(&#39;YOUR_IMAGE.jpeg&#39;, &#39;rb&#39;) files = {&#39;image&#39;: image_file_descriptor} r = requests.post(api_url, files=files, headers={&#39;X-Api-Key&#39;: &#39;YOUR_API_KEY&#39;}) print(r.json())</pre><pre>import requests<br> <br>api_url = &#39;https://api.api-ninjas.com/v1/objectdetection&#39;<br>image_file_descriptor = open(&#39;YOUR_IMAGE.jpeg&#39;, &#39;rb&#39;)<br>files = {&#39;image&#39;: image_file_descriptor}<br>r = requests.post(api_url, files=files, headers={&#39;X-Api-Key&#39;: &#39;YOUR_API_KEY&#39;})<br>print(r.json())</pre><p>A JSON array of objects, each representing a detected object with its label, confidence score, and bounding box coordinates, or <a href="https://api-ninjas.com/error-codes">an error</a> if the request is unsuccessful. It finds 32 objects like this:</p><pre>[{&#39;label&#39;: &#39;car&#39;, &#39;confidence&#39;: &#39;0.78&#39;, &#39;bounding_box&#39;: {&#39;x1&#39;: &#39;253&#39;, &#39;y1&#39;: &#39;455&#39;, &#39;x2&#39;: &#39;458&#39;, &#39;y2&#39;: &#39;540&#39;}},{&#39;label&#39;: &#39;fence&#39;,</pre><p>You can play around this with my script or a live demo online:</p><p><a href="https://api-ninjas.com/api/objectdetection">Object Detection API — API Ninjas</a> <a href="https://sourceforge.net/projects/maxbox5/files/examples/1473_Geo_Intelligence_API1_4.txt/download">Download 1473_Geo_Intelligence_API1_4.txt (maXbox5)</a> <a href="https://sourceforge.net/projects/maxbox5/files/examples/1473_Geo_Intelligence_API1_4.txt/download">https://sourceforge.net/projects/maxbox5/files/examples/1473_Geo_Intelligence_API1_4.txt/download</a></p><p>The next step is to extract text, chars or signs from the fetched landscape. The Image <strong>to</strong> Text API detects <strong>and</strong> extracts text from images using state- <strong>of</strong>-the-art optical <br>character recognition (OCR) algorithms. It can detect texts <strong>of</strong> different sizes, fonts, <strong>and</strong> even handwriting.</p><pre>function PyCode2imagetotext2(imgpath, aAPIKey: string): string; begin with TPythonEngine.Create(Nil) do begin try loadDLL; autofinalize:= false; ExecString(&#39;import requests&#39;); ExecStr(&#39;api_url= &quot;https://api.api-ninjas.com/v1/imagetotext&quot;&#39;); //ExecStr(&#39;image_file_descriptor = open(r&#39;+imgpath+&#39;, &quot;rb&quot;)&#39;); ExecStr(&#39;image_file_descriptor = open(r&quot;&#39;+imgpath+&#39;&quot;, &quot;rb&quot;)&#39;+lf+ &#39;files = {&quot;image&quot;: image_file_descriptor}&#39;+lf+ &#39;headers= {&quot;X-Api-Key&quot;:&quot;&#39;+aAPIKey+&#39;&quot;}&#39;+lf+ &#39;r = requests.post(api_url, headers=headers, files=files)&#39;); result:= ((EvalStr(&#39;r.json()&#39;))); except raiseError; finally free; end; end; end;</pre><pre>function PyCode2imagetotext2(imgpath, aAPIKey: string): string;<br>begin<br>  with TPythonEngine.Create(Nil) do begin<br>  try<br>    loadDLL;<br>    autofinalize:= false;<br>    ExecString(&#39;import requests&#39;);<br>    ExecStr(&#39;api_url= &quot;https://api.api-ninjas.com/v1/imagetotext&quot;&#39;); <br>    //ExecStr(&#39;image_file_descriptor = open(r&#39;+imgpath+&#39;, &quot;rb&quot;)&#39;);  <br>    ExecStr(&#39;image_file_descriptor = open(r&quot;&#39;+imgpath+&#39;&quot;, &quot;rb&quot;)&#39;+lf+<br>            &#39;files = {&quot;image&quot;: image_file_descriptor}&#39;+lf+<br>            &#39;headers= {&quot;X-Api-Key&quot;:&quot;&#39;+aAPIKey+&#39;&quot;}&#39;+lf+<br>            &#39;r = requests.post(api_url, headers=headers, files=files)&#39;);<br>    result:= ((EvalStr(&#39;r.json()&#39;))); <br>  except<br>    raiseError;        <br>  finally      <br>    free;<br>  end; <br> end;<br>end; </pre><p>When you got the error debug: 95-SyntaxError: unexpected character after line continuation character (line 1, offset 33): ‘image_file_descriptor = open(r.\examples\geocitytextrandimage0221.jpg, “rb”)’ 937 err:20 then you change ExecStr(‘image_file_descriptor = open(r’+imgpath+’, “rb”)’); <strong>to</strong> ExecStr(‘image_file_descriptor = open( <strong>r”’+imgpath+’”, “rb”</strong>)’);</p><p>The result can be:</p><pre>[[&quot;[{&#39;text&#39;: &#39;Supertramp&#39;, &#39;bounding_box&#39;: {&#39;x1&#39;: 148, &#39;y1&#39;: 26, &#39;x2&#39;: 262, &#39;y2&#39;: 46}}, {&#39;text&#39;: &#39;偶数&#39;, &#39;bounding_box&#39;: {&#39;x1&#39;: 285, &#39;y1&#39;: 26, &#39;x2&#39;: 334, &#39;y2&#39;: 42}},</pre><p>Then in a process pipeline 1–4 we translate the extracted text in for example japanese (like above):</p><pre>function Text_to_translate_API54(AURL,aclient,lngorig,lngtarget,atext: string):string; var httpq: THttpRequestC; //THttpConnectionWinInet; jo: TJSON; jarr:TJsonArray2; urlback: string; begin httpq:= THttpRequestC.create(self); httpq.headers.add(&#39;Accept: application/json; charset=utf-8&#39;); //httpq.SecurityOptions:= [soSsl3,soPct,soIgnoreCertCNInvalid]; try writ(&#39;requrl: &#39;+wideFormat(AURL,[lngorig,lngtarget,atext])); httpq.Get(wideFormat(AURL,[lngorig,lngtarget,atext])); writ(&#39;http get status &#39;+itoa(httpq.response.statuscode2)); urlback:= httpq.response.ContentAsUTF8String; writ(&#39;ctype transback: &#39;+(httpq.response.Contenttype)); jo:= TJSON.Create(); jo.parse(urlback); jarr:= jo.JsonArray; if httpq.response.statuscode2=200 Then result:=jarr[0].decode(urlback) else result:=&#39;REST API Failed:&#39;+ itoa(Httpq.response.statuscode2)+httpq.response.headers.tostring; except writ(&#39;EWI_HTTP: &#39;+ExceptiontoString(exceptiontype,exceptionparam)); finally httpq.free; httpq:= Nil; jo.free; end; end;</pre><pre>function Text_to_translate_API54(AURL,aclient,lngorig,lngtarget,atext: string):string;<br>var httpq: THttpRequestC; //THttpConnectionWinInet;<br>    jo: TJSON; jarr:TJsonArray2; urlback: string;<br>  begin<br>    httpq:= THttpRequestC.create(self); <br>    httpq.headers.add(&#39;Accept: application/json; charset=utf-8&#39;);<br>    //httpq.SecurityOptions:= [soSsl3,soPct,soIgnoreCertCNInvalid];<br>    try<br>       writ(&#39;requrl: &#39;+wideFormat(AURL,[lngorig,lngtarget,atext]));<br>       httpq.Get(wideFormat(AURL,[lngorig,lngtarget,atext]));<br>       writ(&#39;http get status &#39;+itoa(httpq.response.statuscode2));<br>       urlback:= httpq.response.ContentAsUTF8String;<br>       writ(&#39;ctype transback: &#39;+(httpq.response.Contenttype));<br>       jo:= TJSON.Create();<br>       jo.parse(urlback); <br>       jarr:= jo.JsonArray;<br>       if httpq.response.statuscode2=200 Then<br>          result:=jarr[0].decode(urlback)<br>       else result:=&#39;REST API Failed:&#39;+<br>                 itoa(Httpq.response.statuscode2)+httpq.response.headers.tostring; <br>    except<br>       writ(&#39;EWI_HTTP: &#39;+ExceptiontoString(exceptiontype,exceptionparam));<br>    finally<br>       httpq.free;<br>       httpq:= Nil;<br>       jo.free;<br>    end; <br>  end;</pre><p>We use a Google API endpoint.</p><p><a href="https://clients5.google.com/translate_a/t?client=dict-chrome-ex&amp;sl=%s&amp;tl=%s&amp;q=%s">https://clients5.google.com/translate_a/t?client=dict-chrome-ex&amp;sl=%s&amp;tl=%s&amp;q=%s</a>;</p><p>You can combine maXbox with the (official or unofficial) Google Translate API for many more things than just “translate one text and show the result”. <a href="https://www.scribd.com/document/634908932/Maxbox-Starter109-Translate-API">scribd+4</a>. The last step is to gain information concerning the detected country, city or location with the Country API which provides key geographic, demographic, <strong>and</strong> economic statistics about every country <strong>in</strong> the world. For flag images of countries, check out the <a href="https://api-ninjas.com/api/countryflag">Country Flag API</a> instead.</p><p><a href="https://api-ninjas.com/api/country">Country API — API Ninjas</a></p><pre>const URL_APILAY_GEOCOUNTRY= &#39;https://api.api-ninjas.com/v1/country?name=%s&#39;; function APIGetGeoCountry(AURL,url_name,aAPIKey: string): string; var encodedURL:String; begin encodedURL:= Format(AURL,[urlencode(url_name)]); with THttpRequestC.create(self) do try writ(&#39;reqsend: &#39;+encodedurl) headers.add(&#39;X-Api-Key:&#39;+aAPIkey); if Get(encodedURL) then result:= (Response.ContentAsString) else Writeln(&#39;APIError &#39;+inttostr(Response.StatusCode2)); except writeln(&#39;HTTPS: &#39;+ExceptiontoString(exceptiontype,exceptionparam)); finally free; end; end;</pre><pre>const URL_APILAY_GEOCOUNTRY= &#39;https://api.api-ninjas.com/v1/country?name=%s&#39;;<br>  <br>function APIGetGeoCountry(AURL,url_name,aAPIKey: string): string;<br>var encodedURL:String;<br> begin<br>   encodedURL:= Format(AURL,[urlencode(url_name)]);<br>   with THttpRequestC.create(self) do<br>     try<br>       writ(&#39;reqsend: &#39;+encodedurl)<br>       headers.add(&#39;X-Api-Key:&#39;+aAPIkey);<br>       if Get(encodedURL) then<br>          result:= (Response.ContentAsString)<br>       else Writeln(&#39;APIError &#39;+inttostr(Response.StatusCode2));<br>     except<br>       writeln(&#39;HTTPS: &#39;+ExceptiontoString(exceptiontype,exceptionparam));<br>     finally<br>       free;<br>     end;<br> end;  </pre><p>The Geo Code</p><p>Most of the code is Delphi, Python4Delphi or Python itself (3.14.3 (tags/v3.14.3:323c59a, Feb 3 2026, 16:04:56) [MSC v.1944 64 bit (AMD64)]). As a last note is the Image Random Generator which generates random images for all your placeholder and design needs. It supports custom sizes as well as custom image categories as in my examples GEO Data.</p><p>You also need an API Key which has the format</p><pre>headers.add(&#39;X-Api-Key:&#39;+aAPIkey);</pre><p>otherwise you get the error: debug: 179-The requested header could <strong>not</strong> be located. 939 err:20 HTTPS: Exception: The requested header could <strong>not</strong> be located.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*ZOahyN58m2ih_rg3" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*nYaUI8RUk8yJo7SB" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*eNnR07Ox4EwAFRf4" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*fspJh68vf92zv2t5" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*J1EJBvHw12Hh8XIy" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*sxeEU947WTz2Oywh" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*G40RW4IJsUZ2fM6N" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*jiVgfDNJpYXEjBbq" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*k2q3jFYux0kUbNxg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*zpa16OQcU2xIIcO4" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*QnCbMok3yNXLI4u6" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*qsSlscFwDgiCvQmT" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*uTW1xo-8EHqLyWU5" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*FrGlSNqBr_mE7GQL" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*k_LBerGdEGGqrtDV" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*IYlO74wEG9TsFBni" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*eL9Ri33q6h6QyaBM" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*iEnuEisA-hok5kOb" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*T9DTFILPg7pTl_cj" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*CoXQcBIitj766jjV" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*v79wWmv78Om3x399" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*3bUMwekhJf7Tyc2R" /></figure><p>Conclusion</p><p>The use of artificial intelligence in the GIS context as the name <strong>GEOINT</strong> suggests has evolved in recent years from specialized applications to a wide range of innovative and useful technologies. For years ago, GeoAI or GEO Intelligence was mainly used in the field of computer vision for object and pattern recognition in aerial or railway images and for classifying data point clouds. Since then, the range of applications has expanded significantly, including the field of evaluating environmantal time series to identify trends, meteo or anomalies.</p><p>References:</p><p><a href="https://teetrains.wordpress.com/2026/03/17/geojson-in-osm/">GeoJSON in OSM — Trans Europ Express</a> <a href="https://maxbox6.wordpress.com/2026/02/11/free-google-translator-api-ii/">Free</a></p><p><a href="https://maxbox6.wordpress.com/2026/02/11/free-google-translator-api-ii/">Google Translator API II — maXbox6</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/0*xkx8wUEyNghYl250" /><figcaption>mX5.2.9 API Process Pipeline</figcaption></figure><p>To draw a bounding box What is a Bounding Box?</p><p>A bounding box (BBox) is a fundamental concept in GIS and mapping applications, used to define the minimum rectangular extent of a geographic area. It precisely describes the boundaries of a geographic region using four coordinate values: minimum longitude, minimum latitude, maximum longitude, and maximum latitude.</p><pre>const testRawJSONStringObject = &#39;{&quot;detections&quot;:[{&quot;label&quot;: &quot;dining table&quot;, &quot;confidence&quot;: &quot;0.63&quot;, &quot;bounding_box&quot;: {&quot;x1&quot;: &quot;122&quot;, &quot;y1&quot;: &quot;308&quot;, &quot;x2&quot;: &#39;+ &#39;&quot;604&quot;, &quot;y2&quot;: &quot;679&quot;}}, {&quot;label&quot;: &quot;bench&quot;, &quot;confidence&quot;: &quot;0.57&quot;, &quot;bounding_box&quot;: {&quot;x1&quot;: &quot;122&quot;, &quot;y1&quot;: &#39;+ &#39;&quot;308&quot;, &quot;x2&quot;: &quot;604&quot;, &quot;y2&quot;: &quot;679&quot;}}, {&quot;label&quot;: &quot;bench&quot;, &quot;confidence&quot;: &quot;0.41&quot;, &quot;bounding_box&quot;: {&quot;x1&quot;: &#39;+ &#39;&quot;93&quot;, &quot;y1&quot;: &quot;119&quot;, &quot;x2&quot;: &quot;615&quot;, &quot;y2&quot;: &quot;665&quot;}}, {&quot;label&quot;: &quot;dining table&quot;, &quot;confidence&quot;: &#39;+ &#39;&quot;0.37&quot;, &quot;bounding_box&quot;: {&quot;x1&quot;: &quot;92&quot;, &quot;y1&quot;: &quot;115&quot;, &quot;x2&quot;: &quot;617&quot;, &quot;y2&quot;: &quot;667&quot;}}, {&quot;label&quot;: &#39;+ &#39;&quot;bed&quot;, &quot;confidence&quot;: &quot;0.35&quot;, &quot;bounding_box&quot;: {&quot;x1&quot;: &quot;98&quot;, &quot;y1&quot;: &quot;173&quot;, &quot;x2&quot;: &quot;617&quot;, &quot;y2&quot;: &#39;+ &#39; &quot;670&quot;}}, {&quot;label&quot;: &quot;bench&quot;, &quot;confidence&quot;: &quot;0.32&quot;, &quot;bounding_box&quot;: {&quot;x1&quot;: &quot;316&quot;, &quot;y1&quot;: &#39;+ &#39;&quot;537&quot;, &quot;x2&quot;: &quot;521&quot;, &quot;y2&quot;: &quot;671&quot;}}, {&quot;label&quot;: &quot;chair&quot;, &quot;confidence&quot;: &quot;0.3&quot;, &quot;bounding_box&quot;: &#39;+ &#39;{&quot;x1&quot;: &quot;149&quot;, &quot;y1&quot;: &quot;339&quot;, &quot;x2&quot;: &quot;583&quot;, &quot;y2&quot;: &quot;673&quot;}}]} &#39;; procedure DrawboundingboxfromJSON(rawjsonstr, afilepath: string); //uses //System.JSON, Vcl.Graphics; var JsonObj: TJSONObject2; BBox: TJSONObject2; Bboxarray: TJsonArray2; x1, y1, x2, y2: Integer; Bmp: TBitmap; begin // 1) Parse JSON string (from file or HTTP) //JsonObj := TJSONObject.ParseJSONValue(RawJsonStr) as TJSONObject; JsonObj := TJSONobject2.Create(nil); jsonobj.Parse(RawJsonStr); // as TJSONObject2; writ(jsonobj.stringify) try //BBox := JsonObj.Get24(&#39;bounding_box&#39;); // as TJSONObject; writ(&#39;found:&#39;+itoa(JsonObj.find(&#39;detections&#39;))); // as TJSONObject; BBoxarray := JsonObj.Values[&#39;detections&#39;].asarray; // as TJSONObject; writ(&#39;arr count label &#39;+itoa(bboxarray.count)) Bbox:= BBoxarray.items[1].asobject; writeln(jsonobj[&#39;detections&#39;].asarray[0].asobject.items[2].name) bbox:= jsonobj[&#39;detections&#39;].asarray[0].asobject.values[&#39;bounding_box&#39;].asobject; x1 := (BBox.values[&#39;x1&#39;].asinteger); y1 := (BBox.values[&#39;y1&#39;].asinteger); x2 := (BBox.values[&#39;x2&#39;].asinteger); y2 := (BBox.values[&#39;y2&#39;].asinteger); writ(&#39;x,y: &#39;+itoa(x1)+&#39; &#39;+itoa(y1)); // 2) Create or use an existing bitmap or jpeg Bmp := TBitmap.Create; try // Load your image: Bmp.LoadFromFile(afilepath); // or whatever source // Set pen and brush for the box Bmp.Canvas.Pen.Color := clRed; Bmp.Canvas.Pen.Width := 10; Bmp.Canvas.Brush.Style := bsClear; // 3) Draw the bounding box Bmp.Canvas.Rectangle(x1, y1, x2, y2); //[web:14] // You can now show it in a TImage or save it: //Image1.Picture.Assign(Bmp); Bmp.SaveToFile(exepath+&#39;examples\geoimage_with_box.bmp&#39;); finally Bmp.Free; end; finally JsonObj.Free; end; end;</pre><pre>const testRawJSONStringObject =                                                                         <br>   &#39;{&quot;detections&quot;:[{&quot;label&quot;: &quot;dining table&quot;, &quot;confidence&quot;: &quot;0.63&quot;, &quot;bounding_box&quot;: {&quot;x1&quot;: &quot;122&quot;, &quot;y1&quot;: &quot;308&quot;, &quot;x2&quot;:  &#39;+<br>   &#39;&quot;604&quot;, &quot;y2&quot;: &quot;679&quot;}}, {&quot;label&quot;: &quot;bench&quot;, &quot;confidence&quot;: &quot;0.57&quot;, &quot;bounding_box&quot;: {&quot;x1&quot;: &quot;122&quot;, &quot;y1&quot;: &#39;+<br>   &#39;&quot;308&quot;, &quot;x2&quot;: &quot;604&quot;, &quot;y2&quot;: &quot;679&quot;}}, {&quot;label&quot;: &quot;bench&quot;, &quot;confidence&quot;: &quot;0.41&quot;, &quot;bounding_box&quot;: {&quot;x1&quot;: &#39;+<br>   &#39;&quot;93&quot;, &quot;y1&quot;: &quot;119&quot;, &quot;x2&quot;: &quot;615&quot;, &quot;y2&quot;: &quot;665&quot;}}, {&quot;label&quot;: &quot;dining table&quot;, &quot;confidence&quot;:             &#39;+<br>   &#39;&quot;0.37&quot;, &quot;bounding_box&quot;: {&quot;x1&quot;: &quot;92&quot;, &quot;y1&quot;: &quot;115&quot;, &quot;x2&quot;: &quot;617&quot;, &quot;y2&quot;: &quot;667&quot;}}, {&quot;label&quot;:            &#39;+<br>   &#39;&quot;bed&quot;, &quot;confidence&quot;: &quot;0.35&quot;, &quot;bounding_box&quot;: {&quot;x1&quot;: &quot;98&quot;, &quot;y1&quot;: &quot;173&quot;, &quot;x2&quot;: &quot;617&quot;, &quot;y2&quot;:          &#39;+<br>   &#39; &quot;670&quot;}}, {&quot;label&quot;: &quot;bench&quot;, &quot;confidence&quot;: &quot;0.32&quot;, &quot;bounding_box&quot;: {&quot;x1&quot;: &quot;316&quot;, &quot;y1&quot;:             &#39;+<br>   &#39;&quot;537&quot;, &quot;x2&quot;: &quot;521&quot;, &quot;y2&quot;: &quot;671&quot;}}, {&quot;label&quot;: &quot;chair&quot;, &quot;confidence&quot;: &quot;0.3&quot;, &quot;bounding_box&quot;:         &#39;+<br>   &#39;{&quot;x1&quot;: &quot;149&quot;, &quot;y1&quot;: &quot;339&quot;, &quot;x2&quot;: &quot;583&quot;, &quot;y2&quot;: &quot;673&quot;}}]}  &#39;;   <br> <br>procedure DrawboundingboxfromJSON(rawjsonstr, afilepath: string); <br> //uses<br>  //System.JSON, Vcl.Graphics;<br>var<br>  JsonObj: TJSONObject2;<br>  BBox: TJSONObject2;<br>  Bboxarray: TJsonArray2;<br>  x1, y1, x2, y2: Integer;<br>  Bmp: TBitmap;<br>begin<br>  // 1) Parse JSON string (from file or HTTP)<br>  //JsonObj := TJSONObject.ParseJSONValue(RawJsonStr) as TJSONObject;<br>  JsonObj := TJSONobject2.Create(nil);<br>  jsonobj.Parse(RawJsonStr); // as TJSONObject2;<br>  writ(jsonobj.stringify)<br>  try<br>    //BBox := JsonObj.Get24(&#39;bounding_box&#39;); // as TJSONObject;<br>    writ(&#39;found:&#39;+itoa(JsonObj.find(&#39;detections&#39;))); // as TJSONObject;<br>    BBoxarray := JsonObj.Values[&#39;detections&#39;].asarray; // as TJSONObject;<br>    writ(&#39;arr count label &#39;+itoa(bboxarray.count))<br>    Bbox:=   BBoxarray.items[1].asobject;<br>    writeln(jsonobj[&#39;detections&#39;].asarray[0].asobject.items[2].name)<br>    bbox:=  jsonobj[&#39;detections&#39;].asarray[0].asobject.values[&#39;bounding_box&#39;].asobject;<br>    x1 := (BBox.values[&#39;x1&#39;].asinteger);<br>    y1 := (BBox.values[&#39;y1&#39;].asinteger);<br>    x2 := (BBox.values[&#39;x2&#39;].asinteger);<br>    y2 := (BBox.values[&#39;y2&#39;].asinteger);<br>    writ(&#39;x,y: &#39;+itoa(x1)+&#39; &#39;+itoa(y1));<br>      // 2) Create or use an existing bitmap or jpeg<br>    Bmp := TBitmap.Create;<br>    try<br>      // Load your image:<br>      Bmp.LoadFromFile(afilepath); // or whatever source<br>      // Set pen and brush for the box<br>      Bmp.Canvas.Pen.Color := clRed;<br>      Bmp.Canvas.Pen.Width := 10;<br>      Bmp.Canvas.Brush.Style := bsClear;<br>      // 3) Draw the bounding box<br>      Bmp.Canvas.Rectangle(x1, y1, x2, y2);  //[web:14]<br>      // You can now show it in a TImage or save it:<br>      //Image1.Picture.Assign(Bmp);<br>      Bmp.SaveToFile(exepath+&#39;examples\geoimage_with_box.bmp&#39;);<br>    finally<br>      Bmp.Free;<br>    end;<br>  finally<br>    JsonObj.Free;<br>  end;<br>end;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/0*IVg0PArT9PhA7gES" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*7J0bnTfhPtkxVrQc" /></figure><p>JSON Iteration Bounding Box</p><pre>procedure DrawMultipleBoundingBoxesFromJSON(const AJsonStr, AImageFile: string); var Root : TJSONObject2; Dets : TJSONArray2; Item,BBox : TJSONObject2; i,x1,y1,x2,y2: Integer; Bmp : TBitmap; begin // 1) Parse Detect JSON root:= TJSONobject2.Create(nil); root.Parse(AJsonStr); // as TJSONObject; try Dets:= Root.Values[&#39;detections&#39;].asArray; //as TJSONArray; Bmp:= TBitmap.Create; try Bmp.LoadFromFile(AImageFile); Bmp.Canvas.Pen.Width:= 2; Bmp.Canvas.Brush.Style:= bsClear; // 2) Loop over detections for i:= 0 to Dets.Count-1 do begin Item:= Dets.Items[i].asObject; //as TJSONObject; BBox:= Item.Values[&#39;bounding_box&#39;].ASObject; x1:= (BBox.values[&#39;x1&#39;].asinteger); y1:= (BBox.values[&#39;y1&#39;].asinteger); x2:= (BBox.values[&#39;x2&#39;].asinteger); y2:= (BBox.values[&#39;y2&#39;].asinteger); writeln(item.values[&#39;label&#39;].asstring); writ(&#39;debug x,y: &#39;+itoa(i)+&#39;, &#39;+itoa(x1)+&#39; &#39;+itoa(y1)); // 3) Set color rect and label per box or class Bmp.Canvas.Pen.Color:= clGreen; // or map by class, etc. Bmp.Canvas.Rectangle(x1, y1, x2, y2); //[web:15] SetBkMode(bmp.Canvas.Handle, TRANSPARENT); Bmp.Canvas.Font.size:= 15; Bmp.Canvas.Font.Color:= clRed; Bmp.Canvas.TextOut(x1,y1, item.values[&#39;label&#39;].asstring); end; //Image1.Picture.Assign(Bmp); // show or save as jpeg //Bmp.SaveToFile(ChangeFileExt(AImageFile,exepath+&#39;examples\_with_boxes2.bmp&#39;)); Bmp.SaveToFile(exepath+&#39;examples\multigeoimage_with_box.bmp&#39;); finally Bmp.Free; end; finally Root.Free; end; end;</pre><pre>procedure DrawMultipleBoundingBoxesFromJSON(const AJsonStr, AImageFile: string);<br>var<br>  Root      : TJSONObject2;<br>  Dets      : TJSONArray2;<br>  Item,BBox : TJSONObject2;<br>  i,x1,y1,x2,y2: Integer;<br>  Bmp       : TBitmap;<br>begin<br>  // 1) Parse Detect JSON<br>  root:= TJSONobject2.Create(nil);<br>  root.Parse(AJsonStr); // as TJSONObject;<br>  try<br>    Dets:= Root.Values[&#39;detections&#39;].asArray; //as TJSONArray;<br>    Bmp:= TBitmap.Create;<br>    try<br>      Bmp.LoadFromFile(AImageFile);<br>      Bmp.Canvas.Pen.Width:= 2;<br>      Bmp.Canvas.Brush.Style:= bsClear;<br> <br>      // 2) Loop over detections<br>      for i:= 0 to Dets.Count-1 do begin<br>        Item:= Dets.Items[i].asObject; //as TJSONObject;<br>        BBox:= Item.Values[&#39;bounding_box&#39;].ASObject;<br>        x1:= (BBox.values[&#39;x1&#39;].asinteger);<br>        y1:= (BBox.values[&#39;y1&#39;].asinteger);<br>        x2:= (BBox.values[&#39;x2&#39;].asinteger);<br>        y2:= (BBox.values[&#39;y2&#39;].asinteger);<br>        writeln(item.values[&#39;label&#39;].asstring);<br>        writ(&#39;debug x,y: &#39;+itoa(i)+&#39;, &#39;+itoa(x1)+&#39; &#39;+itoa(y1));<br>         <br>        // 3) Set color rect and label per box or class<br>        Bmp.Canvas.Pen.Color:= clGreen;  // or map by class, etc.<br>        Bmp.Canvas.Rectangle(x1, y1, x2, y2); //[web:15]<br>        SetBkMode(bmp.Canvas.Handle, TRANSPARENT);<br>        Bmp.Canvas.Font.size:= 15;<br>        Bmp.Canvas.Font.Color:= clRed;<br>        Bmp.Canvas.TextOut(x1,y1, item.values[&#39;label&#39;].asstring);<br>      end;<br>      //Image1.Picture.Assign(Bmp);  // show or save as jpeg<br>      //Bmp.SaveToFile(ChangeFileExt(AImageFile,exepath+&#39;examples\_with_boxes2.bmp&#39;));<br>      Bmp.SaveToFile(exepath+&#39;examples\multigeoimage_with_box.bmp&#39;);<br>    finally<br>      Bmp.Free;<br>    end;<br>  finally<br>    Root.Free;     <br>  end;<br>end;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*cGvDEtqypoIAwEQr" /></figure><p>A better and distincter version of the boundingbox topic is now available:</p><p><a href="https://sourceforge.net/projects/maxbox5/files/examples/1473_JSON_BoundingBox_API1_51.txt/download">https://sourceforge.net/projects/maxbox5/files/examples/1473_JSON_BoundingBox_API1_51.txt/download</a></p><pre>//DownloadJPGToBitmap(const URL :Str; ABitmap: TBitmap):Bool; if DownloadURLToFile(URLIMAGEPATH5, &#39;.\examples\superMypicture3.jpg&#39;) then begin //procedure Jpeg2Bmp(const BmpFileName,JpgFileName: string); Jpeg2Bmp(&#39;.\examples\geotestimage.bmp&#39;,&#39;.\examples\superMypicture3.jpg&#39;); DrawMultipleBoundingBoxesFromJSON(testRawJSONStringObject, &#39;.\examples\geotestimage.bmp&#39;); Bmp2Jpeg(&#39;.\examples\geotestimage.bmp&#39;, &#39;.\examples\geotestimage3.jpg&#39;); openfile(exepath+&#39;examples\geotestimage3.jpg&#39;); end;</pre><pre>//DownloadJPGToBitmap(const URL :Str; ABitmap: TBitmap):Bool;<br> if DownloadURLToFile(URLIMAGEPATH5, &#39;.\examples\superMypicture3.jpg&#39;) then begin<br>   //procedure Jpeg2Bmp(const BmpFileName,JpgFileName: string);<br>   Jpeg2Bmp(&#39;.\examples\geotestimage.bmp&#39;,&#39;.\examples\superMypicture3.jpg&#39;);<br>   DrawMultipleBoundingBoxesFromJSON(testRawJSONStringObject, <br>                                           &#39;.\examples\geotestimage.bmp&#39;);  <br>   Bmp2Jpeg(&#39;.\examples\geotestimage.bmp&#39;, &#39;.\examples\geotestimage3.jpg&#39;);   <br>   openfile(exepath+&#39;examples\geotestimage3.jpg&#39;);      <br> end;</pre><p><a href="http://www.softwareschule.ch/examples/boundingbox.txt">softwareschule.ch/examples/boundingbox.txt</a></p><p><a href="http://www.softwareschule.ch/examples/boundingbox.htm">softwareschule.ch/examples/boundingbox.htm</a></p><h4>St. Gallen Mühleggbahn Schlucht</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/685/0*z2lfrT-WJNDXHiAT" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/0*qwHFAehG1wlExmH0" /></figure><p>After 2 weeks running:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/0*xSRtGGLBKZcNuyhR" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/459/0*gbAVHPt8VZcgQH-n" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/459/0*LXsZjWz00XynTHLX" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dOSXhJM7avFBrqHO" /></figure><h4>10 Most Important AI Concepts You Should Understand Before You Start Building AI</h4><blockquote><em>A beginner-friendly guide for developers who want to actually understand what they are building</em></blockquote><p><a href="https://ai.plainenglish.io/10-most-important-ai-concepts-you-should-understand-before-you-start-building-ai-7b163e8454d9">10 Most Important AI Concepts You Should Understand Before You Start Building AI | by CodeWithYog | Apr, 2026 | Artificial Intelligence in Plain English</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/0*fQSBbJa7jKIsej2z" /></figure><p><em>Originally published at </em><a href="https://maxbox6.wordpress.com/2026/03/22/geo-intelligence/"><em>http://maxbox6.wordpress.com</em></a><em> on March 22, 2026.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a2b19aae10ff" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GeoJSON in OSM]]></title>
            <link>https://medium.com/@breitsch2/geojson-in-osm-4604edc0118f?source=rss-2218ff386d6------2</link>
            <guid isPermaLink="false">https://medium.com/p/4604edc0118f</guid>
            <category><![CDATA[geospatial]]></category>
            <category><![CDATA[leafletjs]]></category>
            <category><![CDATA[geojson]]></category>
            <dc:creator><![CDATA[Breitsch]]></dc:creator>
            <pubDate>Tue, 17 Mar 2026 08:16:14 GMT</pubDate>
            <atom:updated>2026-03-17T16:08:09.624Z</atom:updated>
            <content:encoded><![CDATA[<p>Here’s a <strong>complete, runnable HTML example</strong> that loads <strong>OpenStreetMap tiles</strong> and displays <strong>GeoJSON data</strong> using <strong>Leaflet.js</strong>. and EdgeView runtime.<br>This works entirely in the browser without a backend. We <strong>set</strong> a point <strong>and</strong> a polygon <strong>on</strong> the map!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/0*obo6jB9HALVnXDm5" /></figure><p>The GeoJSON layer is part of the script which we load on the edgeview.</p><p>How it works</p><ol><li><strong>Leaflet.js</strong> loads OpenStreetMap tiles.</li><li>A <strong>GeoJSON object</strong> is defined inline (you can also load it from a .geojson file via fetch()).</li><li>L.geoJSON() renders the features with custom styles and popups.</li><li>Supports <strong>points, lines, and polygons</strong>.</li></ol><p>✅ <strong>Tip:</strong><br>If you have a .geojson file, replace the inline geojsonData with:</p><pre>fetch(&#39;data.geojson&#39;) .then(res =&gt; res.json()) .then(data =&gt; L.geoJSON(data).addTo(map));</pre><p>If you want, you can also extend this example to <strong>load live GeoJSON data directly from OpenStreetMap using Overpass API</strong> so you can query real map features dynamically. The main part in the script with maXbox goes like this:</p><pre>procedure letGeoJson_EdgeOSM_GeoJSON(zoom, lon,lat: double); var htmlgeojs: string; begin with TEdgeViewForm.create(self) do begin height:= 1000; width:= 1200; caption:= caption+ &#39; - OSM GeoJSON Layer&#39; htmlgeojs:= loadfile(exepath+&#39;examples\1472_osm_geojson_complete.htm&#39;); pagecontrol1.height:= 160; edit1.text:= TESTURL5; //OSMDIRECT; //&#39;https://wttr.in/Bern&#39;; //edit1.text:= Format(OSM_URLFormat,[zoom, lon,lat]); //&#39;https://wttr.in/Bern&#39;; //btngoclick(self); sleep(1500); memoHTML.Text:= utf8toansi(htmlgeojs); ////GEOJSON_Layer; btnSetSourceClick(self); //} showmodal free; end; end;</pre><p>You can load the script direct from a host or as an file locally. The point and the rectangular polygon ist the GeoJSON part.</p><blockquote><em>A position </em><strong><em>is</em></strong><em> an </em><strong><em>array</em></strong><em> </em><strong><em>of</em></strong><em> numbers. There MUST be two </em><strong><em>or</em></strong><em> more<br> elements. The first two elements are longitude </em><strong><em>and</em></strong><em> latitude, </em><strong><em>or</em></strong><em> easting </em><strong><em>and</em></strong><em> northing, precisely </em><strong><em>in</em></strong><em> that order </em><strong><em>and</em></strong><em> using decimal numbers. Altitude </em><strong><em>or</em></strong><em> elevation MAY be included </em><strong><em>as</em></strong><em> an optional third<br> element.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vmC2FvRvbs6E3H20" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2TG-7RM7UcM6eSls" /></figure><p>While using open streets overlay, a repeated error message window pops up which covers the map below. it says 403r Access Blocked: Referer is required by title usage policy of (to) OpenSteetMap’s volunteer run servers: ism.wiki/Blocked. The overlay map is functioning but covered by the repeated messages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/0*qEo6jWb0ITFCUFMu" /></figure><p>Here’s the <strong>complete, runnable HTML example</strong> that loads <strong>OpenStreetMap tiles</strong> and displays <strong>GeoJSON data</strong> using <strong>Leaflet.js</strong>. This works entirely in the browser without a backend.</p><pre>HTML + JavaScript Html&lt;!DOCTYPE html&gt; &lt;html lang=&quot;en&quot;&gt; &lt;head&gt; &lt;meta charset=&quot;UTF-8&quot;&gt; &lt;title&gt;OpenStreetMap with GeoJSON&lt;/title&gt; &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt; &lt;!-- Leaflet CSS --&gt; &lt;link rel=&quot;stylesheet&quot; href=&quot;https://unpkg.com/leaflet/dist/leaflet.css&quot; /&gt; &lt;style&gt; #map { height: 100vh; /* Full screen height */ width: 100%; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div id=&quot;map&quot;&gt;&lt;/div&gt; &lt;!-- Leaflet JS --&gt; &lt;script src=&quot;https://unpkg.com/leaflet/dist/leaflet.js&quot;&gt;&lt;/script&gt; &lt;script&gt; // Initialize the map const map = L.map(&#39;map&#39;).setView([46.948, 7.447], 15); // Centered on Bern, CH // Add OpenStreetMap tile layer L.tileLayer(&#39;https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png&#39;, { attribution: &#39;&amp;copy; &lt;a href=&quot;https://www.openstreetmap.org/copyright&quot;&gt;OpenStreetMap&lt;/a&gt; contributors&#39; }).addTo(map); // Example GeoJSON data (Point + Polygon) const geojsonData = { &quot;type&quot;: &quot;FeatureCollection&quot;, &quot;features&quot;: [ { &quot;type&quot;: &quot;Feature&quot;, &quot;properties&quot;: { &quot;name&quot;: &quot;Sample Point&quot; }, &quot;geometry&quot;: { &quot;type&quot;: &quot;Point&quot;, &quot;coordinates&quot;: [7.447, 46.948] // lon, lat } }, { &quot;type&quot;: &quot;Feature&quot;, &quot;properties&quot;: { &quot;name&quot;: &quot;Sample Polygon&quot; }, &quot;geometry&quot;: { &quot;type&quot;: &quot;Polygon&quot;, &quot;coordinates&quot;: [[ [7.445, 46.947], [7.449, 46.947], [7.449, 46.950], [7.445, 46.950], [7.445, 46.947] ]] } } ] }; // Add GeoJSON layer with styling and popup L.geoJSON(geojsonData, { style: feature =&gt; ({ color: feature.properties.name === &quot;Sample Polygon&quot; ? &quot;blue&quot; : &quot;red&quot;, weight: 2 }), pointToLayer: (feature, latlng) =&gt; { return L.circleMarker(latlng, { radius: 6, fillColor: &quot;red&quot;, color: &quot;#000&quot;, weight: 1, opacity: 1, fillOpacity: 0.8 }); }, onEachFeature: (feature, layer) =&gt; { if (feature.properties &amp;&amp; feature.properties.name) { layer.bindPopup(feature.properties.name); } } }).addTo(map); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt;</pre><p>Test it direct on web:</p><p><a href="http://softwareschule.ch/geojson.htm">OpenStreetMap with GeoJSON</a> <a href="https://raw.githack.com/maxkleiner/maXbox5/main/EKON30/1472_osm_geojson_complete.htm">https://raw.githack.com/maxkleiner/maXbox5/main/EKON30/1472_osm_geojson_complete.htm</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/0*4D35jOZi4QQHM7SY" /></figure><p>Conclusion</p><p>The provided web content describes a tutorial on using <strong>Leaflet</strong> with OpenStreetMap to create an interactive map of a city, including custom markers and popups for office locations based on GeoJSON data.</p><p>With EdgeView as a runnable and as a developer, you need to make well-optimized applications, and to find a comfortable balance between the use of Windows-native platforms, components, and programming languages and the use of web technologies, such as HTML, CSS, and JavaScript.</p><p><em>Originally published at </em><a href="https://teetrains.wordpress.com/2026/03/17/geojson-in-osm/"><em>http://teetrains.wordpress.com</em></a><em> on March 17, 2026.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4604edc0118f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Champagnole]]></title>
            <link>https://medium.com/@breitsch2/champagnole-6c6f5e2ca067?source=rss-2218ff386d6------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c6f5e2ca067</guid>
            <category><![CDATA[trains]]></category>
            <category><![CDATA[trans-europ-express]]></category>
            <category><![CDATA[trainspotting]]></category>
            <dc:creator><![CDATA[Breitsch]]></dc:creator>
            <pubDate>Tue, 09 Dec 2025 08:26:25 GMT</pubDate>
            <atom:updated>2026-03-17T16:20:58.492Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Jouef from Champagnole</strong><br>The Cité du Train celebrates its 20th anniversary this year, time to report again on some news in the TEE area 1 Especially about Jouef with his 80 year anniversary.<br>Jouef is a French brand of model trains and road circuits, created in 1944 by<br>Georges Huard in Champagnole, in the Jura department. After having been a leading brand of model trains in France, Jouef became a distribution brand of the British group Hornby in October 2004.<br>The models are of enormous authenticity, details and quality, for example my favour CC 6515.<br>Jouef 842600 France — Locomotive électrique CC 6515, SNCF, Engin : CC 6515<br>Marque : JOUEF Référence : 842600<br>Gris métallisée livrée ARZENS Logo Beffara<br>Dépôt : Paris Sud-Ouest (200 km/h)<br>Livrée avec 3 plaques frontales (Capitole ou Étendard ou Aquitaine)<br>2 boggies moteur avec les 2 volants d’inertie Inversion éclairage blanc/rouge<br>AV/AR.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/0*bQVTJ4kYMoo0DuOM" /></figure><p>Jouef-39 has hold its third JOUEFISSIMO fair and exhibition on April 8 and 9, 2023, at the Salle de l’Oppidum in Champagnole, the town that was the historic birthplace of the Jouef brand.<br>The fair is open to professionals and individuals, who will offer only model<br>railroading items for sale, including items from the entire Jouef production line.<br>Exhibitors will showcase their railroad layouts or other creations related to<br>model railroading in general.<br>I was there at Champagnole in a train called Ligne des Hirondelles:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/0*0D9ydAkUHamSII9M" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*l_rtJnbjg3GBMUhJ" /></figure><p>In addition to power supplies, Jouef has introduced into its range boxes for<br>controlling points and switches as well as a bi-stable relay allowing automation.<br>In addition to power supplies, Jouef introduced into its range boxes for point control and switches allowing the creation of a network control console. A bistable relay allows for automation. From 1974, the references moved to 4 digits.<br>These are also models from the French Jouef catalog and decorated specifically for export markets at the request of importers, or redecorated at the special request of certain French retailers or various companies for promotional purposes. Jouef also produced special series for its own needs and series intended for collectors through a dedicated subsidiary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/0*mUQqSplDnME6q0zj" /></figure><p>référence : 842600<br>immatriculation : CC 6515 SNCF</p><ul><li>châssis zamac monobloc enfermant le moteur</li><li>pas d’inscriptions sur le châssis</li><li>caisse plastique gris/orange/rouge</li><li>rambardes métalliques rapportées</li><li>essuie-glaces métalliques rapportés</li><li>marchepieds en plastique rapportés</li><li>caisse clipsée au châssis, toiture rapportée</li><li>pantographes fonctionnels, alimentation par caténaire</li><li>tampons fixes, éclairage inversé avec lampes</li><li>moteur Igarashi 12 volts</li><li>volant d’inertie transmission par engrenage et vis sans fin</li><li>2 bogies moteurs, inscription Jouef sur les bogies</li><li>essieux brunis, attelages boîtier NEM</li><li>longueur : 233 mm, masse : 610 g</li></ul><p>Jouef : matériel moteur SNCF</p><p><a href="http://lestrainsjouef.free.fr/fr/matmotfr2.html">Jouef : matériel moteur SNCF</a></p><p>New was NEM 660 digital interface (21 pins) and sound versions available from 2021 and a new body for Maurienne CC 6543 and CC 6550 locomotives from 2021 from the Locomotives électriques CC 6501 à CC 6538 SNCF (1ᵉ sous-série).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vvpTB8COIu8OiBR6" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/0*GXmWCk5ePi3MQCIL" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BW8IpIpO1M4FXkHB" /></figure><p>The real SNCF CC 6500 electric locomotive, series CC 6501 to CC 6574 had:<br>Power supply: 1.5 kV DC<br>Year of construction: 1969 to 1974 with Power: 5900 kW</p><p>Three sub-series:</p><ul><li>CC 6501 to CC 6538: horizontal louvers, gray/orange/red livery</li><li>CC 6539 to CC 6559: plastic louvers, Maurienne green livery</li><li>CC 6560 to CC 6574: stainless steel louvers, gray/orange/red livery<br>Maximum speed: 220 km/h except Maurienne locomotives (CC 6539 to 6559)<br>limited to 160 km/h and current collection via third rail for Maurienne<br>locomotives.<br>Weight: 114 tonnes, Length: 20.19 meters<br>Service: fast and express, freight trains on electrified lines in 1.5 kV DC<br>The CC 6565 SNCF in Grand Confort livery (with the plates and the RésistanceFer crest of the CC 6572) can be seen at the Citè du Train in Mulhouse (Alsace).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8862_-E0uc1Y6cFP" /></figure><p>Since 2015, an association of enthusiasts and former employees, based in<br>Champagnole, has organized annual exhibitions[2], collectors’ fairs and<br>implemented a model project of Champagnole[7],[8].<br>2) Patrick Bonjour, “ Champagnole | Patrimoine culturel. Une exposition pour les 75 ans de Jouef “, Le Progrès, 26 décembre 2019 (lire en ligne [archive], consulté le 6 janvier 2025).<br>7) Océane Sainte-Marthe, “ Jouef-39 en route vers la création d’un parc de<br>miniatures animées à Champagnole [archive] “, sur actu.fr, 30 décembre 2022 (consulté le 6 janvier 2025).<br>8) Stephane Hovaere, “ La maquette géante de Jouef 39 en gestation [archive] “, sur Jura : toute l’info locale — Hebdo39, 14 décembre 2022 (consulté le 6<br>janvier 2025).<br>Jouef — Wikipédia</p><p><a href="https://fr.wikipedia.org/wiki/Jouef">Jouef — Wikipédia</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/0*Z7X0ZkocdIJ_-XCM" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/675/0*Ja2RIkD_N1F5_r-d" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WY_hgJ3PxznJdTEM" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bBHHtq_Ni8pRaVXl.png" /></figure><p>Let’s stay with the CC 6500 and switch to the H0 scale. Jouef H0 is launching the SNCF electric locomotive CC 6526 in Era IV. This special model celebrating 80 years of Jouef comes in an attractive box (anniversary box).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HHS_dSmI1xE5xQ_6" /></figure><p>Max Kleiner, October 2025<br>Ref: Jouef : index numérique matériel roulant<br>Jouef — Wikipédia<br>Histoire de Jouef, La Vie du rail n°1025</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0VgF5dkrBufZOBvG" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vw9A67EHeUVPgcyS" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pL7u9Uqod2n2wdf9" /></figure><h4>Appendix: TEE Modellbahn Datenbank<br>Trans Europ Express TEE Models</h4><p><a href="http://www.kleiner.ch/kleiner/TEE_files/tee_models.htm">Trans Europ Express TEE Models</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Q4X1vJ2zAzKkR6_-" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/0*cRJwlpSS-z1TCvUI" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/459/0*pWGUUHaPZn_S52-D" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/675/0*hyxC52SuU6rm0VSQ" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JpNCgH7Sfh1EKzYJ" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cdR1V8DGL5yS8dZZ" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1kb2DsEapzxkuv6N" /></figure><p><em>Originally published at </em><a href="https://teetrains.wordpress.com/champagnole/"><em>http://teetrains.wordpress.com</em></a><em> on December 9, 2025.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c6f5e2ca067" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Station2Station]]></title>
            <link>https://medium.com/@breitsch2/station2station-e15e0e9a7c79?source=rss-2218ff386d6------2</link>
            <guid isPermaLink="false">https://medium.com/p/e15e0e9a7c79</guid>
            <category><![CDATA[geocoding]]></category>
            <category><![CDATA[maps]]></category>
            <dc:creator><![CDATA[Breitsch]]></dc:creator>
            <pubDate>Wed, 02 Oct 2024 14:57:16 GMT</pubDate>
            <atom:updated>2024-10-02T15:48:59.318Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/772/0*hAIUnTxeqdkpGt-8" /></figure><p>Use this tool as a script ( <em>1274_GoogleDirForm2GeocodeDirectionsGeneral2request62.pas</em>) to get the directions between any point using google maps. Enter a city or an address in both the <strong>From</strong> and the <strong>To</strong> address inputs. You can also set direct an lat- and longitude. Click Got to Google… (Find Directions), and the tool will display the route you need to take to get from your starting location to your end location in the browser. The turn by turn directions will be displayed below the map, and will contain the distance and approximate time it will take to get from one location to the other.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/0*ZcohOSZA2J5wv9wM" /></figure><p>The licence is a “licence”: “Data © OpenStreetMap contributors, ODbL 1.0. http:\/\/osm.org\/copyright”, and you can also get your own API-key. The a browser starts with the google maps directions window, as we checked the “Check To See Link In Browser”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YHOaSohjny7GmKg9" /></figure><p><strong>Get or find coordinates:</strong> Search for a place using its latitude and longitude coordinates, or get the coordinates of a place you’ve already found.</p><h3>Code behind</h3><pre>TDirection is working as a URL Builder: IsNavUtils - Provides a RNavigateLongLat record as class to manipulate Longitude and Latitude references and the functions and constants required to achieve this.</pre><pre>procedure TDirectionsBtnGoGoogleClick(Sender: TObject); Var LocFrom,LocTo:RNavigateLongLat; Long,Lat:Double; begin LocFrom:=RNavigateLongLat.create; Locto:=RNavigateLongLat.create; Long:=RealFrmDegreeText(EdtLong.Text); Lat:= RealFrmDegreeText(EdtLat.Text); LocFrom.CreateDec(Long,Lat); Long:=RealFrmDegreeText(EdtLong2.Text); Lat:= RealFrmDegreeText(EdtLat2.Text); LocTo.CreateDec(Long,Lat); // { 0 Start 1 End 3 Center } EdtGoogleLink.Text:=LocFrom.GoogleLinkDirectionsTo(LocTo, 0); LBlCrowFlies.Caption:=&#39;Distance as Crow Flys =&#39;+FormatFloat(&#39;0.0km&#39;,LocTo.MetresFrom(LocFrom)/1000); if CBxGoNow.Checked then LocFrom.GoGoogleDirectionsTo(LocTo, 0); end;</pre><p>For the geocoding we use a restclient <strong>THttpRequestC </strong>a JSON Lib and the OSM API from nominatim. Nominatim uses <strong>OpenStreetMap </strong>data to find locations on Earth by name and address (geocoding). It can also do the reverse, find an address for any location on the planet. For occasional use. Use the API. Usage policy. API documentation. For power users. Install your own. The latest release is 4.5.0.</p><pre>function TAddressGeoCodeOSM8(AURL, location, aApikey: string): tlatlong; var Httpreq: THttpRequestC; httpres: string; Body: TMultipartFormBody; jsn: TMcJsonItem; begin httpreq:= THttpRequestC.create(self); httpreq.headers.add(&#39;Accept: application/json; charset=utf-8&#39;); httpreq.useragent:= USERAGENT4; httpreq.SecurityOptions:= [soSsl3, soPct, soIgnoreCertCNInvalid]; try if httpreq.get(Format(AURL,[location])) then begin //httpres:= (httpreq.Response.ContentAsString) httpres:= (httpreq.Response.ContentAsUTF8String) //writeln(&#39;conttype &#39;+httpreq.Response.ContentType); writ(&#39;debug back &#39;+formatJson(httpres)); jsn:= TMcJsonItem.Create; jsn.AsJSON:= httpres; result.lat:= jsn.at(0,&#39;lat&#39;).asnumber; result.long:= jsn.at(0,&#39;lon&#39;).asnumber; result.descript:= Format(&#39;Coords: lat %2.5f lng %2.5f %s place_id: %d&#39;, [result.lat,result.long,jsn.at(0,&#39;display_name&#39;).asstring, jsn.at(0,&#39;place_id&#39;).asinteger]); end else Writeln(&#39;APIError &#39;+inttostr(Httpreq.Response.StatusCode2)); //StrReplace(httpres, &#39;[{&#39;, &#39;{&#39;); finally writeln(&#39;Status3: &#39;+gethttpcod(httpreq.Response.statuscode2)) httpreq.Free; sleep(200) jsn.Free; end; end;</pre><pre>Result: OSM _from: Coords: lat 46.94724 lng 7.45158 Münster, 1, Münsterplatz, Altstadt, Grünes Quartier, Stadtteil I, Bern, Verwaltungskreis Bern-Mittelland, Verwaltungsregion Bern-Mittelland, Bern/Berne, 3000, Schweiz/Suisse/Svizzera/Svizra place_id: 78089330<br>OSM _to: Coords: lat 51.33933 lng 12.37260 Thomaskirche, 18, Thomaskirchhof, Zentrum, Mitte, Leipzig, Sachsen, 04109, Deutschland place_id: 118838745<br>get geocoords: lat: 51.3393 - lon: 12.3726<br> mX5</pre><pre>executed: 26/09/2024 09:52:14 Runtime: 0:0:4.38 Memload: 62% use</pre><p>The GoogleDirForm is simple and a really simple form to put in Long/Lat references and also Locations and then get Google Directions in Browser:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xWz7dI5zzpQNygFB" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AmSPaa4Y4ZaP4ADs" /></figure><p>A major learning curve was how the user interface needs to be adapted for the very small screens and make it scriptable at runtime with maXbox5. I chose a <strong>Multi Layer Tab</strong> control template “Tabbed with Navigation” offered with Tokyo as a basis for my trail app. I had to add the functionality to support the hardware back button and was not very successful with gesture use opting in the end for Forward and Back Speed buttons so more to learn there. The Templates were for the time being not offered with my Rio and Alexandria Community Install.</p><p>Another point is to integrate the EdgeView browser with the RAD Studio 10.4 Sydney brings support for working with web content through the Chromium-based Edge WebView2 browser control in VCL applications via the new <a href="http://docwiki.embarcadero.com/Libraries/Sydney/en/Vcl.Edge.TEdgeBrowser">TEdgeBrowser</a> component.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/0*2oc_4TQi-5BMLLsP" /></figure><p><strong>TEdgeBrowser </strong>supersedes <a href="http://docwiki.embarcadero.com/Libraries/Sydney/en/FMX.WebBrowser.TWebBrowser">TWebBrowser</a>, which uses the Internet Explorer WebBrowser browser control. However TWebBrowser remains in the VCL component set, with some notable changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jESOeIQEJLMtWnyO" /></figure><p>The script you can find at: <a href="https://sourceforge.net/projects/maxbox/files/Examples/EKON/EKON28/1274_GoogleDirForm2GeocodeDirectionsGeneral2request62.pas/download">https://sourceforge.net/projects/maxbox/files/Examples/EKON/EKON28/1274_GoogleDirForm2GeocodeDirectionsGeneral2request62.pas/download</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/461/0*0oAUgcxBqtfGe56j" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/461/0*YafzsBv5jlsP78xB" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aPR4iPEXwI8bIc0i" /></figure><p><em>Originally published at </em><a href="https://maxbox4.wordpress.com/2024/10/02/station2station/"><em>http://maxbox4.wordpress.com</em></a><em> on October 2, 2024.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e15e0e9a7c79" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Modern Regex]]></title>
            <link>https://medium.com/@breitsch2/modern-regex-32bb3bbda825?source=rss-2218ff386d6------2</link>
            <guid isPermaLink="false">https://medium.com/p/32bb3bbda825</guid>
            <category><![CDATA[regex]]></category>
            <dc:creator><![CDATA[Breitsch]]></dc:creator>
            <pubDate>Fri, 10 May 2024 14:46:09 GMT</pubDate>
            <atom:updated>2024-05-31T13:42:16.887Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/772/0*aj_9om-2Rn9TykDA" /></figure><p>The king of code is back, namely regular expressions as the Rex of Code in scripts.</p><p>TPerlRegEx <strong>is</strong> a Delphi VCL wrapper around the open-source PCRE (Perl-Compatible Regular Expressions) <strong>library</strong>. It provides powerful regular expression capabilities similarto those found in the Perl or Python programming language. This version of TPerlRegEx is compatible with the TPerlRegEx <strong>class </strong>in the RegularExpressionsCore <strong>unit</strong> in Delphi XE. You can use TPerlRegEx to perform pattern matching, search, and replace operations using regular expressions.</p><p>The supplied pcrelib.dll <strong>contains</strong> PCRE 7.9, compiled <strong>with</strong> Unicode support.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/0*_q9R0XH3gple_F_6" /></figure><blockquote><em>By default, OBJ files are used (like above), but you can use the DLL if you have multiple apps using TPerlRegEx and want to save space by linking the OBJ files only once. There’s no need to add the pcre unit to your uses clause; it’s used internally by TPerlRegEx. TPerlRegEx is licensed under the Mozilla Public License, version 1.1. To download the latest version of TPerlRegEx, visit the official page.</em></blockquote><blockquote><a href="https://www.pcre.org/original/doc/html/pcre16.html"><em>https://www.pcre.org/original/doc/html/pcre16.html</em></a></blockquote><p>Starting with release 8.30, it is possible to compile a PCRE library that supports 16-bit character strings, including UTF-16 strings, as well as or instead of the original 8-bit library. The majority of the work to make this possible was done by Zoltan Herczeg. The two libraries contain identical sets of functions, used in exactly the same way. Only the names of the functions and the data types of their arguments and results are different.</p><p>To avoid over-complication and reduce the documentation maintenance load, most of the PCRE documentation describes the 8-bit library, with only occasional references to the 16-bit library.</p><p>Usage Example:</p><pre>var reg: TPerlRegEx; begin reg := TPerlRegEx.Create(nil); try reg.RegEx := &#39;ab&#39;; reg.Replacement := &#39;◆&#39;; reg.Subject := &#39;ababab&#39;; reg.ReplaceAll; ShowMessage(reg.Subject); // Returns: ◆◆◆ finally reg.Free; end; end;</pre><p>Or you want to replace a pattern-string at the fly or at runtime:</p><pre>with TPerlRegEx.Create do try Subject :=&#39;&lt;p&gt;This is text.&lt;br/&gt; This is line 2&lt;/p&gt;&#39;; RegEx := &#39;&lt;[^&gt;]*&gt;&#39;; //RegEx:= &#39;([&lt;/pbr&gt;])*&#39; replacement:= &#39; &#39;; replaceall(); writeln(&#39;res: &#39;+subject); finally Free; end;</pre><p>The output is: res: This is text. This is line 2</p><p>A more modern implementation is to code with a <strong>TMatch </strong>and <strong>TMatchCollection </strong>class. This example demonstrates the use of TMatchCollection and TGroupCollection. This example assumes that you have placed a TButton, a TEdit and a TMemo on a form.</p><pre>var Form1: TForm1; mycoll: TMatchCollection; myenum: TMatchCollectionEnumerator; implementation {$R *.dfm} // Creates and lists the match collection, the matches in that // collection and the groups in those matches. procedure TForm1.Button1Click(Sender: TObject); const bigString = &#39;Look for a the strings in this strang of strungs.&#39;; littlestring = &#39;(str)([iau]ng)&#39;; var regex: TRegEx; i, j: integer; mygrps: TGroupCollection; begin regex:= TRegEx.Create(littlestring); mycoll:= regex.Matches(bigString); Edit1.Text:= &#39;Count: &#39; + IntToStr(mycoll.Count); memo1.Lines.Add(&#39;First Collection: &#39;); for i:= 0 to mycoll.Count-1 do begin memo1.Lines.Add(&#39;Match #&#39; + IntToStr(i) + &#39;: &#39; + mycoll.Item[i].Value); memo1.Lines.Add(&#39;Group: &#39; + IntToStr(i)); mygrps:= mycoll.Item[i].Groups; for j:= 0 to mygrps.Count-1 do memo1.Lines.Add(&#39;Value: &#39; + mygrps.Item[j].Value); end; end;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2ItaayD9tltaCA2x" /></figure><p>The item of a TMatchCollection returns the Match identified by index from the collection (ex. <strong>tmatches[it-1].value]</strong> below).</p><p><a href="https://docwiki.embarcadero.com/CodeExamples/Alexandria/en/TMatchCollectionCount_(Delphi)">https://docwiki.embarcadero.com/CodeExamples/Alexandria/en/TMatchCollectionCount_(Delphi)</a></p><p>In general matches from a TRegEx returns all the matches present in the input string an is useful to iterate through a group or captured group:</p><pre>function getMatchString2(arex, atext: string): string; var Match: TMatch; tMatches: TMatchCollection; myenum: TMatchCollectionEnumerator; begin with TRegEx.Create1(arex) do try it:= 0; { Match format search...} result:= result+CRLF; if ismatch(atext) then tMatches:=Matches(aText); writeln(&#39;captured groups: &#39;+itoa(tmatches.count )); repeat Inc(it); result:= result+Format(#09&#39;%d: %-12s&#39;,[it, tmatches[it-1].value]) if it mod 5=0 then result:= result+#13#10; //until match(atext).success; //MatchNext &lt; 0; until it = tmatches.count; finally Free; end; WriteLn(&#39;Done REX2 - Hit NOthing to exit&#39;); end;</pre><pre>PI EXplore5:<br>1: 33 2: 88 3: 99 4: 44 5: 99<br>6: 11 7: 66 8: 44 9: 55 10: 22<br>11: 111 12: 11 13: 555 14: 44 15: 22<br>16: 44 17: 88 18: 66 19: 33 20: 44<br>21: 33 22: 66 23: 66 24: 33 25: 00<br>26: 66 27: 55 28: 88 29: 88 30: 00<br>31: 11 32: 33 33: 88 34: 66 35: 11<br>36: 33 37: 11 38: 11 39: 11 40: 44<br>41: 99 42: 88 43: 22 44: 11 45: 33<br>46: 33 47: 44 48: 66 49: 22 50: 77<br>51: 66 52: 000 53: 77 54: 77 55: 77<br>56: 44 57: 22 58: 22 59: 99 60: 11<br>61: 44 62: 77 63: 77 64: 99 65: 11<br>66: 999999 67: 99 68: 44 69: 55 70: 22<br>71: 33 72: 44 73: 11 74: 88 75: 000<br>76: 88 77: 33 78: 77 79: 66 80: 55<br>81: 11 82: 88 83: 77 84: 77 85: 22<br>86: 66 87: 00 88: 66 89: 111</pre><p>Matches returns all the matches present in the <strong>Input</strong> string in the form of a <a href="https://docwiki.embarcadero.com/Libraries/Alexandria/en/System.RegularExpressions.TMatchCollection">TMatchCollection</a> instance. If the <strong>Pattern</strong> parameter is not present the regular expression used is specified in the <a href="https://docwiki.embarcadero.com/Libraries/Alexandria/en/System.RegularExpressions.TRegEx">TRegEx</a> constructor.</p><p><strong>StartPos</strong> specifies the starting position to start the search. TMatchCollection has no public constructor. It is created as the return value of the <a href="https://docwiki.embarcadero.com/Libraries/Alexandria/en/System.RegularExpressions.TRegEx.Matches">Matches</a> method. The collection is populated with one TMatch instance for each match found in the input string. The <a href="https://docwiki.embarcadero.com/Libraries/Alexandria/en/System.RegularExpressions.TMatchCollection.Count">Count</a> property is the length of the TMatchCollection set. <strong>Length</strong> specifies the substring, starting at <strong>StartPos</strong> to match with the regular expressions.</p><h3>Performance Object versus Static</h3><p>The source <strong>for</strong> TRegEx.IsMatch( <strong>const</strong> Input, Pattern: string; Options: TRegExOptions) shows that a TRegEx <strong>is</strong> created at every invocation (which <strong>is</strong> a costly operation):</p><pre>procedure TForm1Button1ClickRegExPerformance1(Sender: TObject); var i: integer; t1, t2: cardinal; arex: TRegEx; begin t1 := GetTickCount; arex:= TRegEx.Create1(&#39;&#39;) for i:= 1 to 100000 do arex.IsMatch3(&#39;abcdef&#39;, &#39;cd&#39;, [rroIgnoreCase]); t2:= GetTickCount; writeln(&#39;rextime1: &#39;+IntToStr(t2-t1)+&#39; ms&#39;); end;</pre><p>This version of TPerlRegEx is compatible with the TPerlRegEx class in the RegularExpressionsCore unit in Delphi XE. In fact, the unit in Delphi XE is derived from the version of TPerlRegEx that you are using now.<br>This new <strong>version of TPerlRegEx descends from TObject</strong>. There are no packages to install into Delphi and nothing appears on the component palette. Simply add PerlRegEx to the uses clause of any units you want to use it in. There’s no need to add the pcre unit to the uses clause. This unit is used internally by TPerlRegEx.</p><pre>procedure TForm1Button2ClickRegExPerformance2(Sender: TObject); var i: integer; t1, t2: cardinal; LRegEx: TRegEx; begin t1 := GetTickCount; LRegEx:= TRegEx.Create(&#39;cd&#39;, [rroIgnoreCase]); processmessagesOFF; for i := 1 to 100000 do LRegEx.IsMatch(&#39;abcdef&#39;); processmessagesON; t2 := GetTickCount; writeln(&#39;rextime2: &#39;+IntToStr(t2-t1)+&#39; ms&#39;); lregex.free; end;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hi6ZDSbgnJtT-wcF" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/0*GBF6lWpaqn9K9PMD" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/0*xzwM8toFCYnY2RSQ" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/784/0*K2VHP0tmVf30eX_q" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/0*HhyjD-IyVwmW94Zz" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/425/0*mJYHN2VHR8YgZ2MY" /></figure><h3>EKON 28</h3><p><strong>Use modern RegEx</strong><br>When you start building scripts and apps, you are often faced with almost the same problems. Instead of laboriously constructing loops and queries, we look at the use of modern RegEx in Delphi and Python. Modern refers to 64-bit and Unicode, and pattern matching and stemming are also in demand in AI development or the Human Genome Project. Google, for example, probably uses an analogous process for organic search. Tips and tricks from the PCRE round off the express.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gAy4hIHqNERUy5Zq" /></figure><p><strong>Integrate Google Maps API.</strong><br>The Google Directions API and Maps (Earth) are two powerful tools that can be used to calculate and visualize directions and routing between locations using various modes of transportation. The Google Maps Platform is also demonstrated with geocoding, I create a Trip Advisor project to then manage services, credentials, calculations, maps, coordinates in APIs and SDKs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/0*T4hxezODQIp6sWPz" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/526/0*QSYKryrXrmItV4rj" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/526/0*-EZAG2hGhzngvFWk" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/685/0*dCsfMUiDKH99EhdT" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*goqdH452ZgEP-dux" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZcSdv5CHxd6x4sNS" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/0*tdGG4PppOCam0rVu" /></figure><p>Sorry, we processed more than 1M requests today and we ran out of our datasource capacity. We hope to solve the problem as soon as possible, so you can enjoy your favourite weather service 24×365 even if it rains or snows. We will solve the problem as soon as possible. <a href="https://twitter.com/igor_chubin">Follow @igor_chubin</a> for the updates. If you like to code (and you surely do), you can check the <a href="https://github.com/chubin/wttr.in">wttr.in</a> repository to see how the scalability problem is (not yet) solved.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/459/0*uwrxp811QkyY86He" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/459/0*7ZlRiiGlyvNQ4qix" /></figure><p>Mit einer Fallhöhe von 54 Metern ist der Wildensteiner Wasserfall einer der höchsten freifallenden Wasserfälle Europas.</p><p><em>Originally published at </em><a href="https://maxbox4.wordpress.com/2024/05/10/modern-regex/"><em>http://maxbox4.wordpress.com</em></a><em> on May 10, 2024.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32bb3bbda825" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ODBC 64-bit Access]]></title>
            <link>https://medium.com/@breitsch2/odbc-64-bit-access-dee63330a109?source=rss-2218ff386d6------2</link>
            <guid isPermaLink="false">https://medium.com/p/dee63330a109</guid>
            <category><![CDATA[odbc]]></category>
            <category><![CDATA[odbc-driver]]></category>
            <category><![CDATA[jdbc-driver]]></category>
            <category><![CDATA[access-database]]></category>
            <category><![CDATA[jdbc]]></category>
            <dc:creator><![CDATA[Breitsch]]></dc:creator>
            <pubDate>Fri, 09 Feb 2024 17:17:52 GMT</pubDate>
            <atom:updated>2024-02-27T08:00:42.475Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/772/0*2ItJENkacHzSqc-M" /></figure><p>In 64-bit Windows, there are two ODBC Data Source Administrators: a 32-bit and a 64-bit version.<br>The ODBC Data Source Administrator that is accessible in the Control Panel, under Administrative Tools, is the same sweet bitness of Windows. In other words, on 32-bit Windows, it is the 32-bit administrator; on 64-bit Windows, it is the 64-bit administrator.</p><p>On 64-bit Windows, you can execute 32-bit and 64-bit applications transparently.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WXk-T-jmlVAek2cW" /></figure><p>But if you want to access a ODBC data link to 64-bit you will see only SQL-Server in ODBC administrator 64bit on Win11 to get your ODBC connection string (replace <strong>with</strong> actual connection details).</p><p>So we have to install the 64-bit drivers first:</p><p>To download the ODBC driver for ACCESS or Excel that allows you to open .accdb or *.mdb databases for Windows 11, you can follow these steps:</p><p>1. Visit the Microsoft Download Center <a href="https://support.microsoft.com/en-us/office/download-and-install-microsoft-365-access-runtime-185c5a32-8ba9-491e-ac76-91cbe3ea09c9">https://support.microsoft.com/en-us/office/download-and-install-microsoft-365-access-runtime-185c5a32-8ba9-491e-ac76-91cbe3ea09c9</a></p><p>2. Look for the Microsoft <strong>Access Database Engine 2016 Redistributable</strong>.<br> or direct with <a href="https://www.microsoft.com/en-us/download/details.aspx?id=54920&amp;irgwc=1">https://www.microsoft.com/en-us/download/details.aspx?id=54920&amp;irgwc=1</a><br> Check the exe name: <strong>accessdatabaseengine_X64.exe</strong></p><p>3. Download the version that matches your system (32-bit or 64-bit). 4. After downloading, run the<br> above installer to install the ODBC drivers and you get more names than just SQL Server:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/0*2qBOjFCiBSh2oYlv" /></figure><p>Then you can build the data source name in maXbox5 or Data Source Administrator, in maXbox go to menu ../Options/ADO SQL Workbench with the use connection string as the result below :</p><ul><li><em>Provider=MSDASQL;Persist Security Info=False;Extended Properties=”DSN=mX5detailbase64;</em></li><li><em>DBQ=C:\maxbox\maxbox4\maxbox4\examples\detail.mdb;DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;UID=admin;”</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/541/0*xZaGSJjJTez4oz6C" /></figure><p>Then you will test the connection and open Table1 in the workbench source viewer:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/0*KVNUXObc40-y7p6_" /></figure><p><strong>Microsoft ODBC Driver for Access and SQL Server</strong> is a crucial component for developing native-code applications that connect to <strong>SQL Server</strong> and <strong>Azure SQL Database</strong>. It provides runtime support for applications using native code APIs to establish connections with SQL Server or Access. We can test this in a script with late binding as COM or Ole Automation. Ole Automation, originally known <strong>as</strong> OLE Automation <strong>and</strong> later renamed <strong>to</strong> simply Automation, <strong>is</strong> an interprocess communication mechanism IPC created by Microsoft. <br>It <strong>is</strong> based <strong>on</strong> a subset <strong>of</strong> the Component <strong>Object</strong> Model (COM). :</p><pre>Function OpenConnection(ConnectionString: AnsiString): Integer; var ADODBConnection: OleVariant; rs: Olevariant; sqlQuery: string; begin ADODBConnection:= CreateOleObject(&#39;ADODB.Connection&#39;); ADODBConnection.CursorLocation:= 3; // User client ADODBConnection.ConnectionString:= ConnectionString; Result := 0; try ADODBConnection.Open; sqlQuery:= &#39;SELECT * FROM Table1&#39;; rs:= ADODBConnection.Execute(sqlQuery) while Not rs.EOF do begin writeln(rs.Fields(&#39;LastName&#39;).Value); rs.MoveNext; end; except Result := -1; finally //clean up rs.close; ADODBConnection.close; end; end;</pre><p>Let’s explore an example <strong>of</strong> using Ole Automation <strong>in</strong> maXbox or VBA (Visual Basic <strong>for</strong> Applications) <strong>to</strong> read data from an ODBC (Open Database Connectivity) table. <strong>In</strong> thisscripting scenario above, we’ll assume you have an ODBC data source <strong>set</strong> up, <strong>and</strong> we’ll use an ADO (ActiveX Data Objects) connection <strong>to</strong> retrieve data with <strong>CreateOleObject(‘ADODB.Connection’)</strong>.</p><p>The code creates an ADO connection using the specified ODBC driver.</p><p>It opens the connection, executes a query (selecting all data from a table), <strong>and</strong> loops through a result set. You can customize the query <strong>and</strong> column names according <strong>to</strong> your specific use <strong>case</strong> in our example <em>Table1</em> and <em>LastName</em>. We can also reduce the Connection String after stored the data link properties:</p><blockquote><em>CSTRING2= ‘Provider=MSDASQL.1;Persist Security Info=False;Data Source=mX5detailbase64’;</em></blockquote><blockquote><em>ConnectionString:= CSTRING2;</em></blockquote><pre>try iReturn:= OpenConnection(ConnectionString); if (bMessage) then begin if (iReturn = 0) then begin (Application.MessageBox(utf8toansi(&#39;Connection OK!&#39;),utf8decode(&#39;Information&#39;),MB_OK)) writeln(&#39;Connection OK!&#39;); end else if (iReturn = -1) then Application.MessageBox(utf8toansi(&#39;Connection Error!&#39;),&#39;Error&#39;, MB_ICONERROR+MB_OK); end;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-kGDDom-5gxQXJSz" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pdPQqPaVV8HPTUqk" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-tOC7ZOpj370HUft" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-FMLm3Qnpr-tBrhf" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FebjfwsskZYimq7o" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*E5ylzUx0_-IcNx3z" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/985/0*SkgdrtugyqGmlKL3" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/949/0*GMvUKuLyGr5VpQsU" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/0*V0Uy9WA78Ysa9NdM" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/0*wPLtq9wpbTTGp0ZF" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/781/0*hunJz6HIO00a88xR" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/0*o-6VbnPHk8pLxMUU" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/0*0qwH7ktgrfGK-rQa" /></figure><h3>XN Resource Editor</h3><p>Based on the latest publicly available sources of Colin Wilson’s XN Resource Editor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yhu0_7Jii7HGNcUN" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/0*AeylKXIyW4UCitsg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*pKuqKo-wzhv-X1ET" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/0*_AvjhYensUImzuiU" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bjfdw2SFC5PngZlJ" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/0*GpLniMlWhlbOmj9h" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/999/0*Dhkeju8nCCXsAYBn" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/0*WhX_bxA5pW6MDRfl" /></figure><p><em>Originally published at </em><a href="https://maxbox4.wordpress.com/2024/02/09/odbc-64-bit-access/"><em>https://maxbox4.wordpress.com</em></a><em> on February 9, 2024.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dee63330a109" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Trilateration Equation]]></title>
            <link>https://medium.com/@breitsch2/trilateration-equation-5bf83f20a4f9?source=rss-2218ff386d6------2</link>
            <guid isPermaLink="false">https://medium.com/p/5bf83f20a4f9</guid>
            <dc:creator><![CDATA[Breitsch]]></dc:creator>
            <pubDate>Sat, 02 Dec 2023 20:10:35 GMT</pubDate>
            <atom:updated>2023-12-02T20:46:14.044Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CmnkjleoC-PXoXe8" /></figure><p>Trilateration Equation ______________________________________________________________</p><h4>maXbox Starter 115 — Get Target-point from 4 Sensors.</h4><p><em>“Time behaves like space — timeless.</em></p><p><a href="http://www.softwareschule.ch/download/maxbox_starter115.pdf">Trilateration and Gauss Elimination (softwareschule.ch)</a></p><p>Source: <strong>966_U_PointInSpace52_mX4Form2_64.pas</strong> &amp; PointInSpace5_64.exe</p><p>If you have a code base of 32-bit Windows Delphi applications that you want to convert to 64-bit Windows, you should first do a reorganisation of the sources for an overview. Today we deal with an old Borland library <em>UMatrix.pas</em> and a mathematical problem with of course a solution too.</p><blockquote><em>{ — — — — — — — — — — — — — }</em></blockquote><blockquote><em>{- -} {- Turbo Pascal Numerical Methods Toolbox — — — -}</em></blockquote><blockquote><em>{- Copyright © 1986, 87 by Borland International, Inc. — — -}</em></blockquote><blockquote><em>{- This unit provides procedures for dealing with systems of linear -}</em></blockquote><blockquote><em>{- equations. — — — — — — — — — — }</em></blockquote><blockquote><em>{ — — — — — — — — — — — — — }</em></blockquote><blockquote><em>UMatrix.pas</em></blockquote><p>Given the 3D coordinate locations of four sensors and their known distance from a target, calculate the location of the target.</p><p><a href="http://delphiforfun.org/Programs/Math_Topics/PointFrom4Sensors.htm">Point From 4 Sensors (delphiforfun.org)</a></p><p>The source is organised in a project-, a form- and a calculation unit:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SYkUBYjQ7ZCh-haS" /></figure><p>pic1: 115_d_radstudio_code.png</p><p>So its not always that easy to open your old 32-bit application in the IDE, add and activate the 64-bit Windows target platform, and compile your application as a 64-bit target Windows application. We must search also our old dependencies and check the compatibility with components.</p><h3>Source Organisation</h3><p>Unit <em>UMatrix</em> is the unit from the old Borland Turbo Pascal Numeric Toolbox which contains the Gaussian Elimination procedure used here among other matrix operations.</p><p>So we have sensors at known locations in 3D space. Each sensor can supply distance information to a target but knows nothing about the target’s direction. Alternatively, the sensors are Satellites and the target is a GPS receiver which reads very accurate time stamps transmitted by the satellites and calculates distances based on time offsets between its clock when a clock time message is received and satellites’ clock time when the message was sent (as contained in the message).<br>Given the sensor (X, Y, Z) coordinates and their distance-to-target values, we’ll use Gaussian Elimination to solve a set of linear equations describing the problem and derived as follows:</p><p>The distance Di to target at (Xt, Yt, Zt) for sensor “i” located at (Ai, Bi, Ci) is given by</p><p>Sqr(Di)=Sqr(Ai — Xt) + Sqr(Bi — Yt) + Sqr(Ci — -Zt)</p><p>after expanding:</p><p>Di2 = Ai2–2AiXt + Xt2 +Bi2–2BiYt +Yt2 +Ci2–2CiZt + Zt2</p><p>So for the reorganisation of the sources I have the latest revision with patches as from issues and it goes like this:</p><pre>begin { procedure Gaussian_Elimination } <br>  Initial(Dimen, Coefficients, Constants, Solution, Error); <br>  if Dimen &gt; 1 then begin <br>     UpperTriangular(Dimen, Coefficients, Constants, Error); <br>     if Error = 0 then BackwardsSub(Dimen, Coefficients, Constants, Solution); <br>  end; <br>end; { procedure Gaussian_Elimination }</pre><p>Solving this system of quadratic equations can be tricky, but we can subtract the Sensor1 equation from each of the other 3 to obtain linear equations like the following example for Sensor2::</p><p>The resulting 3 equations in 3 unknowns form a system of linear equations which are solved here using Gaussian Elimination to find the (Xt, Yt, Zt) target coordinates.<br>Note that the original problem requires 4 equations to resolve the 3 unknowns (the x, y, and z coordinates of the target). Two sensors can narrow target location down to a circle (the intersection of 2 spheres with target distances as radii), the 3rd sensor narrows the location down to two possible points, (the intersection of the circle with the 3rd sensor’s sphere circle).</p><p>The 4th sensor should resolve which of those two points is the target. Any error in specified locations or distances would either have no solution or require that some input values be adjusted. The techniques applied here result in reported distances being adjusted to produce a solution. Differences between input and calculated distances are listed as part of the solution. Lets have a look at the init routine <em>Initial</em> which is called in the main by Gaussian Elimination:</p><p><strong>procedure</strong> Initial(Dimen : integer;</p><p><strong>var</strong> Coefficients : TNmatrix;</p><p><strong>var</strong> Constants : TNvector;</p><p><strong>var</strong> Solution : TNvector; <strong>var</strong> Error : byte);</p><p><em>{ — — — — — — — — — — }</em> <em>{- Input: Dimen, Coefficients, Constants -}</em> <em>{- Output: Solution, Error -}</em> <em>{- This procedure test for errors in the value of Dimen. -}</em> <em>{- This procedure also finds the solution for the -}</em> <em>{- trivial case Dimen = 1. -}</em> <em>{ — — — — — — — — — — }</em> <strong>begin</strong></p><p>Error:= 0;</p><p><strong>if</strong> ABS(Coefficients[1, 1]) &lt; TNNearlyZero <strong>then</strong> Error:= 2</p><p><strong>else</strong> Solution[1]:= Constants[1] / Coefficients[1, 1];</p><pre>procedure Initial(Dimen : integer; var Coefficients : TNmatrix; <br>                          var Constants : TNvector; <br>                          var Solution : TNvector; <br>                          var Error : byte);<br> {----------------------------------------------------------} <br> {- Input: Dimen, Coefficients, Constants -} <br> {- Output: Solution, Error -} {- -} <br> {- This procedure test for errors in the value of Dimen. -} <br> {- This procedure also finds the solution for the -} <br> {- trivial case Dimen = 1. -} <br>{----------------------------------------------------------} <br>begin Error:= 0; <br>  if Dimen &lt; 1 ten Error:= 1 else if Dimen = 1 then <br>  if ABS(Coefficients[1, 1]) &lt; TNNearlyZero then Error:= 2 else <br>     Solution[1]:= Constants[1] / Coefficients[1, 1]; <br>end; { procedure Initial }</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/0*YXD3NcmhxJxz46UT" /></figure><p><em>P ic2: 115_GUIDesignandRuntime2023–12–02143419.png</em></p><p>The Solve button returns a position which may be at distances different from those in the original distance equations but do satisfy the distances relative to Sensor 1. That is part of what we sacrifice by eliminating one of the equations and converting quadratics to linear. A better solution in the “GPS case might be to incorporate dummy 4th variable representing the distance error due to clock synchronization errors between the satellites and the GPS receiver. The multivariate Newton-Raphson algorithm is a possible way to solve by using 4 quadratic equations in 4 unknowns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/0*TqFZkE8ag2mx9RaZ" /></figure><p>Pic3: 115_Designtime2023–12–02143302.png</p><p>In Delphi or maXbox, I can include a folder’s source code by adding it to the project Search Path or define as an include file, or adding it to the Library Path. The Search Path applies for the <em>UMatrix.pas</em> only to the current project, while the Library Path applies to any project opened with the IDE.</p><h3>Version 5 Test Case</h3><p>Version 5 posted today adds a second method for locating the target. Trilateration uses the locations of three sensors to exactly narrow the target location down to at most two possibilities. See this Wikipedia article for an excellent discussion and derivation of the Math involved. I translated a C code implementation to Delphi for testing.</p><p><a href="https://en.wikipedia.org/wiki/Trilateration">Trilateration — Wikipedia</a></p><p>By solving the 4 combination using 3 of the 4 sensors and saving the two solutions from each case, it seems that we have good luck in identifying the single solution. It is much more robust to the Gaussian Elimination version, easily solving the case submitted by a user which led to the current investigation: Using notation (x, y, z, r) to represent the x, y, z, coordinates and r, the measured distance to the target.</p><p>A test case is defined by (0,0,0,10), (10,0,0,10), (0,10,0,10), and (10,10,0,10). Gaussian Elimination finds no solution or an incorrect solution if a small increment is added to the z coordinate of one of the sensors to remove the singularity. Trilateration correctly identifies the solution as (5, 5, 7.07) or (5, 5, -7.07) which is also valid:</p><blockquote><em>Solution 1: 5.00 5.00 7.07</em></blockquote><blockquote><em>Distance to sphere 1 is 10.000 (radius 10.000)</em></blockquote><blockquote><em>Distance to sphere 2 is 10.000 (radius 10.000)</em></blockquote><blockquote><em>Distance to sphere 3 is 10.000 (radius 10.000)</em></blockquote><blockquote><em>Solution 2: 5.00 5.00 -7.07</em></blockquote><blockquote><em>Distance to sphere 1 is 10.000 (radius 10.000)</em></blockquote><blockquote><em>Distance to sphere 2 is 10.000 (radius 10.000)</em></blockquote><blockquote><em>Distance to sphere 3 is 10.000 (radius 10.000)</em></blockquote><blockquote><em>Solution 1: 5.00 5.00 7.07</em></blockquote><blockquote><em>Distance to sphere 1 is 10.000 (radius 10.000)</em></blockquote><blockquote><em>Distance to sphere 2 is 10.000 (radius 10.000)</em></blockquote><blockquote><em>Distance to sphere 4 is 10.000 (radius 10.000)</em></blockquote><blockquote><em>Solution 2: 5.00 5.00 -7.07</em></blockquote><blockquote><em>Distance to sphere 1 is 10.000 (radius 10.000)</em></blockquote><blockquote><em>Distance to sphere 2 is 10.000 (radius 10.000)</em></blockquote><blockquote><em>Distance to sphere 4 is 10.000 (radius 10.000)</em></blockquote><blockquote><em>Solution 1: 5.00 5.00 -7.07</em></blockquote><blockquote><em>Distance to sphere 1 is 10.000 (radius 10.000)</em></blockquote><blockquote><em>Distance to sphere 3 is 10.000 (radius 10.000)</em></blockquote><blockquote><em>Distance to sphere 4 is 10.000 (radius 10.000)</em></blockquote><blockquote><em>Solution 2: 5.00 5.00 7.07</em></blockquote><blockquote><em>Distance to sphere 1 is 10.000 (radius 10.000)</em></blockquote><blockquote><em>Distance to sphere 3 is 10.000 (radius 10.000)</em></blockquote><blockquote><em>Distance to sphere 4 is 10.000 (radius 10.000)</em></blockquote><blockquote><em>Solution 1: 5.00 5.00 -7.07</em></blockquote><blockquote><em>Distance to sphere 2 is 10.000 (radius 10.000)</em></blockquote><blockquote><em>Distance to sphere 3 is 10.000 (radius 10.000)</em></blockquote><blockquote><em>Distance to sphere 4 is 10.000 (radius 10.000)</em></blockquote><blockquote><em>Solution 2: 5.00 5.00 7.07</em></blockquote><blockquote><em>Distance to sphere 2 is 10.000 (radius 10.000)</em></blockquote><blockquote><em>Distance to sphere 3 is 10.000 (radius 10.000)</em></blockquote><blockquote><em>Distance to sphere 4 is 10.000 (radius 10.000)</em></blockquote><blockquote><em>Sum of coordinate differences:</em></blockquote><blockquote><em>Solution 1: 28.28427, Solution #2: 28.28427</em></blockquote><blockquote><em>Use Solution 2 set</em></blockquote><blockquote><em>Solution 2: 5.00 5.00 -7.07</em></blockquote><blockquote><em>Distance to sphere 1 is 10.00000 (vs. measured 10.00000)</em></blockquote><blockquote><em>Distance to sphere 2 is 10.00000 (vs. measured 10.00000)</em></blockquote><blockquote><em>Distance to sphere 3 is 10.00000 (vs. measured 10.00000)</em></blockquote><blockquote><em>Distance to sphere 4 is 10.00000 (vs. measured 10.00000)</em></blockquote><p>As you can see in Pic2 there are 19 <em>TEdit</em> controls for user input; 4 for each of the 4 sensors plus 3 if the user wants to enter target values. The target values were convenient when debugging the code with sets of points with known solutions. In order to simplify the code, I defined an array, Sensors, of <em>TSensorEdits</em> records, each containing 4 <em>TEdit</em> references (object references are always pointers), plus the numeric version of the X, Y, Z, and R (distance) values represent by the edits for that specific sensor.<br>Perhaps as suggested we can just define references to avoid an assembler.</p><p>Geometrically, each of the 4 sensors and its target distance define a sphere upon which the target must lie, and that should be the common point of intersection of all 4 spheres.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*W-xOQFOKZI4A739r" /></figure><p>Pic4: 115_GUIDesignandRuntime2023–12–02143419.png</p><p>This target coordinate technique above used to help with the understanding about what each distance represents and what the difference results of. Alternatively, the sensors are Satellites and the target is a GPS receiver which reads very accurate time stamps transmitted by the satellites and calculates distances based on time offsets between its clock and satellites’ clocks. About the topic:</p><p><a href="https://gisgeography.com/trilateration-triangulation-gps/">How GPS Receivers Work — Trilateration vs Triangulation — GIS Geography</a></p><p>Another interesting topic is the Runge-Kutta technique for solving second order ordinary differential equations, like in a pendulum motion.</p><p><a href="http://delphiforfun.org/programs/pendulum.htm">Pendulums, Simple and otherwsie (delphiforfun.org)</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vS96PbnyrYYZdr3e" /></figure><p>Pic6: 8_mX5_64bitGUI2.png</p><h3>Conclusion:</h3><p>Triangulation is process of measuring bearings and calculating distances (using the Sine Rule). Trilateration is the process of measuring distances and calculating bearings (using Cosine Rule).<br>Geometrically, each of the 4 sensors and its target distance define a sphere upon which the target must lie, and that should be the common point of intersection of all 4 sphere. <br>64-bit isn’t a magic bullet. Other than that, you only need to change if you’ve already encountered one of the limits imposed by 32-bit or you want to develop plug-ins for 64-bit app or just be compatible with a 64-bit operation system.</p><p>Script: <a href="http://www.softwareschule.ch/examples/maxbox_starter115.txt">softwareschule.ch/examples/maxbox_starter115.txt</a></p><h3>References:</h3><p>Compiled Project:<br><a href="https://github.com/maxkleiner/maXbox4/releases/download/V4.2.4.80/maxbox5.zip">https://github.com/maxkleiner/maXbox4/releases/download/V4.2.4.80/maxbox5.zip</a></p><p>Topic:<br><a href="http://delphiforfun.org/Programs/Math_Topics/PointFrom4Sensors.htm">http://delphiforfun.org/Programs/Math_Topics/PointFrom4Sensors.htm</a></p><p><a href="https://gis.stackexchange.com/questions/17344/differences-between-triangulation-and-trilateration">https://gis.stackexchange.com/questions/17344/differences-between-triangulation-and-trilateration</a></p><p>Preparation:<br><a href="https://stackoverflow.com/questions/4051603/how-should-i-prepare-my-32-bit-delphi-programs-for-an-eventual-64-bit-compiler">https://stackoverflow.com/questions/4051603/how-should-i-prepare-my-32-bit-delphi-programs-for-an-eventual-64-bit-compiler</a></p><p>Doc and Tool: <a href="https://maxbox4.wordpress.com/">https://maxbox4.wordpress.com</a></p><h3>Appendix</h3><p><strong>Unit</strong> UMatrix</p><p><strong>Procedure</strong> Determinant( Dimen : integer; Data : TNmatrix; <strong>var</strong> Det : Float; <br> <strong>var</strong> Error : byte)’);</p><p><strong>Procedure</strong> Inverse2( Dimen : integer; Data : TNmatrix; <strong>var</strong> Inv : TNmatrix; <br> <strong>var</strong> Error : byte)’);</p><p><strong>Procedure</strong> <br> Gaussian_Elimination(Dimen:integer;Coefficients:TNmatrix;Constants:TNvector;<br> <strong>var</strong> Solution:TNvector; <strong>var</strong> Error:byte);</p><p><strong>Procedure</strong> Partial_Pivoting(Dimen:integer; Coefficients:TNmatrix;Constants:TNvector; <br> <strong>var</strong> Solution:TNvector; <strong>var</strong> Error:byte);</p><p><strong>Procedure</strong> LU_Decompose(Dimen:integer;Coefficients:TNmatrix;<br> <strong>var</strong> Decomp:TNmatrix; <strong>var</strong> Permute:TNmatrix; <strong>var</strong> Error:byte);</p><p><strong>Procedure</strong> LU_Solve(Dimen: integer; <strong>var</strong> Decomp TNmatrix;Constants:TNvector;<br> <strong>var</strong> Permute:TNmatrix; <strong>var</strong> Solution:TNvector; <strong>var</strong> Error:byte);</p><p><strong>Procedure</strong> Gauss_Seidel( Dimen : integer; Coefficients : TNmatrix; Constants : TNvector; <br> Tol : Float; MaxIter : integer; <strong>var</strong> Solution : TNvector; <br> <strong>var</strong> Iter : integer; <strong>var</strong> Error : byte)’);<br><strong>end</strong>;</p><p>CL.AddTypeS(‘TNvector’, ‘array[1..30] of Extended’);</p><p><em>//TNvector = array[1..TNArraySize] of Float;</em><br>CL.AddTypeS(‘TNmatrix’, ‘array[1..30] of TNvector’);<br><em>//TNmatrix = array[1..TNArraySize] of TNvector;</em><br>CL.AddConstantN(‘TNNearlyZero’,’Extended’).setExtended( 1E-07);<br>CL.AddConstantN(‘TNArraySize’,’LongInt’).SetInt( 30);<br>CL.AddDelphiFunction(‘Procedure Gaussian_Elimination( Dimen : integer; Coefficients : TNmatrix; Constants : TNvector; var Solution : TNvector; var Error : byte)’);<br>CL.AddDelphiFunction(‘Procedure Partial_Pivoting( Dimen : integer; Coefficients : TNmatrix; Constants : TNvector; var Solution : TNvector; var Error : byte)’);<br>CL.AddDelphiFunction(‘Procedure LU_Decompose( Dimen : integer; Coefficients : TNmatrix; var Decomp : TNmatrix; var Permute : TNmatrix; var Error : byte)’);<br>CL.AddDelphiFunction(‘Procedure LU_Solve2( Dimen : integer; var Decomp : TNmatrix; Constants : TNvector; var Permute : TNmatrix; var Solution : TNvector; var Error : byte)’);<br>CL.AddDelphiFunction(‘Procedure Gauss_Seidel( Dimen : integer; Coefficients : TNmatrix; Constants : TNvector; Tol : Float; MaxIter : integer; var Solution : TNvector; var Iter : integer; var Error : byte)’);<br><strong>end</strong>;</p><blockquote><em>Solution 1: 5.00 5.00 5.00</em></blockquote><blockquote><em>Distance </em><strong><em>to</em></strong><em> sphere 1 </em><strong><em>is</em></strong><em> 6.928 (radius 6.928)</em></blockquote><blockquote><em>Distance </em><strong><em>to</em></strong><em> sphere 2 </em><strong><em>is</em></strong><em> 6.403 (radius 6.403)</em></blockquote><blockquote><em>Distance </em><strong><em>to</em></strong><em> sphere 3 </em><strong><em>is</em></strong><em> 6.403 (radius 6.403)</em></blockquote><blockquote><em>Solution 2: 5.00 -3.00 5.00</em></blockquote><blockquote><em>Distance </em><strong><em>to</em></strong><em> sphere 1 </em><strong><em>is</em></strong><em> 6.928 (radius 6.928)</em></blockquote><blockquote><em>Distance </em><strong><em>to</em></strong><em> sphere 2 </em><strong><em>is</em></strong><em> 6.403 (radius 6.403)</em></blockquote><blockquote><em>Distance </em><strong><em>to</em></strong><em> sphere 3 </em><strong><em>is</em></strong><em> 6.403 (radius 6.403)</em></blockquote><blockquote><em>Sum </em><strong><em>of</em></strong><em> coordinate differences:</em></blockquote><blockquote><em>Solution 1: 1.75172, Solution #2: 24.05681</em></blockquote><blockquote><em>Using Solution 1 </em><strong><em>set</em></strong></blockquote><blockquote><em>Solution 1: 5.00 5.00 5.00</em></blockquote><blockquote><em>Distance </em><strong><em>to</em></strong><em> sphere 1 </em><strong><em>is</em></strong><em> 6.92800 (vs. measured 6.92800)</em></blockquote><blockquote><em>Distance </em><strong><em>to</em></strong><em> sphere 2 </em><strong><em>is</em></strong><em> 6.40300 (vs. measured 6.40300)</em></blockquote><blockquote><em>Distance </em><strong><em>to</em></strong><em> sphere 3 </em><strong><em>is</em></strong><em> 6.40300 (vs. measured 6.40300)</em></blockquote><blockquote><em>Distance </em><strong><em>to</em></strong><em> sphere 4 </em><strong><em>is</em></strong><em> 3.46390 (vs. measured 3.46400)</em></blockquote><p><strong>Max Kleiner 02/12/2023</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0i4N5VrKrbKNhUhF" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VQamkKkWfZyrSWaI" /></figure><p><a href="https://en.wikipedia.org/wiki/Arbal%C3%A8te_(train)">https://en.wikipedia.org/wiki/Arbal%C3%A8te_(train)</a></p><p><em>Originally published at </em><a href="https://softwareschule.code.blog/2023/12/02/trilateration-equation/"><em>http://softwareschule.code.blog</em></a><em> on December 2, 2023.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5bf83f20a4f9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>