distanceFrom with Blocky?

I’m trying to migrate my rules that use iCloud locations for location information. I’m running openHAB 3.3.0M5 on a Pi4B with openhabian.

This works in Rules DSL textual files:

val radius=75 | m  
val PointType home_location = new PointType(new DecimalType(xx.535647135832804), new DecimalType(-xxx.47038000151313))

rule "George iPhone Home"
when Item GeorgesiPhoneiPhone13Pro_Location changed
then
val PointType Gphone_location =  GeorgesiPhoneiPhone13Pro_Location.state as PointType
val Gdistance = new QuantityType<javax.measure.quantity.Length>(Gphone_location.distanceFrom(home_location).toString + " m")

if ( Gdistance <= radius && George_iPhone_Home.state != ON ) {
    George_iPhone_Home.postUpdate(ON)
    logInfo("iPhone Home", "George's iPhone is at " + Home + " home.")
    } 
else {
    if (Gdistance > radius && George_iPhone_Home.state != OFF ) {
        George_iPhone_Home.postUpdate(OFF)
end

I suspect my problem is that I’m trying to use distanceFrom in a Blockly inline block, and it may not be available in the script language, or I am not applying it correctly.

configuration: {}
triggers:
  - id: "1"
    configuration:
      itemName: GeorgesiPhoneiPhone13Pro_Location
    type: core.ItemStateChangeTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      blockSource: '<xml
        xmlns="https://developers.google.com/blockly/xml"><variables><variable
        id="!CJ1x(ff.2tuEw7~p%yS">Burgundy_Location</variable><variable
        id="c{3Jp(;aQdqF$gX@sbC:">GWatch_Location</variable><variable
        id="lhBjZI[66Tp.ZF}mgurQ">GeorgeDistanceFromBurgundy</variable></variables><block
        type="variables_set" id="kaTqI`H*mNN=DenM60$)" x="252" y="31"><field
        name="VAR" id="!CJ1x(ff.2tuEw7~p%yS">Burgundy_Location</field><value
        name="VALUE"><block type="text" id="RLfJMrR(j~:=,qpS}P(u"><field
        name="TEXT">XX.535516, -XXX.470593</field></block></value><next><block
        type="variables_set" id="=12A$NwK|;pHA[8J-Vo`" disabled="true"><field
        name="VAR" id="!CJ1x(ff.2tuEw7~p%yS">Burgundy_Location</field><value
        name="VALUE"><block type="text" id="bL6`^viWcP@Gb00(n$Pv"><field
        name="TEXT">new PointType (40.535516, -111.470593,
        0)</field></block></value><next><block type="variables_set"
        id="r$N{-K0CV486Uy[}y!M7" disabled="true"><field name="VAR"
        id="c{3Jp(;aQdqF$gX@sbC:">GWatch_Location</field><value
        name="VALUE"><block type="text_join" id="$2*]DQby`}8@58tY-;p;"><mutation
        items="3"></mutation><value name="ADD0"><block type="text"
        id="Yn2UMe(M*[xIIFP1Kwyi"><field name="TEXT">new PointType
        (</field></block></value><value name="ADD1"><block
        type="oh_context_info" id="h.!26x;nknc#6$/mAP(E"><field
        name="contextInfo">itemState</field></block></value><value
        name="ADD2"><block type="text" id=":,-+:1{K|)^%En84s|xl"><field
        name="TEXT">)</field></block></value></block></value><next><block
        type="variables_set" id=":H$E[v+=!P*6(#{SDwE9"><field name="VAR"
        id="c{3Jp(;aQdqF$gX@sbC:">GWatch_Location</field><value
        name="VALUE"><block type="oh_context_info"
        id="h@Sv[PVxv4w$!)|mifjH"><field
        name="contextInfo">itemState</field></block></value><next><block
        type="oh_log" id="tmRs-_xl0_Mxe`Say2wW"><field
        name="severity">info</field><value name="message"><shadow type="text"
        id="9ccGxx?DE]-]y2TM-7/U"><field name="TEXT">abc</field></shadow><block
        type="text_join" id="pR}aWp4@z8=lRW2i8:z]"><mutation
        items="8"></mutation><value name="ADD0"><block type="text"
        id="Qnt|vwBxKEsNTq!MIX]x"><field name="TEXT">George Watch Location
        Changed from: </field></block></value><value name="ADD1"><block
        type="oh_context_info" id="+4trAxq,,Gn8~JWTEGwD"><field
        name="contextInfo">oldItemState</field></block></value><value
        name="ADD2"><block type="text" id="Yf)Uh+(tYt](8K=h;34^"><field
        name="TEXT"> to </field></block></value><value name="ADD3"><block
        type="oh_context_info" id="?!;7P9kz@5fz/NUDjvxO"><field
        name="contextInfo">itemState</field></block></value><value
        name="ADD4"><block type="text" id="t{X|D8~+~Rv:]WS.|kSR"><field
        name="TEXT"> Based on :</field></block></value><value name="ADD5"><block
        type="variables_get" id="4)~^H!uaka$wT4.$mc/X"><field name="VAR"
        id="!CJ1x(ff.2tuEw7~p%yS">Burgundy_Location</field></block></value><value
        name="ADD6"><block type="text" id="F8vgTy.J=pnrwB_6A^d+"><field
        name="TEXT"> and </field></block></value><value name="ADD7"><block
        type="variables_get" id="dz-82!+?Pz]}iS.(ExNO"><field name="VAR"
        id="c{3Jp(;aQdqF$gX@sbC:">GWatch_Location</field></block></value></block></value><next><block
        type="oh_script_inline" id="phmu+jnbTRQ;,#4!:2sp"><field
        name="inlineScript">GeorgeDistanceFromBurgundy =
        GWatch_Location.distanceFrom(Burgundy_Location)</field><next><block
        type="oh_log" id="=)AZbq(7#kn~*D91qj#q"><field
        name="severity">info</field><value name="message"><shadow type="text"
        id="$Nz[8-)jRtf?R[t`p1Z4"><field name="TEXT">abc</field></shadow><block
        type="variables_get" id="^AdZ1RN/M[c8pO||w2.,"><field name="VAR"
        id="lhBjZI[66Tp.ZF}mgurQ">GeorgeDistanceFromBurgundy</field></block></value></block></next></block></next></block></next></block></next></block></next></block></next></block><block
        type="oh_context_info" id=".q;sAYG/el^(5%(@8v,f" x="612" y="187"><field
        name="contextInfo">itemState</field></block><block type="text"
        id="XfcwRE,Pkfr}rp}m[rBt" x="645" y="222"><field
        name="TEXT">)</field></block></xml>'
      type: application/javascript
      script: >
        var Burgundy_Location, GWatch_Location, GeorgeDistanceFromBurgundy;


        var logger = Java.type('org.slf4j.LoggerFactory').getLogger('org.openhab.rule.' + ctx.ruleUID);



        Burgundy_Location = 'XX.535516, -XXX.470593';

        GWatch_Location = event.itemState;

        logger.info((['George Watch Location Changed from: ',event.oldItemState,' to ',event.itemState,' Based on :',Burgundy_Location,' and ',GWatch_Location].join('')));

        GeorgeDistanceFromBurgundy = GWatch_Location.distanceFrom(Burgundy_Location)

        logger.info(GeorgeDistanceFromBurgundy);


        event.itemState;


        ')';
    type: script.ScriptAction

Here is the result:

2022-05-21 11:43:24.025 [INFO ] [rule.GeorgeWatchDistanceFromBurgundy] - George Watch Location Changed from: 40.53542529236596,-111.47048788155566,0.0 to 40.535449138880274,-111.47036173391292,0.0 Based on :new PointType (40.535516, -111.470593, 0 and new PointType (40.535449138880274,-111.47036173391292,0.0)
2022-05-21 11:43:24.070 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'GeorgeWatchDistanceFromBurgundy' failed: TypeError: GWatch_Location.distanceFrom is not a function in <eval> at line number 9

The PointType was something I tried when I first got an error message that only told me it failed:

2022-05-21 12:48:37.852 [INFO ] [rule.GeorgeWatchDistanceFromBurgundy] - George Watch Location Changed from: 40.53530610208544,-111.4703528226711,0.0 to 40.53542629819413,-111.46995454105685,0.0 Based on :40.535516, -111.470593 and 40.53542629819413,-111.46995454105685,0.0
2022-05-21 12:48:37.862 [ERROR] [e.automation.internal.RuleEngineImpl] - Failed to execute rule 'GeorgeWatchDistanceFromBurgundy': Fail to execute action: 2

Any thoughts? Is it too much to try and do this in Blockly?