# 元服务如何获取逆地理编码

元服务可通过地点搜索服务获取经纬度对应的地点信息。开发前需要根据[开发准备](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/map-config-agc)完成配置工作。

参考样例：

```
import { site } from '@kit.MapKit';
@Entry
@Component
struct Demo {
  build() {
    Button('查询逆地理编码')
      .onClick(async () => {
        let params: site.ReverseGeocodeParams = {
          location: {
            latitude: 31.984410259206815,
            longitude: 118.76625379397866
          },
          language: 'cn',
          radius: 200
        };
        try {
          const result = await site.reverseGeocode(params);
          console.info(`逆地理编码查询成功: ${JSON.stringify(result)}`);
        } catch (err) {
          console.error(`逆地理编码查询失败, fail err =  ${JSON.stringify(err)}`);
        }
      })
  }
}
```

参考链接

[reverseGeocode](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/map-site#reversegeocode)  
