Search code examples
openlayersheremaps

OpenLayers and HERE Maps with "recent" API keyw no longer working


I'm using OpenLayers 6.11 is a small project successfully for many years to access OpenStreetMap, CyclOSM, Bing, and HERE Maps.

Recently, some users have reported that they cannot use HERE Maps. It was working just fine for me when I tried. I then figured out that the users with problems recently acquired a HERE Maps API key.

So I got myself a new API key, and indeed, HERE Maps was no longer working in OpenLayers. For every tile request, HERE returns HTTP 429 Too Many Requests. Switching back to my old API key makes everything work again.

Has somebody experienced this? Is it because I use an older version of OpenLayers (6.11)?

I use the endpoint

https://{1-4}.${ld.base}.maps.api.here.com/${ld.type}/2.1/maptile/newest/

which is also used by the official OpenLayers examples. ld.base and ld.type select the map type dynamically.

I was expecting OpenLayers to work with HERE Maps, independent from when the API key was generated.


Solution

  • There may be a 30 tile requests per second limit https://www.here.com/get-started/pricing/limited-plan-restrictions A full screen map could easily break that, especially with 256 pixel tiles and the preload option.

    The endpoints are also outdated, it may be better to use the latest documented in https://www.here.com/docs/bundle/raster-tile-api-developer-guide/page/topics/styles.html and use 512 tileSize option in OpenLayers and tile requests https://www.here.com/docs/bundle/raster-tile-api-developer-guide/page/topics/examples/example-size.html which will reduce requests by 75%, and remove the preload option from OpenLayers to avoid further unnecessary tile requests.