Skip to content

Latest commit

 

History

History
171 lines (120 loc) · 7.42 KB

README.md

File metadata and controls

171 lines (120 loc) · 7.42 KB

PLUTO Data Service

header - owner by type

To help jumpstart some interesting analysis and visualizations built on the PLUTO dataset, we have created a CartoDB instance dedicated to hosting this data for you.

Versions

  • Current - 13.1
  • Available
    • 13.1

Example uses

Data

Data is stored on CartoDB as individual tables in the same way that the NYC.gov website provides them. The naming schema is as follows

Table naming

File bk_mappluto_13v1.zip contains two shapefiles, BXMapPLUTO.shp and BX_Dcp_Mappinglot.shp. They becomes two tables on CartoDB in the naming pattern {burrough code}{file root}{version}. For example,

filename tablename
BXMapPLUTO.shp bx_mappluto_13v1
BX_Dcp_Mappinglot.shp bx_mappinglot_13v1

Boroughs

NYC.gov provides 5 files just like bk_mappluto_13v1.zip described above, one for each of the boroughs with codes as follows, qn, bk, si, bx, mn.

Filter & Query Data

You can use the SQL API to quickly query and filter data in any of the tables listed above. The SQL API takes PostgreSQL and PostGIS SQL statements. This means you can query by distance, perform intersections, or full-text searches. A basic query would be as follows,

SELECT * FROM bk_mappluto_13v1 LIMIT 10

To access the result through the SQL API, you would use the URL, https://pluto.cartodb.com/api/v2/sql and pass it the q= parameter with your URL encoded SQL statement. The result of the above example would be,

https://pluto.cartodb.com/api/v2/sql?q=SELECT%20*%20FROM%20bk_mappluto_13v1%20LIMIT%2010

Result format

If you want to use the data in a programming language such as Javascript or Python, the default JSON format will be handy. If you want to create client-side maps with Javascript (e.g. D3), you can get the results in GeoJSON by adding a parameter, &format=GeoJSON to your URL. Finally, if you want to filter and then download the results, you can get results formatted as CSV, &format=CSV

Maps

default maps

Maps are available for each of the latest versions of the PLUTO datasets.

dataset URL
bx_mappluto_13v1 http://cdb.io/12MBFlO
mn_mappluto_13v1 http://cdb.io/12MBK9d
bk_mappluto_13v1 http://cdb.io/12MBOpi
qn_mappluto_13v1 http://cdb.io/12MBPtn
si_mappluto_13v1 http://cdb.io/12MBS8q

Use maps as Leaflet map layers

You can build your own maps from these layers quickly and easily using CartoDB.js. The quickest example for creating a new map layer from mn_mappluto_13v1 is as follows

  var map = L.map('map').setView([40.77499462,-73.98909694], 12);

  // set a base layer 
  L.tileLayer('http://a.tile.stamen.com/toner/{z}/{x}/{y}.png', {
    attribution: 'stamen http://maps.stamen.com/'
  }).addTo(map);

  // add the cartodb layer
  var layerUrl = 'http://pluto.cartodb.com/api/v2/viz/e21b7338-fbb7-11e2-a0ed-7128c9850036/viz.json';
  cartodb.createLayer(map, layerUrl).addTo(map);

You can get more details on customizing the maps on the CartoDB.js website. The API documentation will tell you how to customize styling and apply filters on the fly.

See this working example to get started.

CartoCSS

owner type

You can style the maps on the fly using the Javascript library. Above is an example of the Bronx styled by the ownertype column. Click the image to see the live example. Another example would be to apply the building-height style to create maps similar to the following,

building-height

The particular CartoCSS used here is,

 #mn_mappluto_13v1{ 
   building-fill: #084081; 
   building-height: 512; 
   [ numfloors <= 64] { 
     building-fill: #0868AC; 
     building-height: 256; 
     [ numfloors <= 32] { 
       building-fill: #2B8CBE; 
       building-height: 128; 
       [ numfloors <= 16] { 
         building-fill: #7BCCC4; 
         building-height: 64; 
         [ numfloors <= 8] { 
           building-fill: #A8DDB5; 
           building-height: 32; 
           [ numfloors <= 4] { 
             building-fill: #CCEBC5; 
             building-height: 16; 
             [ numfloors <= 2] { 
             building-fill: #E0F3DB; 
             [ numfloors = 1] { 
               building-fill: #F7FCF0; 
               building-fill-opacity: 0.6; 
             }
             [ numfloors = 0] { 
               building-fill: #EEE; 
               building-fill-opacity: 0.6; 
             }
           }
         }
       }
     }
   } 
   [ numfloors= null] { 
     building-fill: #ccc; 
     building-fill-opacity: 0.6; 
     building-height: 0; 
   } 
 }
Viz.JSON

To change use any of the datasets in the CartoDB.js visualizations, you need to change the layerUrl parameter in the example to the correct one for the desired dataset. Below are the dataset viz.json URLs,

dataset Viz.json
bx_mappluto_13v1 http://pluto.cartodb.com/api/v2/viz/19652da8-fbb7-11e2-a75b-6139856afd6d/viz.json
mn_mappluto_13v1 http://pluto.cartodb.com/api/v2/viz/e21b7338-fbb7-11e2-a0ed-7128c9850036/viz.json
bk_mappluto_13v1 http://pluto.cartodb.com/api/v2/viz/09adeda4-fbb8-11e2-9ea5-15cfc813f31e/viz.json
qn_mappluto_13v1 http://pluto.cartodb.com/api/v2/viz/4a335440-fbb8-11e2-8ac4-3f21906cb20f/viz.json
si_mappluto_13v1 http://pluto.cartodb.com/api/v2/viz/5c8e6b3e-fbb8-11e2-a9af-619e94a2c50b/viz.json
Client-side SQL

You can use SQL statements to filter the data on your maps or to access JSON or GeoJSON formatted data for building content or visualizations. For examples of each see

Some examples of interesting SQL requests.

Contact

Andrew Hill | @andrewxhill | andrew@vizzuality.com

Hosting provided by CartoDB