Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

error with add_source in examples #7

Open
trafficonese opened this issue Sep 19, 2019 · 0 comments
Open

error with add_source in examples #7

trafficonese opened this issue Sep 19, 2019 · 0 comments

Comments

@trafficonese
Copy link

There seems to be an error with the add_source function in the provided examples.

When using this code:

mapbox(
  token = token
  , location = c(-71.9675, -13.5320)
  , zoom = 14
) %>%
  add_source(
    id = 'contours',
    js = '{
          	"type": "vector",
          	"url": "mapbox://mapbox.mapbox-terrain-v2"
          }'
  ) %>%
  add_layer(
    js = mapbox_contours
  )

I am getting this error in the console:

Error: "layers.contours: source "contours" not found"

When I include the source directly in the layer JSON it works fine:

    mapbox(
      token = token
      , location = c(-71.9675, -13.5320)
      , zoom = 14
    ) %>%
      add_layer(
        js = '{
      "id": "contours",
      "type": "line",
      "source": {
          	"type": "vector",
          	"url": "mapbox://mapbox.mapbox-terrain-v2"
       },
      "source-layer": "contour",
      "layout": {
        "visibility": "visible",
        "line-join": "round",
        "line-cap": "round"
      },
      "paint": {
        "line-color": "#877b59",
        "line-width": 1
      }
    }'
      )
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant