fix broken polygon area normalization

This commit is contained in:
John Krauss 2016-12-21 22:41:53 +00:00
parent d3a57e637c
commit fc3fcbec4e

View File

@ -791,12 +791,12 @@ BEGIN
' / ST_Area(_geoms.geom)' || ' / ST_Area(_geoms.geom)' ||
' ELSE (ST_Area(ST_Intersection(_geoms.geom, ' || geom_tablename || '.' || geom_colname || ')) ' || ' ELSE (ST_Area(ST_Intersection(_geoms.geom, ' || geom_tablename || '.' || geom_colname || ')) ' ||
' / ST_Area(_geoms.geom))' || ' / ST_Area(_geoms.geom))' ||
' END) END ' ' END / (ST_Area(' || geom_tablename || '.' || geom_colname || '::Geography) / 1000000)) END '
-- prenormalized -- prenormalized
ELSE ' CASE ' || ELSE ' CASE ' ||
-- predenominated point-in-poly or user polygon is the same as OBS- polygon -- predenominated point-in-poly or user polygon is the same as OBS- polygon
' WHEN ST_GeometryType(cdb_observatory.FIRST(_geoms.geom)) = ''ST_Point'' ' || ' WHEN ST_GeometryType(cdb_observatory.FIRST(_geoms.geom)) = ''ST_Point'' ' ||
--' OR cdb_observatory.FIRST(_geoms.geom = ' || geom_tablename || '.' || geom_colname || ')' || ' OR cdb_observatory.FIRST(_geoms.geom = ' || geom_tablename || '.' || geom_colname || ')' ||
' THEN cdb_observatory.FIRST(' || numer_tablename || '.' || numer_colname || ') ' || ' THEN cdb_observatory.FIRST(' || numer_tablename || '.' || numer_colname || ') ' ||
' ELSE ' || ' ELSE ' ||
-- predenominated polygon interpolation -- predenominated polygon interpolation
@ -836,7 +836,6 @@ BEGIN
RETURN QUERY EXECUTE format($query$ RETURN QUERY EXECUTE format($query$
WITH _geoms AS (SELECT WITH _geoms AS (SELECT
--generate_series(1, array_length($1, 1)) id,
(UNNEST($1)).val as id, (UNNEST($1)).val as id,
(UNNEST($1)).geom AS geom) (UNNEST($1)).geom AS geom)
SELECT _geoms.id::INT, %s SELECT _geoms.id::INT, %s