How to create latitude and longitude automatically for civirm contact
You need to enable Mapping and Geocoding from civicrm/admin/setting/mapping?reset=1


Enter your API Key or Application ID. An API Key is required for the Google Maps API. Refer to developers.google.com for the latest information.
Save the form and you should be able to see latitude and longitude based on your contact's address. Note that it displays when you click on inline edit and load the address form as shown below.




Also see https://docs.civicrm.org/user/en/latest/initial-set-up/mapping/