adding not null filter for geom on kmeans

This commit is contained in:
Stuart Lynn 2016-06-10 13:12:55 +00:00
parent 7f3b23f67a
commit 9d3de5a8ef

View File

@ -5,6 +5,7 @@ def kmeans(query, no_clusters, no_init=20):
data = plpy.execute('''select array_agg(cartodb_id order by cartodb_id) as ids, data = plpy.execute('''select array_agg(cartodb_id order by cartodb_id) as ids,
array_agg(ST_X(the_geom) order by cartodb_id) xs, array_agg(ST_X(the_geom) order by cartodb_id) xs,
array_agg(ST_Y(the_geom) order by cartodb_id) ys from ({query}) a array_agg(ST_Y(the_geom) order by cartodb_id) ys from ({query}) a
where the_geom is not null
'''.format(query=query)) '''.format(query=query))
xs = data[0]['xs'] xs = data[0]['xs']