Skip to content

Add quadkey to url templates - #2805

Merged
lucaswoj merged 1 commit into
mapbox:masterfrom
boltline:master
Jul 1, 2016
Merged

lucaswoj merged 1 commit into
mapbox:masterfrom
boltline:master

Conversation

@mike-marcacci

Copy link
Copy Markdown
Contributor

This adds the ability to fetch tiles from servers (like Bing) that use the quadkey format. Simply replaces {quadkey} in a URL template with the appropriate value. Test included.

@lucaswoj

lucaswoj commented Jun 30, 2016 •

Copy link
Copy Markdown
Contributor

This is great! Thank you for the contribution @mike-marcacci.

Two things we should do before 🚢:

  • Add some edge case tests for getQuadkey (for example 0,0,0). Are there any existing test suites we can draw on?
  • Add a quadkey.html debug page for manual testing
  • Get a 👍 from @tmcw @bhousel and/or @jfirebaugh

@mike-marcacci

Copy link
Copy Markdown
Contributor Author

Ah yes, 0,0,0 is an interesting use case I haven't tested (Bing requires z >= 1) but definitely should for generic correctness. I'll explore this tonight.

As far as the quadkey.html debug file goes, would it be idiomatic to extend access-token.js to look for a Bing API key?

@lucaswoj

lucaswoj commented Jun 30, 2016 •

Copy link
Copy Markdown
Contributor

Ah yes, 0,0,0 is an interesting use case I haven't tested (Bing requires z >= 1) but definitely should for generic correctness. I'll explore this tonight.

Ah! My mistake! In that case, let's look at the z=1 case. My intent here is to exercise valid edge cases of getQuadkey. I'm not concerned with invalid cases because this code should be isolated from those.

As far as the quadkey.html debug file goes, would it be idiomatic to extend access-token.js to look for a Bing API key?

I'd prefer to not complicate our system with Bing API keys out of a fear of TOS violations. If there's no free quadkey server, we can skip this step.

@bhousel

bhousel commented Jul 1, 2016

Copy link
Copy Markdown
Contributor

Ugh I was going to help by pointing you to the quadkey tests in iD, but we don't have any! 😢

This project looks ok too and has good test coverage (maybe just use it?):
https://www.npmjs.com/package/quadkeytools

I'd prefer to not complicate our system with Bing API keys out of a fear of TOS violations. If there's no free quadkey server, we can skip this step.

☝️ Agree... I think we can skip the debug page - a user would need a Bing key to make it work, and afaik there are no other providers that use it.

@mike-marcacci

Copy link
Copy Markdown
Contributor Author

That makes sense about the debug page; I could possibly get a key from a URL param if that sounds simpler...

I saw that NPM package, which looks really great, but felt like a bit overkill for the one function. Also, I was a bit confused by its use of charCodeAt and fromCharCode in its implementation, but it does produce the same results getQuadkey(6, 29, 3) => 011123

Also for reference:

@lucaswoj

lucaswoj commented Jul 1, 2016

Copy link
Copy Markdown
Contributor

I'm going to merge this as-is and then add some additional test cases in a follow-up PR. Thanks @mike-marcacci and @bhousel 🙇

@lucaswoj
lucaswoj merged commit 7f37ff5 into mapbox:master Jul 1, 2016
@lucaswoj

lucaswoj commented Jul 1, 2016

Copy link
Copy Markdown
Contributor

Extra test cases in 0877cac 🎉

@mike-marcacci

Copy link
Copy Markdown
Contributor Author

Hi @lucaswoj - thanks so much for merging this! (Was off the grid this weekend for a change, so just catching up now.) And great call on the other tests!

@1ec5

1ec5 commented Jul 9, 2016

Copy link
Copy Markdown
Contributor

mapbox/mapbox-gl-native#5628 ports these changes to the other Mapbox GL libraries.

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 this pull request may close these issues.

4 participants