maps.nyc.gov

Class: Query

nyc.soda.Query(options)

new Query(options)

An class for querying NYC OpenData using the Socrata SODA API
Parameters:
Name Type Description
options nyc.soda.Query.Options Constructor options
Source:
See:

Methods

(static) and(where, clause) → {string}

Append to a where clause with AND
Parameters:
Name Type Description
where string The current where clause
clause string The new clause to append to the current where clause
Source:
Returns:
The modified where clause
Type
string

addFilter(field, filters)

Add a filter to the query
Parameters:
Name Type Description
field string The field to which the filter will be applied
filters nyc.soda.Query.Filter The filter to apply to the field
Source:

addFilters(filters)

Add filters to the query
Parameters:
Name Type Description
filters Object.<string, Array.<nyc.soda.Query.Filter>> Filter arrays mapped to field names
Source:

clearAllFilters()

Clear all filters on all fields
Source:

clearFilters(fieldopt)

Clear all filters on a field
Parameters:
Name Type Attributes Description
field string <optional>
The field whose filters will be cleared.
Source:

execute(options, callback)

Execute the query
Parameters:
Name Type Description
options nyc.soda.Query.Options The execution options
callback function A callback function to receive the data and a reference to this query
Source:

getUrlAndQuery() → {string}

Get the SODA API call URL that was last requested or will be requested with the current query and filter settings
Source:
Returns:
The SODA API call URL
Type
string

setAppToken(filters)

Overwrite filters for the query
Parameters:
Name Type Description
filters Object.<string, Array.<nyc.soda.Query.Filter>> Filter arrays mapped to field names
Source:

setFilter(field, filters)

Overwrite a filter for the query
Parameters:
Name Type Description
field string The field to which the filter will be applied
filters nyc.soda.Query.Filter The filter to apply to the field
Source:

setFilters(filters)

Overwrite filters for the query
Parameters:
Name Type Description
filters Object.<string, Array.<nyc.soda.Query.Filter>> Filter arrays mapped to field names
Source:

setQuery(query)

Set the base query to which filters can be added
Parameters:
Name Type Description
query nyc.soda.Query.Query the query
Source:

Type Definitions

Filter

Filter object for {nyc.soda.Query}
Type:
  • Object
Properties:
Name Type Description
op string Filter operator (=, !=, >, <, >=, <=, IN, NOT IN, BETWEEN, NOT BETWEEN)
value string | number | Array.<string> | Array.<number> Filter value
Source:

Options

Constructor options for {nyc.soda.Query}
Type:
  • Object
Properties:
Name Type Attributes Description
url string <optional>
SODA URL
appToken string <optional>
SODA $$app_token parameter
query nyc.soda.Query.Query <optional>
Query options
filters Object.<string, Array.<nyc.soda.Query.Filter>> <optional>
Filter arrays mapped to field names
Source:

Query

Query object for {nyc.soda.Query}
Type:
  • Object
Properties:
Name Type Attributes Description
select string <optional>
SODA $select parameter
where string <optional>
SODA $where parameter
group string <optional>
SODA $group parameter
order string <optional>
SODA $order parameter
limit number <optional>
SODA $limit parameter
Source:

nyc-lib: Class: Query

maps.nyc.gov

Class: Query

nyc.soda.Query(options)

new Query(options)

An class for querying NYC OpenData using the Socrata SODA API
Parameters:
Name Type Description
options nyc.soda.Query.Options Constructor options
Source:
See:

Methods

(static) and(where, clause) → {string}

Append to a where clause with AND
Parameters:
Name Type Description
where string The current where clause
clause string The new clause to append to the current where clause
Source:
Returns:
The modified where clause
Type
string

addFilter(field, filters)

Add a filter to the query
Parameters:
Name Type Description
field string The field to which the filter will be applied
filters nyc.soda.Query.Filter The filter to apply to the field
Source:

addFilters(filters)

Add filters to the query
Parameters:
Name Type Description
filters Object.<string, Array.<nyc.soda.Query.Filter>> Filter arrays mapped to field names
Source:

clearAllFilters()

Clear all filters on all fields
Source:

clearFilters(fieldopt)

Clear all filters on a field
Parameters:
Name Type Attributes Description
field string <optional>
The field whose filters will be cleared.
Source:

execute(options, callback)

Execute the query
Parameters:
Name Type Description
options nyc.soda.Query.Options The execution options
callback function A callback function to receive the data and a reference to this query
Source:

getUrlAndQuery() → {string}

Get the SODA API call URL that was last requested or will be requested with the current query and filter settings
Source:
Returns:
The SODA API call URL
Type
string

setAppToken(filters)

Overwrite filters for the query
Parameters:
Name Type Description
filters Object.<string, Array.<nyc.soda.Query.Filter>> Filter arrays mapped to field names
Source:

setFilter(field, filters)

Overwrite a filter for the query
Parameters:
Name Type Description
field string The field to which the filter will be applied
filters nyc.soda.Query.Filter The filter to apply to the field
Source:

setFilters(filters)

Overwrite filters for the query
Parameters:
Name Type Description
filters Object.<string, Array.<nyc.soda.Query.Filter>> Filter arrays mapped to field names
Source:

setQuery(query)

Set the base query to which filters can be added
Parameters:
Name Type Description
query nyc.soda.Query.Query the query
Source:

Type Definitions

Filter

Filter object for {nyc.soda.Query}
Type:
  • Object
Properties:
Name Type Description
op string Filter operator (=, !=, >, <, >=, <=, IN, NOT IN, BETWEEN, NOT BETWEEN)
value string | number | Array.<string> | Array.<number> Filter value
Source:

Options

Constructor options for {nyc.soda.Query}
Type:
  • Object
Properties:
Name Type Attributes Description
url string <optional>
SODA URL
appToken string <optional>
SODA $$app_token parameter
query nyc.soda.Query.Query <optional>
Query options
filters Object.<string, Array.<nyc.soda.Query.Filter>> <optional>
Filter arrays mapped to field names
Source:

Query

Query object for {nyc.soda.Query}
Type:
  • Object
Properties:
Name Type Attributes Description
select string <optional>
SODA $select parameter
where string <optional>
SODA $where parameter
group string <optional>
SODA $group parameter
order string <optional>
SODA $order parameter
limit number <optional>
SODA $limit parameter
Source: