Migrate Bing Maps API to Azure Maps API#2093
Merged
Merged
Conversation
* Convert Bing Map to Azure Map * Avoid crash if map underlay fails * Improve user feedback if map underlay fails
sjanzou
approved these changes
Jul 18, 2025
sjanzou
left a comment
Collaborator
There was a problem hiding this comment.
All tests do not crash with or without the Azure key.
The question is what to do for the tz return value when there is no key - should it stay 0?
Also, test 4 without a key has four messages to click through - all informative - I think that is a good workflow...but the invalid tz is set to NaN here which makes more sense than the script return value of 0 when there is a tz failure
| // use GeoTools::GeocodeGoogle for non-NREL builds and set google_api_key in private.h | ||
| if (get_tz) { | ||
| ok = GeoTools::GeocodeDeveloper(cxt.arg(0).as_string(), &lat, &lon, &tz); | ||
| cxt.result().hash_item("tz").assign(tz); // converts NULL to 0 |
Collaborator
Collaborator
Author
There was a problem hiding this comment.
TZ should be null or nan when it is not valid, thanks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Pull Request Template
Description
Migrate deprecated Bing Maps API to Azure Maps API. This pull requests modifies the following functions to use the Azure API, which currently do not work because we don't have an Azure API key for SAM:
Make time zone optional for geocode() function to address (1) above.
Update 3D Shade Calculator to handle failed static map API calls for image underlays to address (2).
Update LK geocode() function to add optional parameter
This is a temporary fix. For a more permanent fix:
Request update to NREL Developer Geocode API to return time zone. Or, consider an offline implementation such as one of the options listed in Stack Overflow here . Note that time zones do not correlate well with latitudes as can be seen in this map from timeanddate.com.
See if NREL Developer API can return a static map for 3D shade calculator. If not, investigate getting a Microsoft Azure key for SAM, or finding another static map service.
See https://github.com/NREL/SAM-private/pull/129 for more discussion of next steps.
Fixes #2092
Goes with https://github.com/NREL/SAM-private/pull/129
To Test
An optional test is to set the value of
azure_api_keyinSAM-private/src/private.hto a valid Microsoft Azure API key -- this should make Steps 4 and 5 work properly without error messages.Checklist