NYCPlanning/labs-community-profiles

Bad land use percentages for CD 7

Closed this issue · 3 comments

User Story

Description

The Community District Profile for CD 7 is showing bad land use data (40% vacant land). The land use percentages don't agree with those shown on the Summary Community District Profile.

What should happen:

What happened instead:

How to reproduce this bug:

  1. Go to https://communityprofiles.planning.nyc.gov/manhattan/7
  2. Compare land use percentages with those on the Summary Profile

Browser(s) and Device(s) observed on:

cd7_landuse
Firefox

Here is the offending query:

WITH lots 
     AS (SELECT a.the_geom, 
                CASE 
                  WHEN c.description IS NOT NULL THEN c.description 
                  ELSE 'Other' 
                END    AS landuse_desc, 
                c.code AS landuse, 
                lotarea 
         FROM   support_mappluto a 
                left join support_landuse_lookup c 
                       ON a.landuse :: INTEGER = c.code 
         WHERE  a.cd = '107'), 
     totalsm 
     AS (SELECT SUM(lotarea) AS total 
         FROM   lots) 
SELECT Count(landuse_desc), 
       Round(SUM(lotarea) / totalsm.total :: NUMERIC, 4) AS percent, 
       landuse, 
       landuse_desc 
FROM   lots, 
       totalsm 
GROUP  BY landuse, 
          landuse_desc, 
          totalsm.total 
ORDER  BY percent DESC 

Researching to see what's going on...

mappluto_v1711___carto_

Here's the tax lot that's throwing off the numbers. According to @lseirup it is much larger lot that covers the Hudson river, but has been clipped to the shoreline, leaving behind the tips of the piers as geometry, but a very large lotarea value.

Will manually exclude this from the query as a quick fix, this issue will serve to memorialize this problem for future reference.

nyc_planning___community_profiles

Added an exclusion to the query in 0e17b78, the land use percentages are now aligned with those in the PDF profile.