Skip to content

patrickbrinksma/GeocodeService

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 

Repository files navigation

GeocodeService

This code can be used to retrieve the geocode for a provided address using Google's Geocoding API. You will need to provide your own API key in order for this service to work.

Get your API key here.

Custom Metadata

This code requires custom metadata to pull in API info for Google's Geocode API

Schema

Name Value
Singular Label Geolocation Setting
Plural Label Geolocation Settings
Object Name Geolocation_Settings
Custom Fields Value; Value__c (Text 50)

Records

Label Name Value
Geolocation Endpoint Geolocation_Endpoint https://maps.googleapis.com/maps/api/geocode/
Google Geocoding API Key Google_Geocoding_API_Key [[ replace with your API key ]]
Output Type Output_Type json?

Sample code

GeocodeData geocode = GeolocationServiceUtility.getGeocodeForAddress('Laser 1199 Parque Industrial Maran','Mexicali', 'B.C.');
System.debug('Latitude: ' + geocode.latitude);
System.debug('Longitude:' + geocode.longitude);
System.debug('Status: ' + geocode.status + ': ' + geocode.statusText);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Apex 100.0%