Geolocation
The Geolocation field is used to set geolocation coordinates on an item – either automatically by using values from other item fields or by manually selecting or entering a set of coordinates.
If you want to retrieve coordinates automatically based on values from other fields you:
- Create a set of address fields on the item type – e.g. Street, Zip, City, etc.
- Add a geolocation field to the item type
- In the geolocation field settings, add a comma-separated list of the system names of the fields you want to use to look up the geolocation coordinates (Figure 1.1)
- Save
Then, when an item based on the item type is created, the geolocation field will be filled with coordinates retrieved based on the included address fields (Figure 1.2).
The user can override the retrieved coordinates by checking Override retrieved coordinates and entering coordinates manually, or by using the map marker icon to open a map and selecting a location manually.
When rendering content from this item in frontend, you can then access the geolocation using the GetGeolocation-method and render e.g. a map with a marker:
The example above could show up as this: