cityofnewyork-us/suitability-of-cityowned-and-leased-property-for-4e2n-s75z
Loading...

Query the Data Delivery Network

Query the DDN

The easiest way to query any data on Splitgraph is via the "Data Delivery Network" (DDN). The DDN is a single endpoint that speaks the PostgreSQL wire protocol. Any Splitgraph user can connect to it at data.splitgraph.com:5432 and query any version of over 40,000 datasets that are hosted or proxied by Splitgraph.

For example, you can query the suitability_of_cityowned_and_leased_property_for table in this repository, by referencing it like:

"cityofnewyork-us/suitability-of-cityowned-and-leased-property-for-4e2n-s75z:latest"."suitability_of_cityowned_and_leased_property_for"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "total_area", -- Total area, expressed in square feet and rounded to the nearest integer; 
    "structure_completed", -- The year construction of the structure(s) was completed and whether such year is an estimate, where applicable; 
    "number_structures", -- The number of structures
    "total_gross_area_structures", -- Total gross area of all structures expressed in square feet rounded to the nearest integer, where applicable;  
    "allowable_building_to_floor_area", -- Allowable ratio of building floor area to the area of the property, where applicable; 
    "bldg_front", -- The frontage along the street, measured in feet; 
    "lot_depth", -- The depth, measured in feet; 
    "lot_front", -- The frontage, measured in feet; 
    "residential_and_non_residential_units", -- The sum of residential and non-residential units in all structures, where applicable; 
    "residential_units", -- The sum of residential units in all buildings on the tax lot.
    "year_alter_2", -- If a building has been altered more than once, this is the year of the most recent alteration.
    "landmark", -- The name of an individual landmark, landmark site (e.g. Richmondtown Restoration), or an interior landmark, as designated by the New York City Landmarks Preservation Commission.
    "nta", -- The Neighborhood Tabulation Area field indicates the New York City Neighborhood area where the site is located
    "bbl", -- The BBL (Borough, Block, and Lot) is a unique identifier for each tax lot in the City
    "bin", -- The BIN (Building Identification Number) is a unique identifier for each building in the City
    "condominium_number", -- The condominium number assigned to the complex, where applicable; 
    "coordinates", -- The coordinate of the XY coordinate pair that depicts the property’s approximate location as expressed in the New York-Long Island State Plane coordination system; 
    "longitude", -- Longitude of property
    "e_designation_number", -- The e-designation number associated with the property, where applicable;
    "industrial_business_zone", -- Whether the property is located in an industrial business zone; 
    "school_dist", -- The community school district that the tax lot is located in.
    "census_block", -- The 2010 census block that the tax lot is located in.
    "census_tract", -- The 2010 census tract that the tax lot is located in.
    "community_district", -- The community district (CD) or joint interest area (JIA) that the tax lot is located in, or partially located in.
    "address", -- An address for the tax lot.
    "land_use_category", -- A code for the tax lot's land use category, modified for display of parks, New York City Department of Parks and Recreation properties and New York State Office of Parks, Recreation and Historic Preservation properties in the appropriate category on land 
    "street_number", -- House/building number
    "street_name", -- street name
    "parcel_name", -- General Property name
    "agency", -- The city agency to which the property is assigned
    "current_uses", -- Sufficient information to determine the property’s current use or to determine that it has no current use; 
    "govt_clean_up_program", -- Whether the property is enrolled in a government cleanup, and if so, the name of such program;
    "latitude", -- Latitude of property
    "pluto_version", -- The Version Number related to the release of PLUTO.
    "zone_dist_1", -- The primary zoning classification of the property; 
    "edc___occupied", -- For each property assigned to the economic development corporation, such list shall include the percentage of usable space actually occupied by a tenant or tenants.
    "contact", -- Agency contact information, including name, telephone number and email address.
    "zone_dist_2", -- The zoning designation occupying the second greatest percentage of the property’s area, where applicable; 
    "num_floors", -- In the primary building on the tax lot, the number of full and partial stories starting from the ground floor.
    "other_floor_area", -- An estimate of the exterior dimensions of the portion of the structure(s) allocated for other than Residential, Office, Retail, Garage, Storage, Loft or Factory use.
    "overlay_2", -- The commercial overlay occupying the second greatest percentage of the property’s area, where applicable; 
    "factory_floor_area", -- An estimate of the exterior dimensions of the portion of the structure(s) allocated for factory, warehouse or loft use.
    "potential_urban_ag", -- Whether the land is suitable for urban agriculture (for description, click “About” then “Attachments”)
    "storage_floor_area", -- An estimate of the exterior dimensions of the portion of the structure(s) allocated for storage or loft purposes.
    "sp_dist_1", -- The special purpose district assigned to the tax lot.
    "garage_floor_area", -- An estimate of the exterior dimensions of the portion of the structure(s) allocated for garage use.
    "retail_floor_area", -- An estimate of the exterior dimensions of the portion of the structure(s) allocated for retail use.
    "residential_floor_area", -- The exterior dimensions of the portion of the structure or structures allocated for residential use, where applicable; 
    "commercial_floor_area", -- The exterior dimensions of the portion of the structure or structures allocated for commercial use, where applicable; 
    "major_use", -- The major use of the structure or structures, where applicable; 
    "police_prct", -- The police precinct; 
    "health_ctr", -- The health center district; 
    "health_area", -- The health area; 
    "year_alter_1", -- If a building has only been altered once, this is the date of the alteration.
    "exempt_tot", -- The actual exempt total value, which is determined differently for each exemption program, is the dollar amount related to that portion of the tax lot that has received an exemption or abatement for Fiscal Year 2013.
    "exempt_land", -- The actual exempt land value, which is determined differently for each exemption program, is the dollar amount related to that portion of the tax lot that has received an exemption or abatement for Fiscal Year 2013.
    "bsmt_code", -- A code describing the basement.
    "fire_comp", -- The fire company that services the property; 
    "irr_lot_code", -- Whether the property is irregularly shaped; 
    "sp_dist_2", -- The special purpose district assigned to the tax lot.
    "boro", -- The borough that the tax lot is located in.
    "zip_code", -- The zip code that the tax lot is located in.
    "open_petroleum_spill", -- Whether the property contains the presence of an open petroleum spill;
    "date_created", -- Date list was generated
    "ratio_building_to_floor_area", -- Ratio of building floor area to the area of the property, where applicable; 
    "number_of_easements", -- The number of easements, where applicable; 
    "bldg_depth", -- The depth of the structure or structures, which is the effective perpendicular distance, measured in feet, where applicable; 
    "office_floor_area", -- An estimate of the exterior dimensions of the portion of the structure(s) allocated for office use.
    "assess_land", -- The actual assessed land value for Fiscal Year 2013.
    "his_dist", -- The name of the Historic District as designated by the New York City Landmarks Preservation Commission.
    "overlay_1", -- The primary commercial overlay assigned to the property, where applicable; 
    "proximity_code", -- Whether the structure or structures are detached, semi-detached or attached to neighboring structures, where applicable; 
    "lot_type_code", -- The location relative to another lot or water, expressed as mixed or unknown, block assemblage, waterfront, corner, through, inside, interior, island, alley, or submerged land;
    "map_atlas", -- The map on which the property appears in the most recent atlas of the city property
    "block", -- The tax block that the tax lot is located in.
    "lot", -- The number of the tax lot.
    "council_district" -- The city council district that the tax lot is located in.
FROM
    "cityofnewyork-us/suitability-of-cityowned-and-leased-property-for-4e2n-s75z:latest"."suitability_of_cityowned_and_leased_property_for"
LIMIT 100;

Connecting to the DDN is easy. All you need is an existing SQL client that can connect to Postgres. As long as you have a SQL client ready, you'll be able to query cityofnewyork-us/suitability-of-cityowned-and-leased-property-for-4e2n-s75z with SQL in under 60 seconds.

Query Your Local Engine

Install Splitgraph Locally
bash -c "$(curl -sL https://github.com/splitgraph/splitgraph/releases/latest/download/install.sh)"
 

Read the installation docs.

Splitgraph Cloud is built around Splitgraph Core (GitHub), which includes a local Splitgraph Engine packaged as a Docker image. Splitgraph Cloud is basically a scaled-up version of that local Engine. When you query the Data Delivery Network or the REST API, we mount the relevant datasets in an Engine on our servers and execute your query on it.

It's possible to run this engine locally. You'll need a Mac, Windows or Linux system to install sgr, and a Docker installation to run the engine. You don't need to know how to actually use Docker; sgrcan manage the image, container and volume for you.

There are a few ways to ingest data into the local engine.

For external repositories, the Splitgraph Engine can "mount" upstream data sources by using sgr mount. This feature is built around Postgres Foreign Data Wrappers (FDW). You can write custom "mount handlers" for any upstream data source. For an example, we blogged about making a custom mount handler for HackerNews stories.

For hosted datasets (like this repository), where the author has pushed Splitgraph Images to the repository, you can "clone" and/or "checkout" the data using sgr cloneand sgr checkout.

Cloning Data

Because cityofnewyork-us/suitability-of-cityowned-and-leased-property-for-4e2n-s75z:latest is a Splitgraph Image, you can clone the data from Spltgraph Cloud to your local engine, where you can query it like any other Postgres database, using any of your existing tools.

First, install Splitgraph if you haven't already.

Clone the metadata with sgr clone

This will be quick, and does not download the actual data.

sgr clone cityofnewyork-us/suitability-of-cityowned-and-leased-property-for-4e2n-s75z

Checkout the data

Once you've cloned the data, you need to "checkout" the tag that you want. For example, to checkout the latest tag:

sgr checkout cityofnewyork-us/suitability-of-cityowned-and-leased-property-for-4e2n-s75z:latest

This will download all the objects for the latest tag of cityofnewyork-us/suitability-of-cityowned-and-leased-property-for-4e2n-s75z and load them into the Splitgraph Engine. Depending on your connection speed and the size of the data, you will need to wait for the checkout to complete. Once it's complete, you will be able to query the data like you would any other Postgres database.

Alternatively, use "layered checkout" to avoid downloading all the data

The data in cityofnewyork-us/suitability-of-cityowned-and-leased-property-for-4e2n-s75z:latest is 0 bytes. If this is too big to download all at once, or perhaps you only need to query a subset of it, you can use a layered checkout.:

sgr checkout --layered cityofnewyork-us/suitability-of-cityowned-and-leased-property-for-4e2n-s75z:latest

This will not download all the data, but it will create a schema comprised of foreign tables, that you can query as you would any other data. Splitgraph will lazily download the required objects as you query the data. In some cases, this might be faster or more efficient than a regular checkout.

Read the layered querying documentation to learn about when and why you might want to use layered queries.

Query the data with your existing tools

Once you've loaded the data into your local Splitgraph Engine, you can query it with any of your existing tools. As far as they're concerned, cityofnewyork-us/suitability-of-cityowned-and-leased-property-for-4e2n-s75z is just another Postgres schema.

Related Documentation:

Loading...