diff --git a/src/pg/sql/41_observatory_augmentation.sql b/src/pg/sql/41_observatory_augmentation.sql index 1425933..f7e4f38 100644 --- a/src/pg/sql/41_observatory_augmentation.sql +++ b/src/pg/sql/41_observatory_augmentation.sql @@ -671,9 +671,14 @@ BEGIN USING (SELECT ARRAY(SELECT json_array_elements_text(params))::json[]); RETURN QUERY EXECUTE format($query$ - WITH _geoms AS (SELECT + WITH _raw_geoms AS (SELECT (UNNEST($1)).val as id, - (UNNEST($1)).geom AS geom) + (UNNEST($1)).geom AS geom), + _geoms AS (SELECT id, + CASE WHEN (ST_NPoints(geom) > 500) + THEN ST_CollectionExtract(ST_MakeValid(ST_SimplifyVW(geom, 0.0001)), 3) + ELSE geom END geom + FROM _raw_geoms) SELECT _geoms.id::INT, Array_to_JSON(ARRAY[%s]::JSON[]) FROM _geoms, %s %s diff --git a/src/python/test/perftest.py b/src/python/test/perftest.py index db430c7..4c776ba 100644 --- a/src/python/test/perftest.py +++ b/src/python/test/perftest.py @@ -343,7 +343,7 @@ WHERE obs_perftest_{complexity}.cartodb_id = data.id if 'OBS_RECORD_TEST' in os.environ: record({ 'geom_complexity': geom_complexity, - 'api_method': 'OBS_GetMeasureMeta/OBS_GetMeasureData', + 'api_method': 'OBS_GetData', 'normalization': normalization, 'boundary': boundary, 'geom': geom