Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move meta to be attached to the sources #11

Closed
chriswhong opened this issue Aug 7, 2018 · 3 comments · Fixed by #45
Closed

Move meta to be attached to the sources #11

chriswhong opened this issue Aug 7, 2018 · 3 comments · Fixed by #45
Assignees

Comments

@chriswhong
Copy link
Contributor

chriswhong commented Aug 7, 2018

The meta object that currently exists with the layergroup, and is used for populating the 'data' page in a frontend UI, is really just describing a source, not the layergroup.

I recommend we move this config out of the layergroups, and add them to the source objects. This way a layergroup can have more that one source, and each will bring its own meta along for the ride.

"meta":
  {
    "description": "NYC GIS Zoning Features June 2018, Bytes of the Big Apple",
    "url":
    [
      "https://www1.nyc.gov/site/planning/data-maps/open-data.page"
    ],
    "updated_at": "July 18th, 2018"
  }
@hannahkates
Copy link
Contributor

  • Make sure metadata is up to date in layers-api (table names, date, text description)
  • Make sure metadata is being consumed and displayed properly in both CityMap and ZoLa.

@ghost ghost assigned allthesignals Sep 10, 2018
@ghost ghost added in progress and removed this sprint labels Sep 10, 2018
@allthesignals
Copy link
Collaborator

So layer-groups are associated with sources through their layers - so it's really layers that contain the foreign key relationship. A layer-group can have many sources through its layers.

I think this means for the sake of convenience we want the layer-group to contain the reference to the source:

JSON API Output
{
  "data": [
    {
      "type": "layer-groups",
      "id": "aerials",
      "attributes": {
        "id": "aerials",
        "legend": {
          "label": "Aerial Imagery",
          "tooltip": "Aerial Photos Raster Tiles provided by DoITT GIS"
        },
        "layer-visibility-type": "singleton",
        "meta": {
          "description": "NYC DoITT GIS Aerial Photography Tile Layers (TMS)",
          "url": [
            "https://maps.nyc.gov/tiles/"
          ],
          "updated-at": "n/a"
        }
      },
      "relationships": {
        "layers": {
          "data": [
            {
              "type": "layers",
              "id": "aerials-2016"
            },
          ]
        },
        "sources": {
          "data": [
            {
              "type": "sources",
              "id": "aerials-2016"
            }
          ]
        }
      }
    }
  ],
  "included": [
    {
      "type": "layers",
      "id": "aerials-2016",
      "attributes": {
        "style": {
          "id": "aerials-2016",
          "layout": {
            "visibility": "visible"
          },
          "source": "aerials-2016",
          "type": "raster",
          "metadata": {
            "nycplanninglabs:layergroupid": "aerials"
          }
        },
        "display-name": "2016",
        "before": "boundary_state"
      }
    },
    {
      "type": "sources",
      "id": "aerials-2016",
      "attributes": {
        "id": "aerials-2016",
        "type": "raster",
        "meta": {},
        "tiles": [
          "https:\/\/maps.nyc.gov\/xyz\/1.0.0\/photo\/2016\/{z}\/{x}\/{y}.png8"
        ],
        "tileSize": 256
      }
    },
  ]
}

I think we can get away with the API serializing the relationship this way even if it isn't explicitly done this way in our data structure (though it can be inferred). This means our serializers can do some special work to look up the source through the child layer keys.

@allthesignals
Copy link
Collaborator

allthesignals commented Sep 10, 2018

Need to:

  • move metadata from layer-group into source
  • update serializers to lookup related sources through layers and serve the information

@ghost ghost removed the in progress label Sep 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants