-
Notifications
You must be signed in to change notification settings - Fork 880
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
Using quadkey #51
Comments
What are quadkeys? |
Quadkeys are tile references that are encapsulated in one string, in contrast to the more common tile references that happen with x / y / zoom https://msdn.microsoft.com/en-us/library/bb259689.aspx In order to accommodate that type of URL, I extended your TileLayer component class CustomTileLayer extends TileLayer {
componentWillMount() {
super.componentWillMount();
const { map, url, ...props } = this.props;
this.leafletElement.__proto__.getTileUrl = function (tilePoint) {
this._adjustTilePoint(tilePoint);
var myUrl = this._url.replace(/{s}/, 0).replace(/{q}/,
this._quadKey(tilePoint.x, tilePoint.y, this._getZoomForUrl()));
return myUrl;
};
this.leafletElement.__proto__._quadKey = function (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('');
};
} with the TileLayer component containing a url that has {q} in it and relabeled "CustomTileLayer" |
@baziz |
@texas697 Been a couple years man - I'm sorry, I wish I could be of more help, but I think the code should be enough to get you going. |
Hi - how should I use quadkeys when instantiating a < Map /> ?
The text was updated successfully, but these errors were encountered: