Skip to content

Commit

Permalink
Merge pull request #312 from CartoDB/311_filter_null_geometries_do
Browse files Browse the repository at this point in the history
Filter NULL geometries in the geomval generation for DO analysis
  • Loading branch information
Mario de Frutos authored Jun 15, 2017
2 parents 7ad7203 + 9358cd5 commit f624d98
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/node/nodes/data-observatory-measure.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ var queryTemplate = Node.template([
' ARRAY_AGG((the_geom, cartodb_id)::geomval) geomvals, ',
' SUM(ST_Area(the_geom)) sumarea ',
' FROM ({{=it.source}}) AS _camshaft_do_measure_analysis',
' WHERE the_geom IS NOT NULL',
' ), ',
'_meta AS ( ',
' SELECT cdb_dataservices_client._OBS_GetMeta_exception_safe( ',
Expand Down
4 changes: 3 additions & 1 deletion lib/node/nodes/data-observatory-multiple-measures.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,10 @@ var queryTemplate = Node.template([
'_summary AS ( ',
' SELECT',
' ST_SetSRID(ST_Extent(the_geom), 4326) extent, ',
' ARRAY_AGG((the_geom, cartodb_id)::geomval) geomvals,',
' count(*)::INT numgeoms',
' FROM _source',
' WHERE the_geom IS NOT NULL',
'),',
'_meta AS (',
' SELECT',
Expand All @@ -123,7 +125,7 @@ var queryTemplate = Node.template([
'_data AS ( ',
' SELECT id AS __obs_id__, {{=it.obsColumns}}',
' FROM cdb_dataservices_client._OBS_GetData_exception_safe(',
' (SELECT ARRAY_AGG((the_geom, cartodb_id)::geomval) FROM _source),',
' (SELECT geomvals FROM _summary),',
' (SELECT meta FROM _meta)',
' ) AS _camshaft_do_measure_analysis_data',
')',
Expand Down

0 comments on commit f624d98

Please sign in to comment.