local-search

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Local Search with Google Maps

基于Google Maps的本地搜索

Access Google Maps Places API through x402-protected endpoints.
通过受x402保护的端点访问Google Maps Places API。

Setup

设置

See rules/getting-started.md for installation and wallet setup.
查看rules/getting-started.md了解安装和钱包设置方法。

Quick Reference

快速参考

TaskEndpointPriceData Included
Text search (basic)
https://stableenrich.dev/api/google-maps/text-search/partial
$0.02Name, address, rating
Text search (full)
https://stableenrich.dev/api/google-maps/text-search/full
$0.08+ reviews, atmosphere
Nearby search (basic)
https://stableenrich.dev/api/google-maps/nearby-search/partial
$0.02Name, address, rating
Nearby search (full)
https://stableenrich.dev/api/google-maps/nearby-search/full
$0.08+ reviews, atmosphere
Place details (basic)
https://stableenrich.dev/api/google-maps/place-details/partial
$0.02Core info
Place details (full)
https://stableenrich.dev/api/google-maps/place-details/full
$0.05All fields
See rules/partial-vs-full.md for tier selection guidance.
任务端点价格包含数据
文本搜索(基础版)
https://stableenrich.dev/api/google-maps/text-search/partial
$0.02名称、地址、评分
文本搜索(完整版)
https://stableenrich.dev/api/google-maps/text-search/full
$0.08+ 评论、氛围信息
附近搜索(基础版)
https://stableenrich.dev/api/google-maps/nearby-search/partial
$0.02名称、地址、评分
附近搜索(完整版)
https://stableenrich.dev/api/google-maps/nearby-search/full
$0.08+ 评论、氛围信息
地点详情(基础版)
https://stableenrich.dev/api/google-maps/place-details/partial
$0.02核心信息
地点详情(完整版)
https://stableenrich.dev/api/google-maps/place-details/full
$0.05所有字段
查看rules/partial-vs-full.md了解版本选择指南。

Text Search

文本搜索

Search for places by text query:
bash
npx agentcash fetch https://stableenrich.dev/api/google-maps/text-search/partial -m POST -b '{"textQuery": "coffee shops in downtown Seattle"}'
Parameters:
  • textQuery
    - Search query (required)
  • locationBias
    - Prefer results near a location
  • minRating
    - Minimum rating filter (1-5)
  • openNow
    - Only open places
  • maxResultCount
    - Limit results (default: 20)
Full tier adds: reviews, atmosphere data, photos, price level.
通过文本查询搜索地点:
bash
npx agentcash fetch https://stableenrich.dev/api/google-maps/text-search/partial -m POST -b '{"textQuery": "coffee shops in downtown Seattle"}'
参数:
  • textQuery
    - 搜索查询(必填)
  • locationBias
    - 优先返回指定地点附近的结果
  • minRating
    - 最低评分筛选(1-5)
  • openNow
    - 仅返回当前营业的地点
  • maxResultCount
    - 结果数量限制(默认:20)
完整版额外内容: 评论、氛围数据、照片、价格等级。

Nearby Search

附近搜索

Search for places near a location:
bash
npx agentcash fetch https://stableenrich.dev/api/google-maps/nearby-search/partial -m POST -b '{
  "locationRestriction": {
    "circle": {
      "center": {"latitude": 47.6062, "longitude": -122.3321},
      "radius": 1000
    }
  },
  "includedTypes": ["restaurant", "cafe"]
}'
Parameters:
  • locationRestriction
    - Circle with center (lat/lng) and radius in meters
  • includedTypes
    - Place types to include
  • excludedTypes
    - Place types to exclude
  • minRating
    - Minimum rating
  • openNow
    - Only open places
搜索指定地点附近的场所:
bash
npx agentcash fetch https://stableenrich.dev/api/google-maps/nearby-search/partial -m POST -b '{
  "locationRestriction": {
    "circle": {
      "center": {"latitude": 47.6062, "longitude": -122.3321},
      "radius": 1000
    }
  },
  "includedTypes": ["restaurant", "cafe"]
}'
参数:
  • locationRestriction
    - 包含中心点(纬度/经度)和半径(米)的圆形区域
  • includedTypes
    - 要包含的场所类型
  • excludedTypes
    - 要排除的场所类型
  • minRating
    - 最低评分
  • openNow
    - 仅返回当前营业的地点

Place Details

地点详情

Get detailed info for a specific place:
bash
npx agentcash fetch https://stableenrich.dev/api/google-maps/place-details/partial -m POST -b '{"placeId": "ChIJN1t_tDeuEmsRUsoyG83frY4"}'
Input:
  • placeId
    - Google Place ID (from search results)
Partial returns: Name, address, phone, website, hours, rating, types.
Full returns: + reviews, atmosphere (wheelchair access, pets allowed), photos, price level.
获取特定场所的详细信息:
bash
npx agentcash fetch https://stableenrich.dev/api/google-maps/place-details/partial -m POST -b '{"placeId": "ChIJN1t_tDeuEmsRUsoyG83frY4"}'
输入:
  • placeId
    - Google地点ID(来自搜索结果)
基础版返回内容: 名称、地址、电话、官网、营业时间、评分、场所类型。
完整版返回内容: + 评论、氛围信息(轮椅通道、允许宠物等)、照片、价格等级。

Common Place Types

常见场所类型

Use these with
includedTypes
/
excludedTypes
:
Food & Drink: restaurant, cafe, bar, bakery, coffee_shop
Lodging: hotel, motel, lodging, guest_house
Shopping: shopping_mall, store, supermarket, clothing_store
Services: bank, atm, gas_station, car_repair, car_wash
Health: hospital, pharmacy, doctor, dentist
Entertainment: movie_theater, museum, park, gym
可在
includedTypes
/
excludedTypes
中使用以下类型:
餐饮: restaurant, cafe, bar, bakery, coffee_shop
住宿: hotel, motel, lodging, guest_house
购物: shopping_mall, store, supermarket, clothing_store
服务: bank, atm, gas_station, car_repair, car_wash
医疗: hospital, pharmacy, doctor, dentist
娱乐: movie_theater, museum, park, gym

Workflows

工作流

Find Businesses in Area

查找区域内的商家

  • (Optional) Check balance:
    npx agentcash wallet info
  • Text search (partial) to find options
  • Review results and select top picks
  • Get full details for selected places
bash
npx agentcash fetch https://stableenrich.dev/api/google-maps/text-search/partial -m POST -b '{"textQuery": "Italian restaurants downtown Portland"}'
bash
npx agentcash fetch https://stableenrich.dev/api/google-maps/place-details/full -m POST -b '{"placeId": "ChIJ..."}'
  • (可选)查看余额:
    npx agentcash wallet info
  • 使用文本搜索(基础版)查找可选场所
  • 查看结果并选择优先选项
  • 获取选中场所的完整详情
bash
npx agentcash fetch https://stableenrich.dev/api/google-maps/text-search/partial -m POST -b '{"textQuery": "Italian restaurants downtown Portland"}'
bash
npx agentcash fetch https://stableenrich.dev/api/google-maps/place-details/full -m POST -b '{"placeId": "ChIJ..."}'

Nearby Search with Filters

带筛选条件的附近搜索

  • Get coordinates for the area
  • Search with location restriction and filters
  • Present sorted results
bash
npx agentcash fetch https://stableenrich.dev/api/google-maps/nearby-search/partial -m POST -b '{
  "locationRestriction": {
    "circle": {
      "center": {"latitude": 40.7128, "longitude": -74.0060},
      "radius": 500
    }
  },
  "includedTypes": ["restaurant"],
  "minRating": 4.0,
  "openNow": true
}'
  • 获取目标区域的坐标
  • 使用位置限制和筛选条件进行搜索
  • 展示排序后的结果
bash
npx agentcash fetch https://stableenrich.dev/api/google-maps/nearby-search/partial -m POST -b '{
  "locationRestriction": {
    "circle": {
      "center": {"latitude": 40.7128, "longitude": -74.0060},
      "radius": 500
    }
  },
  "includedTypes": ["restaurant"],
  "minRating": 4.0,
  "openNow": true
}'

Compare Places with Reviews

通过评论对比场所

  • Search to get place IDs
  • Fetch full details for each candidate
  • Compare ratings, reviews, and amenities
bash
npx agentcash fetch https://stableenrich.dev/api/google-maps/place-details/full -m POST -b '{"placeId": "place_id_here"}'
  • 搜索获取地点ID
  • 为每个候选场所获取完整详情
  • 对比评分、评论和设施
bash
npx agentcash fetch https://stableenrich.dev/api/google-maps/place-details/full -m POST -b '{"placeId": "place_id_here"}'

Cost Optimization

成本优化

Use Partial Tier When:

适合使用基础版的场景:

  • Just need name, address, basic info
  • Browsing/discovering options
  • Initial search before drilling down
  • 仅需要名称、地址等基础信息
  • 浏览/发现可选场所
  • 深入查询前的初始搜索

Use Full Tier When:

适合使用完整版的场景:

  • Need reviews/ratings details
  • Need atmosphere info (accessibility, etc.)
  • Final decision-making
  • 需要评论/评分详情
  • 需要氛围信息(无障碍设施等)
  • 最终决策阶段

Efficient Patterns

高效使用模式

  1. Search partial, detail full:
    • Text search (partial) to find places
    • Place details (full) for the one you care about
  2. Batch searches:
    • Combine filters to reduce calls
    • Use
      maxResultCount
      to limit results
  3. Cache place IDs:
    • Place IDs are stable
    • Re-fetch details only when needed
  1. 基础搜索+完整详情:
    • 使用文本搜索(基础版)查找场所
    • 为关注的场所调用地点详情(完整版)
  2. 批量搜索:
    • 组合筛选条件以减少调用次数
    • 使用
      maxResultCount
      限制结果数量
  3. 缓存地点ID:
    • 地点ID是稳定不变的
    • 仅在需要时重新获取详情

Response Data

响应数据

Partial Tier Fields

基础版字段

  • name
    - Place name
  • formattedAddress
    - Full address
  • location
    - Lat/lng coordinates
  • rating
    - Average rating (1-5)
  • userRatingCount
    - Number of ratings
  • types
    - Place type categories
  • businessStatus
    - OPERATIONAL, CLOSED, etc.
  • regularOpeningHours
    - Hours of operation
  • nationalPhoneNumber
    - Phone number
  • websiteUri
    - Website URL
  • name
    - 场所名称
  • formattedAddress
    - 完整地址
  • location
    - 经纬度坐标
  • rating
    - 平均评分(1-5)
  • userRatingCount
    - 评分数量
  • types
    - 场所类型分类
  • businessStatus
    - 营业状态(运营中、已关闭等)
  • regularOpeningHours
    - 营业时间
  • nationalPhoneNumber
    - 电话号码
  • websiteUri
    - 官网链接

Full Tier Additional Fields

完整版额外字段

  • reviews
    - User reviews with text and ratings
  • priceLevel
    - $ to $$$$
  • accessibilityOptions
    - Wheelchair accessible, etc.
  • parkingOptions
    - Parking availability
  • paymentOptions
    - Accepted payment methods
  • photos
    - Photo references
  • reviews
    - 包含文本和评分的用户评论
  • priceLevel
    - $ 到 $$$$
  • accessibilityOptions
    - 轮椅通道等无障碍设施
  • parkingOptions
    - 停车设施情况
  • paymentOptions
    - 支持的支付方式
  • photos
    - 照片引用