HERE Maps Tile API CORS Errors at Random - here-api

I have tried a number of times to implement HERE Maps for our application. We have both web and desktop clients and so we can't lock it down to a specific domain. I'm using the map tiles REST API, and all works except that I get CORS errors at random. At most zoom levels it is about 10% of the tiles that fail to download, but at deeper zoom levels (14+), almost all tiles fail.
Why would some tiles load but other tiles fail with the same requests? We have a Mapbox version that works flawlessly, and both use the Mercator projection and similar approach to tile specification.
UPDATE
Below you can see that most tiles downloaded OK but one did not:
Following shows one of the successful requests:
Next is a failed request:
Sometimes the same tile will load and other times not. This is at zoom level 10, and at 14+ things get much worse.
UPDATE 2
If I copy and paste two URIs into the browser address bar, one returns a tile and the other an error. Both are identical except for the x and y tile numbers. App ID and code are the same and in the correct order. Examples are (with app id and code masked):
https://4.base.maps.api.here.com/maptile/2.1/maptile/newest/normal.day/16/12107/21196/256/png8?app_id=myID&app_code=mycode
https://4.base.maps.api.here.com/maptile/2.1/maptile/newest/normal.day/16/12104/21195/256/png8?app_id=myID&app_code=mycode
The error on the second one is:
{"error":"Unauthorized","error_description":"This is not a valid app_id and app_code pair. Please verify that the values are not swapped between the app_id and app_code and the values provisioned by HERE (either by your customer representative or via http://developer.here.com/myapps) were copied correctly into the request."}
It makes no sense why I would be getting seemingly random authorization errors.
Any help would be appreciated.

The error you see is not due to CORS error. The 401 unauthorized response code, is either because you are using the wrong credentials or going over the quota for your credentials. In your case, it looks like you are over your quota(number of requests made).For any billing support questions, please email us at selfservesupport#here.com.

Related

x-appengine-citylatlong is not giving correct Lat & Lag

I've hosted my website in Firebase. I'm using firebase onRequest functions to track user Lat & Lag.
Below is the code,
User Geo Location Coordinates (Lat,Lag): ${req.headers['x-appengine-citylatlong']}
I accessed the website from my location, but firebase function gives me different Lat/Lag.
I'm getting correct Lat/Lag from this website https://www.gps-coordinates.net/
Currently I'm getting this Lat/Lag listed in this website https://ipinfo.io/
How do I get exact user coordinates ? please help.
Note: I can't use client side to get Lat/Lag. I have to do this in server side
Google App Engine-specific headers may not be enough for your expectations. You cannot get exact location using headers only. According to App Engine-specific headers:
X-Appengine-CityLatLong
Latitude and longitude of the city from which the request originated. This string might look like "37.386051,-122.083851" for a request from Mountain View.
Getting a precise address from the server without data and consent from the client side is impossible. That would be a huge privacy issue. I'm not sure if you're using web or mobile, but location permissions will always apply regardless of the platform.
This is also mentioned from this thread:
The specification explicitly states that since the nature of the API (Geolocation) also exposes the user’s location and therefore could compromise their privacy, the user’s permission to attempt to obtain the geolocation information must be sought before proceeding
While Maps SDK has wrapper libraries so you can run them on a server, Geolocation API is not mentioned, so what you want is really not possible.

Google Maps API v3 - INVALID_REQUEST on Directions request when machine time is 'behind'

I have just stumbled upon an odd issue when making Directions requests through the Google Maps API.
I had a case where requests would always fail on a particular machine, but not on others using the exact same parameters in the Directions request.
By chance, I noticed the machine clock on the fail case was behind my approx 15 mins, so I corrected the time and now the requests are succeeding.
So can anyone shed any light on why this may be the case, e.g. are Google checking extra values passed across in values and rejecting 'old' requests based on extra time info they can sniff out the browser?
Thanks

Google Maps API v3 - new browser key, still REQUEST_DENIED

I've enabled the Google Maps v3 (and v2) services in the API console and then generated a browser key.
I just swapped a maps.google.com/geo?q= URL for the below URL (example):
http://maps.googleapis.com/maps/api/geocode/json?sensor=false&key=newbrowserkeyfromconsole&address=ALE+BILSERVICE,ALVANGEN,Sweden
It is called with 1600 HTTPGET requests in one run, but now it doesn't even work when pasting 1 URL in a browser!
EDIT: I wrote that it runs once per day, but that is false. Fixed street addresses don't suddenly switch GPS coordinates. ;)
I looked at several similar threads, where generating a new browser key in the API console seemed to work. But not for me. I'm running this from "whatever client ip", so I left the url filter box empty when generating it, and get "Any referrer allowed", so it seems OK.
If I remove the key, I get OVER_QUERY_LIMIT.
Please advise.
Currently, the Google API Console cannot generate working API v3 browser keys for geocoding use at all, whether used via a JSON output URL or Javascript. This has been the case for at least the past 3 days.
Just as for Google Places a few months ago.
All you can do is ignore the error code 610, REQUEST_DENIED, and erroneous alerts, and wait for Google to fix it.
I'll be happy to change the accepted answer to one that describes how to contact Google about your Google Developer account, raise a ticket, register/pay for support, or similar.

google maps v3: referers ignored

I am using google maps v3 and therefor have generated an api key in google's "apis conosole". I am loading the map with the key as parameter. As I can see the statistics in the api-project account, I am quite sure this works smooth.
Now I want to limit the domains which should be able to use a specific key, so I added an entry in "Referers" in the following way: "www.domain.com". I have assumed that if I load the map from a differnt domain (i.e. www.domain.org) I would receive an error, which does not happen. The map is loaded without any warnings (even not in chrome's console). In the apis console these "wrong" referers are even listed.
Additional info: all pages are using a single google app engine account and multiple google apps domains.
Any ideas what my mistake might be?
Thanks!
I think you need to enter full url or wildcards.
http://www.domain.com/*
or
*.domain.com/*
Probably if you dont have at least one value entry - it's ignored (to stop you completely shooting yourself in the foot)

Google Distance Matrix API

I was trying to use Google Distance Matrix API JSON in my project, after formatting the url, for example:
http://maps.googleapis.com/maps/api/distancematrix/json?origins=Vancouver+BC|Seattle&destinations=San+Francisco|Victoria+BC&mode=bicycling&language=en&sensor=false
I was able to view the result in browser, but when I tried to make a http request to get the result, I will receive status : REQUEST_DENIED
In documentation:
REQUEST_DENIED indicates that the service denied use of the Distance
Matrix service by your application.
But I still don't know why my request is denied. More Info from google:
Use of the Distance Matrix API must relate to the display of
information on a Google Map; for example, to determine
origin-destination pairs that fall within a specific driving time from
one another, before requesting and displaying those destinations on a
map. Use of the service in an application that doesn't display a
Google map is prohibited.
If I can't get the result, how can I apply it on google map?
Anyone with same problem? I will post sample code later, to clarify my question more clearly.
I had a similar problem, but it was due to assuming that the sensor tag would default to false, but it is in fact required.
Google Distance Matrix API has a limit of elements set to 2500.
I highly doubt it that you would have gone over this limit, as you would have to have calculated the maximum 10 x 10 matrix 25 times over.
I am from South Africa, and it refused to work for any local addresses until I changed the transport mode to driving (from walking, I mean seriously, we have cars). Maybe that'll help
https://maps.googleapis.com/maps/api/distancematrix/json?origins=Seattle&destinations=San+Francisco&key=YOUR_API_KEY
Please make sure that you have created a credentials on Google Console which can be called as "API KEY" and you are using this API KEY in above request URL on the place of "YOUR_API_KEY"
I had the same problem earlier.
you need to check out with the Google Api key version and codes/scripts of version you are using.
I believe you need to get a Google Maps API key
You need to set an API KEY for using Google map services like this:
https://maps.googleapis.com/maps/api/distancematrix/json?units=imperial&origins=Washington,DC&destinations=New+York+City,NY&key=**YOUR_API_KEY**
First thing is that you need is to have an API key assigned to your application. This is done by creating it in the Google API Manager.
I hope your have enabled distance matrix API from google console for your application.
please refer
https://support.google.com/googleapi/answer/6158841?hl=en
along with this you can restrict API_KEY for unauthorized use.

Resources