Advertisement
Intermediate .NET MAUI, Maps & Location

How do you convert between addresses and coordinates (geocoding)?

Short answer

Use Geocoding.Default.GetLocationsAsync to turn an address into coordinates and GetPlacemarksAsync for reverse geocoding (coordinates to address). Results are platform-provided and may return multiple candidates; handle empties and pick the best match.

Save .NET MAUI mock interview
Advertisement
AModel answer
Use Geocoding.Default.GetLocationsAsync to turn an address into coordinates and GetPlacemarksAsync for reverse geocoding (coordinates to address). Results are platform-provided and may return multiple candidates; handle empties and pick the best match.
var locations = await Geocoding.Default.GetLocationsAsync(
    "1600 Amphitheatre Pkwy, Mountain View");
var first = locations.FirstOrDefault();
Real-world example
A form geocodes a typed address to drop an accurate pin, and reverse-geocodes a tapped point to show its street name.
Likely follow-ups
  • What is reverse geocoding? | Can geocoding return multiple results?
Related topics