Skip to content
View source

Geocoding

useGeocoder converts between addresses and coordinates. geocode turns text into places; reverseGeocode turns a coordinate back into an address. The result is pinned on the map.

Geocoding.vue
<script setup lang="ts">
  import { VMap, useGeocoder } from '@geoql/v-mapkit';

  const { geocode, reverseGeocode } = useGeocoder();

  // address → coordinate
  const { results } = await geocode('Apple Park, Cupertino');

  // coordinate → address
  const back = await reverseGeocode(
    new mapkit.Coordinate(51.5074, -0.1278),
  );
</script>