adding the spatial lag function
This commit is contained in:
@@ -7,11 +7,10 @@ CREATE OR REPLACE FUNCTION
|
||||
num_ngbrs INT,
|
||||
geom_col TEXT,
|
||||
id_col TEXT)
|
||||
RETURNS TABLE (lag NUMERIC, rowid INT)
|
||||
RETURNS TABLE (spatial_lag NUMERIC, rowid INT)
|
||||
AS $$
|
||||
from crankshaft.spatial_lag import Spatial
|
||||
spatial = Spatial()
|
||||
# TODO: use named parameters or a dictionary
|
||||
return spatial.spatial_lag(subquery, column_name, w_type,
|
||||
num_ngbrs, geom_col, id_col)
|
||||
$$ LANGUAGE plpythonu;
|
||||
|
||||
@@ -41,6 +41,6 @@ class Spatial:
|
||||
|
||||
# calculate spatial_lag values
|
||||
|
||||
lag = ps.weights.spatial_lag.lag_spatial(weight, attr_vals)
|
||||
spatial_lag = ps.weights.spatial_lag.lag_spatial(weight, attr_vals)
|
||||
|
||||
return zip(lag, weight.id_order)
|
||||
return zip(spatial_lag, weight.id_order)
|
||||
|
||||
Reference in New Issue
Block a user