Skip to content

Commit

Permalink
Merge pull request #77 from YosanAI/master
Browse files Browse the repository at this point in the history
fix Google map provider outdated API
  • Loading branch information
tentone authored Aug 12, 2024
2 parents 7eddf2e + 9dbf007 commit 7329cda
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions source/providers/GoogleMapsProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class GoogleMapsProvider extends MapProvider
*/
public createSession(): void
{
const address = 'https://www.googleapis.com/tile/v1/createSession?key=' + this.apiToken;
const address = 'https://tile.googleapis.com/v1/createSession?key=' + this.apiToken;
const data = JSON.stringify({
mapType: this.mapType,
language: 'en-EN',
Expand All @@ -79,7 +79,7 @@ export class GoogleMapsProvider extends MapProvider
scale: 'scaleFactor1x'
});

XHRUtils.request(address, 'GET', {'Content-Type': 'text/json'}, data, (response, xhr) =>
XHRUtils.request(address, 'POST', {'Content-Type': 'text/json'}, data, (response, xhr) =>
{
this.sessionToken = response.session;
}, function(xhr)
Expand All @@ -102,7 +102,7 @@ export class GoogleMapsProvider extends MapProvider
reject();
};
image.crossOrigin = 'Anonymous';
image.src = 'https://www.googleapis.com/tile/v1/tiles/' + zoom + '/' + x + '/' + y + '?session=' + this.sessionToken + '&orientation=' + this.orientation + '&key=' + this.apiToken;
image.src = 'https://tile.googleapis.com/v1/2dtiles/' + zoom + '/' + x + '/' + y + '?session=' + this.sessionToken + '&orientation=' + this.orientation + '&key=' + this.apiToken;
});
}
}

0 comments on commit 7329cda

Please sign in to comment.