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

can not attribute when using tilejson tiles #5936

Closed
musicformellons opened this issue Jan 3, 2018 · 3 comments
Closed

can not attribute when using tilejson tiles #5936

musicformellons opened this issue Jan 3, 2018 · 3 comments

Comments

@musicformellons
Copy link

Using .mvt, this works:

  'sources': {
    'osm': {
      'type': 'vector',
      'tiles': ['https://tile.mapzen.com/mapzen/vector/v1/512/all/{z}/{x}/{y}.mvt?api_key=mySecretKey'],
      'attribution': "© <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a>"
    }
  },

When using json as url, this also works:

  'sources': {
    'openmaptiles': {
      'type': 'vector',
      'url': 'https://free.tilehosting.com/data/v3.json?key=mySecretKey'
    }
  },

However, using json in tiles field does NOT work:

  'sources': {
    'openmaptiles': {
      'type': 'vector',
      'tiles': ['https://free.tilehosting.com/data/v3.json?key=mySecretKey'],
      'attribution': "© <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a>"
    }
  },

I get following error in the browser console:

blob:http://localhost:8089/293f7e7f-c69c-46c0-a46e-cfa7094ff579:54 Uncaught Error: Unimplemented type: 3
    at Pbf.skip (blob:http://localhost:8089/293f7e7f-c69c-46c0-a46e-cfa7094ff579:54)
    at Pbf.readFields (blob:http://localhost:8089/293f7e7f-c69c-46c0-a46e-cfa7094ff579:54)
    at new VectorTile (blob:http://localhost:8089/293f7e7f-c69c-46c0-a46e-cfa7094ff579:10)
    at blob:http://localhost:8089/293f7e7f-c69c-46c0-a46e-cfa7094ff579:125
    at XMLHttpRequest.r.onload (blob:http://localhost:8089/293f7e7f-c69c-46c0-a46e-cfa7094ff579:319)

BTW, using url field in combination with attribution field gives following error (so does not provide a workaround):

mapbox-gl.js?d5ed:510 Error: sources.openmaptiles.attribution: a source with a "url" property may not include a "attribution" property
@jfirebaugh
Copy link
Contributor

jfirebaugh commented Jan 3, 2018

If https://free.tilehosting.com/data/v3.json?key=mySecretKey returns TileJSON, it's not valid as an element of the tiles property. The tiles property specifies the URL templates for retrieving tile data, not the URL for retrieving TileJSON.

@musicformellons
Copy link
Author

musicformellons commented Jan 3, 2018

@jfirebaugh I don't quite get it... Could you maybe suggest how I can use the link and attribute at the same time, or is that somehow not possible?

@jfirebaugh
Copy link
Contributor

jfirebaugh commented Jan 3, 2018

No, it's not possible to include some TileJSON properties inline, such as attribution, while loading the rest from a TileJSON URL. You'll need to chose one method of specifying the TileJSON or the other.

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

No branches or pull requests

2 participants