Closed BKSnake closed 2 years ago
Bing Maps Tiles Server uses "quadkeys" to address a specific tile. Currently staticmaps supports the xyz schema only thus does not support Bing Maps, sorry.
Feel free to do a PR with quadKeys
implementation yourself. I'm happy to help you with it. Implementation should be relatively easy.
C# implementation source
public static string TileXYToQuadKey(int tileX, int tileY, int levelOfDetail)
{
StringBuilder quadKey = new StringBuilder();
for (int i = levelOfDetail; i > 0; i--)
{
char digit = '0';
int mask = 1 << (i - 1);
if ((tileX & mask) != 0)
{
digit++;
}
if ((tileY & mask) != 0)
{
digit++;
digit++;
}
quadKey.Append(digit);
}
return quadKey.ToString();
}
JavaScript implementation source
const tileXYToQuadKey = (x, y, z) => {
var quadKey = [];
for (var i = z; i > 0; i--) {
var digit = '0';
var mask = 1 << (i - 1);
if ((x & mask) != 0) {
digit++;
}
if ((y & mask) != 0) {
digit++;
digit++;
}
quadKey.push(digit);
}
return quadKey.join('');
}
staticmaps@1.9.1 now supports {quadkeys}
and Bing Maps.
Hello
Could you help me to understand? Ho can I use this lib with Bing Maps. I need generate some image and i have Key to Bing Maps
Thanks