API Documentation

David Heyman edited this page Nov 24, 2014 · 12 revisions

Metadata Functions

/timeline

Returns an array of all years with available / changed data

/layers/:year

Takes a year as a parameter and returns a JSON object containing all available layers for that year along with their hierarchy and styling information

  "Boundaries": {
    "PoliticalBoundaries": {
      "LotsAndLandUsesPoly": {
        "id": "lotslanduse",
        "features": [],
        "style": {
          "fill": "#e9d4be",
          "stroke": null,
          "shape": "poly.svg"
        }
      },
      "NeighborhoodsPoly": {
        "id": "neighborhoods_labels,neighborhoods",
        ...

/search/:year/:word

Searches the namecomple field of features in the given :year for strings that match the :word parameter. Returns the matching name along with an array of globalid and the layer.

  "Centro Cultural Rio de Janeiro": {
    "id": [ "{20959316-34F1-45AA-B223-AF3ABA4DBAF5}" ],
    "layer": "BuildingsPoly"
  },
  "Centro": {
    "id": [ "{B59F6762-3309-4655-B3A9-3D2E981E188E}" ],
    "layer": "NeighborhoodsPoly"
   ...

/raster/:year

Takes a :year and returns metadata for all viewshed points and map / plan rasters available for that year.

[
  {
    "id": "SS7729935_7729935_8328779",
    "file": "SSID2597197",
    "date": "1903 - 1906",
    "creator": "Ferrez, Marc (Brazilian photographer, 1843-1923)",
    "description": "Avenida Central - Vista para o Sul",
    "layer": "ImageViewshedsPoly"
  },
  {
    "id": "SS7729935_7729935_8328895",
    "file": "SSID2840587",
    "date": "1903 - 1906",
    "creator": "Andreatta, Verena",
    "description": "Plano Pereira Passos (1903-1906)",
    "layer": "MapsAndPlansPoly"
  },
  ...

/plans

Returns an array of objects containing the years and names of the plans.

[
  {
    "planyear": "1840-1843",
    "planname": "Beaurepaire-Rohan"
  },
  {
    "planyear": "1875-1876",
    "planname": "Comissão de Melhoramentos"
  ...

/details/:id

Takes a globalid and returns all available attributes from the details table.

{
  "creator": "Domingos Monteiro, Joaquim Cândido Guilhobel, José Maria Jacintho Rebello",
  "year": "1865 - 2013"
}

/names/:lang

Takes a language (en or pr) and returns human-readable names for all database attribute names.

{
  "ImageViewshedsPoly": "Imagem Vista",
  "Collector": "Via Coletora",
  "Convent": "Mosteiro/Convento",
  "Cultural": "Cultural",
  "Cultural Center": "Centro Cultural",
  "Culture": "Cultura",
  "Estrada": "Estrada",
  ...

Geographic Functions

/probe/:year/:coords

Takes a :year and comma-separated coordinates (-43.2,-22.9) and searches the database for features with a 0.0005° radius of the given point. Returns the id, name, and layer of intersecting features.

[
  {
    "id": [ "{4FEDEF21-708C-4A51-AA04-F6EE030458FC}" ],
    "name": "Santo Cristo",
    "layer": "NeighborhoodsPoly"
  },
  {
    "id": [
      "{0F177242-6A60-48E8-BDA4-6B4DF12F09B2}",
      "{4AD4DFB8-B5B2-4C12-B980-61739D457235}"
    ],
    "name": "Rua Atilia",
    "layer": "TransportationRoadLine"
  }
  ...

/draw/:id

Takes a globalid or an array of globalid and returns GeoJSON.

/visual/:year

Takes a :year and returns all viewshed points as GeoJSON for that given year.

/plan/:name

Takes the :name of the plan and returns GeoJSON for all features in that plan.

/feature/:year/:id

Takes a :year and featuretyp name and returns GeoJSON for all matching features of that type.

Tile API

The format for the tile URL is:

http://{server}/tiles/{year}/{z}/{x}/{y}.png?layer={layers}

The final layer parameter is required.

  • To load base (natural environment) layers, use layer=base
  • For all other layers, use layer=
  • To specify which layers are off, append them as a comma-separated array layer=neighborhoods_labels,neighborhoods,buildings

Maps / Plans Raster Tiles

The raster tiles use a slightly different URL scheme:

http://{server}/tiles/?year={year}&z={z}&x={x}&y={y}&raster={id}

All data is sent via parameters. The final raster parameter specifies the ID (SSID2589181)