private geocodeRenderDatum()

in src/globemap.ts [1106:1134]


        private geocodeRenderDatum(renderDatum: GlobeMapDataPoint) {
            // zero valued locations should be updated
            if ((renderDatum.location && renderDatum.location.longitude !== 0 && renderDatum.location.latitude !== 0) || this.globeMapLocationCache[renderDatum.placeKey]) {
                return;
            }

            const location: ILocation = { latitude: null, longitude: null };
            let geocoder: IGeocoder;
            this.globeMapLocationCache[renderDatum.placeKey] = location; // store empty object so we don't send AJAX request again
            this.locationsToLoad++;

            geocoder = powerbi.extensibility.geocoder.createGeocoder(this.localStorageService);
            if (geocoder) {
                (geocoder.geocode(
                    renderDatum.place,
                    renderDatum.locationType) as ExtendedPromise<IGeocodeCoordinate>).always((l: ILocation) => {
                        // we use always because we want to cache unknown values.
                        // No point asking bing again and again when it tells us it doesn't know about a location
                        if (l) {
                            location.latitude = l.latitude;
                            location.longitude = l.longitude;
                        }

                        this.locationsLoaded++;

                        this.defferedRender();
                    });
            }
        }