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

Bing Maps getCredentials for non-billable session ID #16

Open
ARChilton opened this issue Jan 9, 2017 · 6 comments
Open

Bing Maps getCredentials for non-billable session ID #16

ARChilton opened this issue Jan 9, 2017 · 6 comments

Comments

@ARChilton
Copy link

Does anyone have any methodology for requesting the bing maps session ID used after the original API key to reduce billable map tile requests.

On the Bing site it says this:

Reducing Usage Transactions
If you are using the Bing Maps Rest services in conjunction with one of the Bing Maps map controls, you can significantly reduce the number of transactions your application incurs against your Bing Maps account if you request the Bing Maps key from the map control rather than using your normal Bing Maps key. This is quite often an overlooked feature. When getting the credentials from the map you do not get back your original Bing Maps key. Instead, you get a special session key which you can use as a Bing Maps key to make requests of the Bing Maps services. By doing this, all transactions incurred by this session key will be non-billable.
https://msdn.microsoft.com/en-us/library/dn894107.aspx

However, I cannot work out how to do this using Leaflet and this plug-in (which is very good!)

If anyone has any ideas that would be brilliant, thanks!

@gmaclennan
Copy link
Member

I believe this is what this plugin already does. It makes an initial request to the Imagery Metadata API with your Bing Maps API Key, which returns a URL for tile requests. This URL does not seem to include your API key and I don't think those tile requests are billable, but I do not know for sure.

@gmaclennan
Copy link
Member

I think this is already resolved, closing since it's been quiet for 6 months.

@johnd0e
Copy link

johnd0e commented Jun 5, 2019

I believe this is what this plugin already does.

No, it does not.

I don't think those tile requests are billable

In fact it is billable.
See https://docs.microsoft.com/en-us/bingmaps/getting-started/bing-maps-dev-center-help/understanding-bing-maps-transactions#rest-services

Only RESTImagery-BasicMetadata is not billable, but it does not contain URI template, which is needed for plugin.

And you can see in that table - RESTImagery is billable.

So, every Bing layer instance initialization produces billable request.
Even if layer is not added to map.

So it makes sense to defer metadata request until layer is actually added to map.
Old shramov plugin does so.

@johnd0e
Copy link

johnd0e commented Jun 5, 2019

BTW, your POINT_METADATA_URL could be made with not billable BasicMetadata request, you just need to fix url.

@gmaclennan
Copy link
Member

Re-opening, open to PRs to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants