openlayers / openlayers/openlayers
Error when getting attributions of a BingMaps layer
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 12.6k
- Forks
- 3.2k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 21
Description
Describe the bug
I sometimes have an error when getting the attributions of a BingMaps layer:
TypeError: Cannot read properties of undefined (reading '1')
at BingMaps.js:315:43
at Array.map (<anonymous>)
at BingMaps.js:308:35
at TileLayer.getAttributions (Layer.js:352:24)
When debugging, the coverrageArea object doesn't have a bbox property:
{"zoomMin":1,"zoomMax":21,"jsonBoundingBox":[-90,-180,90,180],"boundingBox":{"northeast":{"type":"Point","coordinates":[90,180]},"southwest":{"type":"Point","coordinates":[-90,-180]},"southLatitude":-90,"westLongitude":-180,"northLatitude":90,"eastLongitude":180}}
To Reproduce
I don't know when this happens. It works correctly most of the time...
Steps to reproduce the behavior:
- Add a BingMaps layer
- In a 'postrender' event, call getAttributions on the BingMaps layer
Expected behavior
No error in the console
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in BingMaps.js around lines 308-315, then inspect Layer.js around getAttributions. Reproduce with a BingMaps layer and a postrender handler calling getAttributions, especially when coverageArea has boundingBox but no bbox. Done means attribution lookup completes without a console error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100