Appearance
搜索服务
统一入口 FTMapSearch + FTMapSearchListener(对齐高德 AMapSearchAPI)。9 个接口:输入提示 / 地址搜索 / 地理编码 / 逆地理 / 驾车 / 货车高阶 / 骑行 / 步行 / 行政区划。
完整方法表 / Query 参数 / 错误码见 API 参考 - 搜索服务。
ts
import { FTMapSearch, FTMapGeocodeQuery, FTMapDrivingRouteQuery,
FTMapRouteStrategy, FTMapCoordinate } from 'ftmap-openplatform';
const search = new FTMapSearch();
search.setListener({
onGeocodeSearched: (query, result) => {
const addr = result.geocodeAddressList[0];
// addr.latitude/longitude/formatAddress/adcode/...
},
onDrivingRouteSearched: (query, result) => {
// result.distance/duration/tolls + coords(可直接画线) + steps
},
onSearchError: (code, message) => { ... }
});
search.searchGeocodeAsyn(new FTMapGeocodeQuery('深圳市软件产业基地'));
const from = new FTMapCoordinate(22.523, 113.942);
const to = new FTMapCoordinate(22.611, 114.030);
search.calculateDrivingRouteAsyn(new FTMapDrivingRouteQuery(from, to)); // 起终点坐标或地址二选一
search.cancelAll(); // 取消在途请求