Bing Map api V8 map control: Uncaught TypeError: n.open is not a function - bing-maps

On calling
$.getScript('https://www.bing.com/api/maps/mapcontrol?callback=GetMap', false)
I am getting following:

I see you also posted on the MSDN forums with slightly different details and also contacted the Bing Maps support team. You are using the frozen branch of Bing Maps V8 with MooTools and seeing this issue. As noted here, MooTools is overwriting something which is breaking Bing Maps. The Bing Maps team is looking into options to handle this from their side.

Related

Building a City/Country Search box. Can Bing API support this?

I'm currently building a search box for a mobile app that can search for a Country/ State/ Country. I'm currently looking for APIs that can support this... An option for me would be the Google Places API but as much as possible I don't want to use Google for my project.
So before I import the Bing SDK into my project, I'm curious if anyone knows if this is possible with Bing API.
With Bing Maps you can use the location query API: https://learn.microsoft.com/en-us/bingmaps/rest-services/locations/find-a-location-by-query however, it will also find addresses if you pass them in. Generally though, if you type just a state or country, this API will return the expected result. You can add a bit of code to look through the results and filter them based on their entity type if required.
Since you tagged Azure Maps, you can use the Azure Maps address search API: https://learn.microsoft.com/en-us/rest/api/maps/search/get-search-address It has filtering parameters available that might be better suited for this scenario.

Is mapbox geocoder API available for usage without a map?

I am reading through mapbox JS api but don't seem to find any the geocoding API call that would enable me to provide place lookup using my own typeahead component. So basically I am after sending out a query and receiving an array of results.
I do not mean the example on how to place geocoder Control on or off the map, but rather how can I provide places lookup in my own form [Angular, React, whatever] that does not display any map. Is that possible at all?
[UPDATE May 2020]
Mapbox now does allow you to use a Geocoder without using a map (search form with autocomplete)
July 1, 2019: Removed the default restriction that Services have to be
used in conjunction with a Mapbox map. Point of interest results from
the Geocoding API and Enterprise Boundaries must still be used in
conjunction with a Mapbox map.
Examples can be found from the Mapbox website and from Mapbox Github page.
This previous answer shows an alternative plugin/ service called Algolia that you can use to create a Geocoder.
Another alternative is to use Geocodio.
However, both Geocodio AND Mapbox Geocoder (without a map present) do not support POI (Point of Interest)
E.g. A named place including commercial businesses, public buildings, monuments, and parks, etc.
Hope this helps someone in the future!
This is apparently the violation of Mapbox's terms of service:
You may only use responses from the Geocoding API ("Geocodes") in
conjunction with a Mapbox map.
That's the reason why mapbox-gl-js MapboxGeocoder control (which consumes Mapbox Geocoding API) comes in conjunction with a Mapbox map only and means your scenario is not supported.
July 1, 2019: Removed the default restriction that Services have to be used in conjunction with a Mapbox map. Point of interest results from the Geocoding API and Enterprise Boundaries must still be used in conjunction with a Mapbox map.

Bing Maps AJAX Control v7 Directions module fails randomly

I have implemented the Bing Maps AJAX Control v7 in a website that has 4 predefined walking routes that the user can choose. The chosen route will then be displayed on the map via the Directions module (directionsManager.calculateDirections()) and also the textual description will show up in a div container next to the map.
It all works fine, except that sometimes the directions are not returned by the API and I get the following error returned in the error callback:
Object {
responseCode: 17,
message: "Fußwege sind derzeit nicht verfügba…", // This is german for: "walking directions are currently not available"
eventName: "directionsError"
}
The routes are given in a JSON as simple array of waypoints. Because it does work sometimes, I would conclude the problem does have nothing to do with the waypoints itself.
Note that it does not matter whether the directions are fetched for walking or driving (same error code).
So my questions are:
Do I just have to live with it? If so, what would be best practice to handle the situation regarding user experience?
If not, what could be the cause for this?
Any help would be greatly appreciated!
I suspect that your account is being rate limited. This occurs to trial and basic Bing Maps keys when either your account is consuming transactions at a rate that will exceed the free terms of use, or when the service is under a lot of load from others who are using Bing Maps under the free terms of use. The only way to limit the possibility of being rate limited is to upgrade to an Enterprise key. If you are using an enterprise key and are seeing this issue, then contact the Bing Maps Enterprise support team and they will investigate.

Bing Map: AJAXTileUsage and LoadStandardMap

Based on this article Bing Map Usage, there are 2 ways to load the Bing Map:
AJAXTileUsage, create a map session with bing map key and download the map tile: 8 map tile download is counted as one non-billable transaction
LoadStandardMap, a map tile URL is used to download a map tile using a Bing Maps Key. 8 map tile download is counted as a billable transaction.
There is cost implication here. So obviously we should try to use the AJAXTileUsage.
However based on current reading and internet search, I am a little confused about what we are using right now. Basically we are just using Bing Map Ajax Control 7.0 Map class (see link). Our code doesn't really need to handle the map tile download ourselves.
Based on the http traffic capture from fiddler, here are the steps:
client sends web services request to https://dev.virtualearth.net/webservices/v1/LoggingService/LoggingService.svc/Log with a bing map key
a session id is created and returned to client
map tiles are download, the download URL is like this: https://t0.ssl.ak.dynamic.tiles.virtualearth.net/comp/ch/0320?mkt=en-us&it=G,L&shading=hill&og=30&n=z&key=xxxxxxxxxJeOuGjaxxxxxxxxxxxxxxxxxxFc-Jxxxxxxxxxxxxxy_xxxxxx, (I replace some characters with xxx there). Interesting part is that this key is neither my bing map key nor my session id. I guess that it might contain the session id information within it although I am not sure how to decipher it.
If I move around on the map, more tiles will be downloaded with similar above URL (with some difference at the number after comp/ch. It should be map tile quadkey there)
So does this mean that we are using AJAXTileUsage instead of LoadStandardMap? If so, it would be great since our tile usage won't be counted as billable. I tested with Bing Map trial key, however it seems that Bing Map Usage Report at Bing Map portal is not recording my usage even after couple days are already passed, so I could not figure out from there.
It would be really appreciated if someone could shed some lights here.
Update:
by the way, for above map download URL, I could download map tile without any key: such as https://t2.ssl.ak.dynamic.tiles.virtualearth.net/comp/ch/xxxx?mkt=en-us&it=G,L&shading=hill&og=30&n=z (I changed the quadkey there)
Update 2:
From post: http://www.bing.com/blogs/site_blogs/b/maps/archive/2012/02/01/bing-maps-reporting-tips.aspx:
Many of the Bing Maps API’s have a method for getting the credentials from the map after you
have loaded it using a valid Bing Maps key. One often overlooked feature is that, by 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 to the Bing Maps
services. By doing this, all transactions occurred by this session key will be non-billable.
Many developers overlook this feature and opt to simply use their original Bing Maps key, not
knowing that they are actually incurring more billable transactions than they need to
So based on above information, the mystery key for downloading map tile should be the session key.
If you are using one of the Bing Maps V7 JavaScript controls all tiles are counted under the AJAXTileUsage category. The only time tile usage is billed is if they are accessed directly or perhaps if you are using one of the old map controls
The reports in the Bing Maps portal take a several days to a week to sync due to the number of servers/data centers/users/and transactions generated.

Does Bing Search API use Bing index?

How can I make site that will be correclty found by Bing API, but will be invisible for Bing, Google, Yandex and so on?
Ultimately the same index that powers the Bing site also powers the Bing Search API.
So far as I can guess/expect, there isn't a way for a site to show up in one set of results and not in another.
It is not possible to make a result invisible to Bing Index, but still make it available in the Bing APIs. If you can tell me more about what your scenario is and why you want this experience, probably I can help more.