function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
meghna nmeghna n 

get latitude and longitude for lightning:map address

I have a json as follows

 var providerObj = [];
        providerObj = [{"providerName":"Dr.George A.Beller","network":"In Network","street":"94 Connecticut Blvd","city":"East Hartford","country":"US","state":"CT","postalCode":"06108",

In my component I am using a lightning:map to display the address, this piece of code is working fine.

what I require is to get the geocodes (i.e latitude and longitude) of the above google address as shown in json list

please let me know how to do this.


Ajay K DubediAjay K Dubedi
Hi meghna,
First of all, you can save an external JS in static resource and import it in lightning component using ltng:require tag. Just go to this link :
Save the page as .js file and upload it as static resource
Having said that, there is some limitation from Salesforce side to use Google JS APIs in lightning components. I have an ongoing case with Salesforce for this and they are also not sure of any alternatives.
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Ajay Dubedi