You need to sign in to do that
Don't have an account?
how do i retrieve the latitude and longitud from an address and add show it in a map with visualforce?
i need to retrieve the coordinates from address and show them into a map
this is my code i want to be able to show coordinates in the map markers.
<apex:page standardController="Cuenta__c">
<apex:pageBlock >
<apex:map width="600px" height="400px" mapType="roadmap"
center="{!Cuenta__c.Billing_Address__c},{!Cuenta__c.Billing_City__c},{!Cuenta__c.Billing_State__c}">
<apex:mapMarker title="Billing Address"
position="{!Cuenta__c.Billing_Address__c},{!Cuenta__c.Billing_City__c},{!Cuenta__c.Billing_State__c}"
>
<apex:mapInfoWindow >
<apex:outputPanel layout="block" style="font-weight: bold;">
<apex:outputText >{!Cuenta__c.Billing_Address__c}</apex:outputText>
</apex:outputPanel>
<apex:outputPanel layout="block">
<apex:outputText >{!Cuenta__C.Billing_City__C }</apex:outputText>
</apex:outputPanel>
<apex:outputPanel layout="block">
<apex:outputText >{!Cuenta__c.Billing_State__c}</apex:outputText>
</apex:outputPanel>
</apex:mapInfoWindow>
</apex:mapMarker>
<apex:mapMarker title="Fiscal Address"
position="{!Cuenta__c.Fiscal_Address__c},{!Cuenta__c.Fiscal_City__c},{!Cuenta__c.Fiscal_State__c}"
>
<apex:mapInfoWindow >
<apex:outputPanel layout="block" style="font-weight: bold;">
<apex:outputText >{!Cuenta__c.Fiscal_Address__c}</apex:outputText>
</apex:outputPanel>
<apex:outputPanel layout="block">
<apex:outputText >{!Cuenta__C.Fiscal_City__C }</apex:outputText>
</apex:outputPanel>
<apex:outputPanel layout="block">
<apex:outputText >{!Cuenta__c.Fiscal_State__c}</apex:outputText>
</apex:outputPanel>
</apex:mapInfoWindow>
</apex:mapMarker>
<apex:mapMarker title="Shipping Address"
position="{!Cuenta__c.Shipping_Address__c},{!Cuenta__c.Shipping_City__c},{!Cuenta__c.Shipping_State__c}"
>
<apex:mapInfoWindow >
<apex:outputPanel layout="block" style="font-weight: bold;">
<apex:outputText >{!Cuenta__c.Shipping_Address__c}</apex:outputText>
</apex:outputPanel>
<apex:outputPanel layout="block">
<apex:outputText >{!Cuenta__C.Shipping_City__C }</apex:outputText>
</apex:outputPanel>
<apex:outputPanel layout="block">
<apex:outputText >{!Cuenta__c.Shipping_State__c}</apex:outputText>
</apex:outputPanel>
</apex:mapInfoWindow>
</apex:mapMarker>
</apex:map>
</apex:pageBlock>
</apex:page>
Greetings to you!
You can use below code:
Please refer to the below links which might help you further with the above requirement.
https://developer.salesforce.com/forums/?id=906F0000000MM56IAG
http://jessealtman.com/2015/02/new-spring-15-features-mapping/
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_maps_markers.htm
https://help.salesforce.com/articleView?id=custom_field_geolocate_overview.htm&type=0
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
you have to use google api to get the lat and lang from address which you have. kindly use below sample code.
Hope this will help you.
Thanks
karthik