Skip to content
This repository has been archived by the owner on Jan 29, 2025. It is now read-only.

http get nearby

andy.rothwell edited this page Aug 27, 2018 · 8 revisions

http-get-nearby type dataSources

The 'http-get-nearby' type for dataSources retrieval is for querying spatial data that IS NOT stored in an ESRI product like ArcGIS Online or ArcGIS Server. It works with Carto.

There is a limited set of options that you can put in:

option definition required?
table the exact Carto table name Yes
dateMinNum the number of days, months, or years to look back No
dateMinType 'day' or 'month or 'year' Yes if dateMinNum is used, otherwise No
dateField the exact date field name Yes if dateMinNum is used, otherwise No
successFn No
distances the distance from the geocoded address to search No

It finds the features of the dataset you are querying which are within a distance of the current geocoded address. If you do not put in a "distances" option, it uses 250 feet.

NonBundled Project Example:

dataSources: {
  crimeIncidents: {
    type: 'http-get-nearby',
    url: 'https://phl.carto.com/api/v2/sql',
    options: {
      table: 'incidents_part1_part2',
      distances: 500,
      dateMinNum: 1,
      dateMinType: 'year',
      dateField: 'dispatch_date',
    }
  }
}

Bunded Project Example:

export default {
  id: 'crimeIncidents',
  type: 'http-get-nearby',
  url: 'https://phl.carto.com/api/v2/sql',
  options: {
    table: 'incidents_part1_part2',
    dateMinNum: 1,
    dateMinType: 'year',
    dateField: 'dispatch_date',
  }
}
Clone this wiki locally