compute_spatial_weights

The following code calculates the spatial weights of the dataset from the table specified in the table parameter, using the strategy defined in the weights_def parameter. This example uses the K-nearest neighbor approach with K=4. The result is saved into the spatial datastore with the object name la_bg_knn4.

select *
    from table( 
        pyqEval(
            par_lst => '{  
                "oml_connect": true, 
                "table": "oml_user.la_block_groups", 
                "weights_def": {"type": "KNN", "k": 4},
                "save_weights_as": {"ds_name": "spatial", "obj_name": "la_bg_knn4", "append": true, "overwrite_obj": true}
            }',
            out_fmt => 'XML',
            scr_name =>  'compute_spatial_weights'
        )
    );