Skip to main content The Trailblazer Community will be unavailable from 2/1/2025 to 2/2/2025. Please plan your activities accordingly.
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",

                        "distance":"1.3","phone":"860-528-1359"},

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.

thanks

meghna

 
1 answer
  1. Jun 13, 2019, 6:31 AM
    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 : https://maps.googleapis.com/maps/api/js

    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.

    Thanks,

    Ajay Dubedi
0/9000