To create custom address fields in Salesforce, use the following steps.
1. Go to User Interface in Salesforce Setup.
2. Enable “Use custom address fields”.
Create a Custom Address Field. The Data Type should be Address.
To query the Custom Address Field values, use __StateCode__s, __CountryCode__s, __Street__s, __PostalCode__s, __City__s, __Latitude__s, __Longitude__s, __GeocodeAccuracy__s prefixed with the Field Name.
Sample SOQL:
SELECT Id, Name,
Unit_Location__StateCode__s,
Unit_Location__CountryCode__s,
Unit_Location__Street__s,
Unit_Location__PostalCode__s,
Unit_Location__City__s,
Unit_Location__Latitude__s,
Unit_Location__Longitude__s,
Unit_Location__GeocodeAccuracy__s
FROM Account
WHERE Name = 'InfallibleTechie'