Place Autocomplete

플랫폼 선택: Android iOS JavaScript 웹 서비스

Place Autocomplete 서비스는 HTTP 요청에 대한 응답으로 장소 예상 검색어를 반환하는 웹 서비스입니다. 이 요청은 텍스트 검색 문자열과 선택적인 지리적 경계를 지정합니다. 이 서비스는 사용자 유형에 따라 비즈니스, 주소, 관심 장소와 같은 장소를 반환하여 텍스트 기반 지역 검색을 위한 자동 완성 기능을 제공할 수 있습니다.

Place Autocomplete 요청

Place Autocomplete 서비스는 Places API의 일부이며 Places APIAPI 키 및 할당량을 공유합니다.

Place Autocomplete 서비스는 전체 단어 및 하위 문자열을 일치시켜 장소 이름, 주소 및 Plus Code를 결정할 수 있습니다. 따라서 사용자가 입력할 때 애플리케이션에서 쿼리를 전송하여 즉시 장소 예상 검색어를 제공할 수 있습니다.

플러스 코드의 형식을 올바르게 지정해야 합니다. 즉, 더하기 기호를 %2B로 URL 이스케이프 처리해야 하고 공백은 %20로 URL 이스케이프 처리해야 합니다.

  • 글로벌 코드는 4자리 지역 코드와 6자 이상의 로컬 코드입니다. 예를 들어 URL 이스케이프 전역 코드 849VCWC8+R9849VCWC8%2BR9입니다.
  • 복합 코드는 명시적인 위치가 포함된 6자 (또는 그 이상)의 로컬 코드입니다. 예를 들어 URL 이스케이프 처리된 복합 코드 CWC8+R9 Mountain View, CA, USACWC8%2BR9%20Mountain%20View%20CA%20USA입니다.

반환된 예상 검색어는 사용자에게 표시되어 원하는 장소를 선택하는 데 도움을 줄 수 있도록 설계되었습니다. 장소 세부정보 요청을 전송하여 반환된 장소에 대한 자세한 정보를 확인할 수 있습니다.

장소 자동완성 요청은 다음 형식을 사용하는 HTTP URL입니다.

https://maps.googleapis.com/maps/api/place/autocomplete/output?parameters

여기서 output는 다음 값 중 하나일 수 있습니다.

  • json (권장)은 출력을 JavaScript 객체 표기법 (JSON)으로 나타냅니다.
  • xml는 출력을 XML로 나타냅니다.

장소 자동완성 요청을 시작하기 위해서는 특정 매개변수가 필요합니다. URL의 표준에 따라 모든 매개변수는 앰퍼샌드(&) 문자로 구분합니다. 매개변수와 가능한 값의 목록은 아래에 나와 있습니다.

Required parameters

  • input

    The text string on which to search. The Place Autocomplete service will return candidate matches based on this string and order results based on their perceived relevance.

Optional parameters

  • components

    A grouping of places to which you would like to restrict your results. Currently, you can use components to filter by up to 5 countries. Countries must be passed as a two character, ISO 3166-1 Alpha-2 compatible country code. For example: components=country:fr would restrict your results to places within France. Multiple countries must be passed as multiple country:XX filters, with the pipe character | as a separator. For example: components=country:us|country:pr|country:vi|country:gu|country:mp would restrict your results to places within the United States and its unincorporated organized territories.

    Note: If you receive unexpected results with a country code, verify that you are using a code which includes the countries, dependent territories, and special areas of geographical interest you intend. You can find code information at Wikipedia: List of ISO 3166 country codes or the ISO Online Browsing Platform.
  • language

    The language in which to return results.

    • See the list of supported languages. Google often updates the supported languages, so this list may not be exhaustive.
    • If language is not supplied, the API attempts to use the preferred language as specified in the Accept-Language header.
    • The API does its best to provide a street address that is readable for both the user and locals. To achieve that goal, it returns street addresses in the local language, transliterated to a script readable by the user if necessary, observing the preferred language. All other addresses are returned in the preferred language. Address components are all returned in the same language, which is chosen from the first component.
    • If a name is not available in the preferred language, the API uses the closest match.
    • The preferred language has a small influence on the set of results that the API chooses to return, and the order in which they are returned. The geocoder interprets abbreviations differently depending on language, such as the abbreviations for street types, or synonyms that may be valid in one language but not in another. For example, utca and tér are synonyms for street in Hungarian.
  • location

    The point around which to retrieve place information. This must be specified as latitude,longitude. The radius parameter must also be provided when specifying a location. If radius is not provided, the location parameter is ignored.

    When using the Text Search API, the `location` parameter may be overriden if the `query` contains an explicit location such as `Market in Barcelona`.
  • locationbias

    Prefer results in a specified area, by specifying either a radius plus lat/lng, or two lat/lng pairs representing the points of a rectangle. If this parameter is not specified, the API uses IP address biasing by default.

    • IP bias: Instructs the API to use IP address biasing. Pass the string ipbias (this option has no additional parameters).
    • Circular: A string specifying radius in meters, plus lat/lng in decimal degrees. Use the following format: circle:radius@lat,lng.
    • Rectangular: A string specifying two lat/lng pairs in decimal degrees, representing the south/west and north/east points of a rectangle. Use the following format:rectangle:south,west|north,east. Note that east/west values are wrapped to the range -180, 180, and north/south values are clamped to the range -90, 90.
  • locationrestriction

    Restrict results to a specified area, by specifying either a radius plus lat/lng, or two lat/lng pairs representing the points of a rectangle.

    • Circular: A string specifying radius in meters, plus lat/lng in decimal degrees. Use the following format: circle:radius@lat,lng.
    • Rectangular: A string specifying two lat/lng pairs in decimal degrees, representing the south/west and north/east points of a rectangle. Use the following format:rectangle:south,west|north,east. Note that east/west values are wrapped to the range -180, 180, and north/south values are clamped to the range -90, 90.
  • offset

    The position, in the input term, of the last character that the service uses to match predictions. For example, if the input is Google and the offset is 3, the service will match on Goo. The string determined by the offset is matched against the first word in the input term only. For example, if the input term is Google abc and the offset is 3, the service will attempt to match against Goo abc. If no offset is supplied, the service will use the whole term. The offset should generally be set to the position of the text caret.

  • origin

    The origin point from which to calculate straight-line distance to the destination (returned as distance_meters). If this value is omitted, straight-line distance will not be returned. Must be specified as latitude,longitude.

  • radius

    Defines the distance (in meters) within which to return place results. You may bias results to a specified circle by passing a location and a radius parameter. Doing so instructs the Places service to prefer showing results within that circle; results outside of the defined area may still be displayed.

    The radius will automatically be clamped to a maximum value depending on the type of search and other parameters.

    • Autocomplete: 50,000 meters
    • Nearby Search:
      • with keyword or name: 50,000 meters
      • without keyword or name
        • Up to 50,000 meters, adjusted dynamically based on area density, independent of rankby parameter.
        • When using rankby=distance, the radius parameter will not be accepted, and will result in an INVALID_REQUEST.
    • Query Autocomplete: 50,000 meters
    • Text Search: 50,000 meters
  • region

    The region code, specified as a ccTLD ("top-level domain") two-character value. Most ccTLD codes are identical to ISO 3166-1 codes, with some notable exceptions. For example, the United Kingdom's ccTLD is "uk" (.co.uk) while its ISO 3166-1 code is "gb" (technically for the entity of "The United Kingdom of Great Britain and Northern Ireland").

  • sessiontoken

    A random string which identifies an autocomplete session for billing purposes.

    The session begins when the user starts typing a query, and concludes when they select a place and a call to Place Details is made. Each session can have multiple queries, followed by one place selection. The API key(s) used for each request within a session must belong to the same Google Cloud Console project. Once a session has concluded, the token is no longer valid; your app must generate a fresh token for each session. If the sessiontoken parameter is omitted, or if you reuse a session token, the session is charged as if no session token was provided (each request is billed separately).

    We recommend the following guidelines:

    • Use session tokens for all autocomplete sessions.
    • Generate a fresh token for each session. Using a version 4 UUID is recommended.
    • Ensure that the API key(s) used for all Place Autocomplete and Place Details requests within a session belong to the same Cloud Console project.
    • Be sure to pass a unique session token for each new session. Using the same token for more than one session will result in each request being billed individually.
  • strictbounds

    Returns only those places that are strictly within the region defined by location and radius. This is a restriction, rather than a bias, meaning that results outside this region will not be returned even if they match the user input.

  • types

    You can restrict results from a Place Autocomplete request to be of a certain type by passing the types parameter. This parameter specifies a type or a type collection, as listed in Place Types. If nothing is specified, all types are returned.

    For the value of the types parameter you can specify either:

    • Up to five values from Table 1 or Table 2. For multiple values, separate each value with a | (vertical bar). For example:

      types=book_store|cafe

    • Any single supported filter in Table 3. You cannot mix type collections.

    The request will be rejected with an INVALID_REQUEST error if:

    • More than five types are specified.
    • Any unrecognized types are present.
    • Any types from in Table 1 or Table 2 are mixed with any of the filters in Table 3.

Place Autocomplete 예

캘리포니아 샌프란시스코를 중심으로 한 지역 내에 'Amoeba' 문자열이 포함된 시설 요청:

URL

https://maps.googleapis.com/maps/api/place/autocomplete/json
  ?input=amoeba
  &location=37.76999%2C-122.44696
  &radius=500
  &types=establishment
  &key=YOUR_API_KEY

cURL

curl -L -X GET 'https://maps.googleapis.com/maps/api/place/autocomplete/json?input=amoeba&types=establishment&location=37.76999%2C-122.44696&radius=500&key=YOUR_API_KEY'

샌프란시스코 Ashbury St & Haight St로부터 500미터 이내의 결과로 제한된 동일한 요청:

URL

https://maps.googleapis.com/maps/api/place/autocomplete/json
  ?input=amoeba
  &location=37.76999%2C-122.44696
  &radius=500
  &strictbounds=true
  &types=establishment
  &key=YOUR_API_KEY

cURL

curl -L -X GET 'https://maps.googleapis.com/maps/api/place/autocomplete/json?input=amoeba&types=establishment&location=37.76999%2C-122.44696&radius=500&strictbounds=true&key=YOUR_API_KEY'

프랑스어 검색결과에서 'Vict'가 포함된 주소 요청:

URL

https://maps.googleapis.com/maps/api/place/autocomplete/json
  ?input=Vict
  &language=fr
  &types=geocode
  &key=YOUR_API_KEY

cURL

curl -L -X GET 'https://maps.googleapis.com/maps/api/place/autocomplete/json?input=Vict&types=geocode&language=fr&key=YOUR_API_KEY'

'Vict'가 포함된 도시와 브라질 포르투갈어 결과:

URL

https://maps.googleapis.com/maps/api/place/autocomplete/json
  ?input=Vict
  &language=pt_BR
  &types=%28cities%29
  &key=YOUR_API_KEY

cURL

curl -L -X GET 'https://maps.googleapis.com/maps/api/place/autocomplete/json?input=Vict&types=(cities)&language=pt_BR&key=YOUR_API_KEY'

이 예시의 API 키는 자체 키로 바꿔야 합니다.

Place Autocomplete 응답

Place Autocomplete 응답은 요청의 URL 경로 내에 output 플래그에서 지정한 형식으로 반환됩니다. 아래 결과는 다음 매개변수를 사용하여 쿼리에 대해 반환될 수 있는 결과를 나타냅니다.

URL

https://maps.googleapis.com/maps/api/place/autocomplete/json
  ?input=Paris
  &types=geocode
  &key=YOUR_API_KEY

cURL

curl -L -X GET 'https://maps.googleapis.com/maps/api/place/autocomplete/json?input=Paris&types=geocode&key=YOUR_API_KEY'

JSON

{
  "predictions":
    [
      {
        "description": "Paris, France",
        "matched_substrings": [{ "length": 5, "offset": 0 }],
        "place_id": "ChIJD7fiBh9u5kcRYJSMaMOCCwQ",
        "reference": "ChIJD7fiBh9u5kcRYJSMaMOCCwQ",
        "structured_formatting":
          {
            "main_text": "Paris",
            "main_text_matched_substrings": [{ "length": 5, "offset": 0 }],
            "secondary_text": "France",
          },
        "terms":
          [
            { "offset": 0, "value": "Paris" },
            { "offset": 7, "value": "France" },
          ],
        "types": ["locality", "political", "geocode"],
      },
      {
        "description": "Paris, TX, USA",
        "matched_substrings": [{ "length": 5, "offset": 0 }],
        "place_id": "ChIJmysnFgZYSoYRSfPTL2YJuck",
        "reference": "ChIJmysnFgZYSoYRSfPTL2YJuck",
        "structured_formatting":
          {
            "main_text": "Paris",
            "main_text_matched_substrings": [{ "length": 5, "offset": 0 }],
            "secondary_text": "TX, USA",
          },
        "terms":
          [
            { "offset": 0, "value": "Paris" },
            { "offset": 7, "value": "TX" },
            { "offset": 11, "value": "USA" },
          ],
        "types": ["locality", "political", "geocode"],
      },
      {
        "description": "Paris, TN, USA",
        "matched_substrings": [{ "length": 5, "offset": 0 }],
        "place_id": "ChIJ4zHP-Sije4gRBDEsVxunOWg",
        "reference": "ChIJ4zHP-Sije4gRBDEsVxunOWg",
        "structured_formatting":
          {
            "main_text": "Paris",
            "main_text_matched_substrings": [{ "length": 5, "offset": 0 }],
            "secondary_text": "TN, USA",
          },
        "terms":
          [
            { "offset": 0, "value": "Paris" },
            { "offset": 7, "value": "TN" },
            { "offset": 11, "value": "USA" },
          ],
        "types": ["locality", "political", "geocode"],
      },
      {
        "description": "Paris, Brant, ON, Canada",
        "matched_substrings": [{ "length": 5, "offset": 0 }],
        "place_id": "ChIJsamfQbVtLIgR-X18G75Hyi0",
        "reference": "ChIJsamfQbVtLIgR-X18G75Hyi0",
        "structured_formatting":
          {
            "main_text": "Paris",
            "main_text_matched_substrings": [{ "length": 5, "offset": 0 }],
            "secondary_text": "Brant, ON, Canada",
          },
        "terms":
          [
            { "offset": 0, "value": "Paris" },
            { "offset": 7, "value": "Brant" },
            { "offset": 14, "value": "ON" },
            { "offset": 18, "value": "Canada" },
          ],
        "types": ["neighborhood", "political", "geocode"],
      },
      {
        "description": "Paris, KY, USA",
        "matched_substrings": [{ "length": 5, "offset": 0 }],
        "place_id": "ChIJsU7_xMfKQ4gReI89RJn0-RQ",
        "reference": "ChIJsU7_xMfKQ4gReI89RJn0-RQ",
        "structured_formatting":
          {
            "main_text": "Paris",
            "main_text_matched_substrings": [{ "length": 5, "offset": 0 }],
            "secondary_text": "KY, USA",
          },
        "terms":
          [
            { "offset": 0, "value": "Paris" },
            { "offset": 7, "value": "KY" },
            { "offset": 11, "value": "USA" },
          ],
        "types": ["locality", "political", "geocode"],
      },
    ],
  "status": "OK",
}

XML

<AutocompletionResponse>
 <status>OK</status>
 <prediction>
  <description>Paris, France</description>
  <type>locality</type>
  <type>political</type>
  <type>geocode</type>
  <reference>ChIJD7fiBh9u5kcRYJSMaMOCCwQ</reference>
  <term>
   <value>Paris</value>
   <offset>0</offset>
  </term>
  <term>
   <value>France</value>
   <offset>7</offset>
  </term>
  <matched_substring>
   <offset>0</offset>
   <length>5</length>
  </matched_substring>
  <place_id>ChIJD7fiBh9u5kcRYJSMaMOCCwQ</place_id>
  <structured_formatting>
   <description>Paris</description>
   <subdescription>France</subdescription>
   <description_matched_substring>
    <offset>0</offset>
    <length>5</length>
   </description_matched_substring>
  </structured_formatting>
 </prediction>
 <prediction>
  <description>Paris, TX, USA</description>
  <type>locality</type>
  <type>political</type>
  <type>geocode</type>
  <reference>ChIJmysnFgZYSoYRSfPTL2YJuck</reference>
  <term>
   <value>Paris</value>
   <offset>0</offset>
  </term>
  <term>
   <value>TX</value>
   <offset>7</offset>
  </term>
  <term>
   <value>USA</value>
   <offset>11</offset>
  </term>
  <matched_substring>
   <offset>0</offset>
   <length>5</length>
  </matched_substring>
  <place_id>ChIJmysnFgZYSoYRSfPTL2YJuck</place_id>
  <structured_formatting>
   <description>Paris</description>
   <subdescription>TX, USA</subdescription>
   <description_matched_substring>
    <offset>0</offset>
    <length>5</length>
   </description_matched_substring>
  </structured_formatting>
 </prediction>
 <prediction>
  <description>Paris, TN, USA</description>
  <type>locality</type>
  <type>political</type>
  <type>geocode</type>
  <reference>ChIJ4zHP-Sije4gRBDEsVxunOWg</reference>
  <term>
   <value>Paris</value>
   <offset>0</offset>
  </term>
  <term>
   <value>TN</value>
   <offset>7</offset>
  </term>
  <term>
   <value>USA</value>
   <offset>11</offset>
  </term>
  <matched_substring>
   <offset>0</offset>
   <length>5</length>
  </matched_substring>
  <place_id>ChIJ4zHP-Sije4gRBDEsVxunOWg</place_id>
  <structured_formatting>
   <description>Paris</description>
   <subdescription>TN, USA</subdescription>
   <description_matched_substring>
    <offset>0</offset>
    <length>5</length>
   </description_matched_substring>
  </structured_formatting>
 </prediction>
 <prediction>
  <description>Paris, Brant, ON, Canada</description>
  <type>neighborhood</type>
  <type>political</type>
  <type>geocode</type>
  <reference>ChIJsamfQbVtLIgR-X18G75Hyi0</reference>
  <term>
   <value>Paris</value>
   <offset>0</offset>
  </term>
  <term>
   <value>Brant</value>
   <offset>7</offset>
  </term>
  <term>
   <value>ON</value>
   <offset>14</offset>
  </term>
  <term>
   <value>Canada</value>
   <offset>18</offset>
  </term>
  <matched_substring>
   <offset>0</offset>
   <length>5</length>
  </matched_substring>
  <place_id>ChIJsamfQbVtLIgR-X18G75Hyi0</place_id>
  <structured_formatting>
   <description>Paris</description>
   <subdescription>Brant, ON, Canada</subdescription>
   <description_matched_substring>
    <offset>0</offset>
    <length>5</length>
   </description_matched_substring>
  </structured_formatting>
 </prediction>
 <prediction>
  <description>Paris, KY, USA</description>
  <type>locality</type>
  <type>political</type>
  <type>geocode</type>
  <reference>ChIJsU7_xMfKQ4gReI89RJn0-RQ</reference>
  <term>
   <value>Paris</value>
   <offset>0</offset>
  </term>
  <term>
   <value>KY</value>
   <offset>7</offset>
  </term>
  <term>
   <value>USA</value>
   <offset>11</offset>
  </term>
  <matched_substring>
   <offset>0</offset>
   <length>5</length>
  </matched_substring>
  <place_id>ChIJsU7_xMfKQ4gReI89RJn0-RQ</place_id>
  <structured_formatting>
   <description>Paris</description>
   <subdescription>KY, USA</subdescription>
   <description_matched_substring>
    <offset>0</offset>
    <length>5</length>
   </description_matched_substring>
  </structured_formatting>
 </prediction>
</AutocompletionResponse>

PlacesAutocompleteResponse

FieldRequiredTypeDescription
required Array<PlaceAutocompletePrediction>

Contains an array of predictions.

See PlaceAutocompletePrediction for more information.

requiredPlacesAutocompleteStatus

Contains the status of the request, and may contain debugging information to help you track down why the request failed.

See PlacesAutocompleteStatus for more information.

optionalstring

When the service returns a status code other than OK<, there may be an additional error_message field within the response object. This field contains more detailed information about thereasons behind the given status code. This field is not always returned, and its content is subject to change.

optionalArray<string>

When the service returns additional information about the request specification, there may be an additional info_messages field within the response object. This field is only returned for successful requests. It may not always be returned, and its content is subject to change.

결과 내에서 특히 흥미로운 것은 place_id 요소로서 별도의 쿼리를 통해 장소에 대한 더 구체적인 세부정보를 요청하는 데 사용할 수 있습니다. 장소 세부정보 요청을 참고하세요.

XML 응답은 두 가지 유형의 하위 요소가 있는 단일 <AutocompletionResponse> 요소로 구성됩니다.

  • 단일 <status> 요소는 요청에 대한 메타데이터를 포함합니다. 아래의 상태 코드를 참고하세요.
  • 0개 이상의 <prediction> 요소. 각 요소에는 단일 장소에 대한 정보가 포함됩니다. 이러한 결과에 대한 자세한 내용은 Place Autocomplete 결과를 참고하세요. Places API는 최대 5개의 결과를 반환합니다.

어떤 이유로든 애플리케이션에 xml가 필요하지 않은 한 json를 기본 출력 플래그로 사용하는 것이 좋습니다. XML 트리를 처리할 때는 올바른 노드와 요소를 참조하도록 주의해야 합니다. XML 처리에 관한 도움말은 XPath로 XML 처리를 참고하세요.

PlacesAutocompleteStatus

Status codes returned by service.

  • OK indicating the API request was successful.
  • ZERO_RESULTS indicating that the search was successful but returned no results. This may occur if the search was passed a bounds in a remote location.
  • INVALID_REQUEST indicating the API request was malformed, generally due to the missing input parameter.
  • OVER_QUERY_LIMIT indicating any of the following:
    • You have exceeded the QPS limits.
    • Billing has not been enabled on your account.
    • The monthly $200 credit, or a self-imposed usage cap, has been exceeded.
    • The provided method of payment is no longer valid (for example, a credit card has expired).
    See the Maps FAQ for more information about how to resolve this error.
  • REQUEST_DENIED indicating that your request was denied, generally because:
    • The request is missing an API key.
    • The key parameter is invalid.
  • UNKNOWN_ERROR indicating an unknown error.

장소 서비스가 검색에서 JSON 결과를 반환하면 결과는 predictions 배열 내에 배치됩니다. 서비스에서 반환할 결과가 없는 경우에도 (예: location가 원격인 경우) 여전히 빈 predictions 배열을 반환합니다. XML 응답은 0개 이상의 <prediction> 요소로 구성됩니다.

PlaceAutocompletePrediction

FieldRequiredTypeDescription
requiredstring

Contains the human-readable name for the returned result. For establishment results, this is usually the business name. This content is meant to be read as-is. Do not programmatically parse the formatted address.

required Array<PlaceAutocompleteMatchedSubstring>

A list of substrings that describe the location of the entered term in the prediction result text, so that the term can be highlighted if desired.

See PlaceAutocompleteMatchedSubstring for more information.

requiredPlaceAutocompleteStructuredFormat

Provides pre-formatted text that can be shown in your autocomplete results. This content is meant to be read as-is. Do not programmatically parse the formatted address.

See PlaceAutocompleteStructuredFormat for more information.

required Array<PlaceAutocompleteTerm>

Contains an array of terms identifying each section of the returned description (a section of the description is generally terminated with a comma). Each entry in the array has a value field, containing the text of the term, and an offset field, defining the start position of this term in the description, measured in Unicode characters.

See PlaceAutocompleteTerm for more information.

optionalinteger

The straight-line distance in meters from the origin. This field is only returned for requests made with an origin.

optionalstring

A textual identifier that uniquely identifies a place. To retrieve information about the place, pass this identifier in the placeId field of a Places API request. For more information about place IDs, see the Place IDs overview.

optionalstring

See place_id.

optionalArray<string>

Contains an array of types that apply to this place. For example: [ "political", "locality" ] or [ "establishment", "geocode", "beauty_salon" ]. The array can contain multiple values. Learn more about Place types.

PlaceAutocompleteMatchedSubstring

FieldRequiredTypeDescription
requirednumber

Length of the matched substring in the prediction result text.

requirednumber

Start location of the matched substring in the prediction result text.

PlaceAutocompleteStructuredFormat

FieldRequiredTypeDescription
requiredstring

Contains the main text of a prediction, usually the name of the place.

required Array<PlaceAutocompleteMatchedSubstring>

Contains an array with offset value and length. These describe the location of the entered term in the prediction result text, so that the term can be highlighted if desired.

See PlaceAutocompleteMatchedSubstring for more information.

optionalstring

Contains the secondary text of a prediction, usually the location of the place.

optional Array<PlaceAutocompleteMatchedSubstring>

Contains an array with offset value and length. These describe the location of the entered term in the prediction result text, so that the term can be highlighted if desired.

See PlaceAutocompleteMatchedSubstring for more information.

PlaceAutocompleteTerm

FieldRequiredTypeDescription
requirednumber

Defines the start position of this term in the description, measured in Unicode characters

requiredstring

The text of the term.

Place Autocomplete 최적화

이 섹션에서는 Place Autocomplete 서비스를 최대한 활용하는 데 도움이 되는 권장사항을 설명합니다.

다음은 일반 가이드라인입니다.

  • 작동하는 사용자 인터페이스를 개발하는 가장 빠른 방법은 Maps JavaScript API 자동 완성 위젯, Android용 Places SDK 자동 완성 위젯 또는 iOS용 Places SDK 자동 완성 UI 컨트롤을 사용하는 것입니다.
  • 기본적인 Place Autocomplete 데이터 필드를 처음부터 이해합니다.
  • 위치 상세 검색 및 위치 제한 필드는 선택사항이지만 자동 완성 성능에 상당한 영향을 미칠 수 있습니다.
  • API가 오류를 반환하는 경우 오류 처리를 사용하여 앱의 성능이 적절히 저하되도록 합니다.
  • 선택된 항목이 없을 때 앱에서 처리하고 사용자에게 계속할 수 있는 방법을 제공하도록 합니다.

비용 최적화 권장사항

기본 비용 최적화

Place Autocomplete 서비스 사용 비용을 최적화하려면 장소 세부정보 및 Place Autocomplete 위젯에서 필드 마스크를 사용하여 필요한 장소 데이터 필드만 반환하세요.

고급 비용 최적화

요청당 가격에 액세스하고 장소 세부정보 대신 선택된 장소에 대한 Geocoding API 결과를 요청하려면 Place Autocomplete를 프로그래매틱 방식으로 구현해 보세요. Geocoding API와 연결된 요청당 가격은 다음 두 조건이 모두 충족되는 경우 세션당(세션 기반) 가격보다 비용 효과적입니다.

  • 사용자가 선택한 장소의 위도/경도 또는 주소만 필요한 경우 Geocoding API는 장소 세부정보 호출보다 낮은 비용으로 이 정보를 제공합니다.
  • 사용자가 평균 네 개 이하의 자동 완성 예상 검색어 요청 내에서 자동 완성 예상 검색어를 선택하면 요청당 가격이 세션당 가격보다 비용 효과적일 수 있습니다.
요구에 맞는 Place Autocomplete 구현을 선택하는 데 도움이 필요하면 다음 질문에 대한 답변에 해당하는 탭을 선택하세요.

애플리케이션에 선택된 예상 검색어의 주소 및 위도/경도 이외의 정보가 필요한가요?

예, 추가 세부정보가 필요합니다.

세션 기반 Place Autocomplete를 장소 세부정보와 함께 사용
애플리케이션에 장소 이름, 비즈니스 상태 또는 영업시간 등의 장소 세부정보가 필요하므로 Place Autocomplete 구현 시 총 비용이 세션당 총 0.017달러인 세션 토큰(프로그래매틱 방식으로 또는 JavaScript ,Android 또는iOS에 내장하여) 및 요청하는 장소 데이터 필드에 따라 관련 장소 데이터 SKU를 사용해야 합니다.1

위젯 구현
세션 관리는 JavaScript, Android 또는 iOS에 자동으로 내장됩니다. 여기에는 선택된 예상 검색어에 대한 Place Autocomplete 요청 및 장소 세부정보 요청이 모두 포함됩니다. 필요한 장소 데이터 필드만 요청하도록 하려면 fields 매개변수를 지정해야 합니다.

프로그래매틱 구현
Place Autocomplete 요청에 세션 토큰을 사용합니다. 선택된 예상 검색어에 대해 장소 세부정보를 요청할 때 다음 매개변수를 포함합니다.

  1. Place Autocomplete 응답의 장소 ID
  2. Place Autocomplete 요청에 사용되는 세션 토큰
  3. 필요한 장소 데이터 필드를 지정하는 fields 매개변수

아니요, 주소와 위치만 필요합니다.

Place Autocomplete의 사용 성능에 따라 Geocoding API가 장소 세부정보보다 애플리케이션에 비용 효과적일 수 있습니다. 모든 애플리케이션의 자동 완성 효율성은 사용자가 입력하는 내용, 애플리케이션이 사용되는 위치, 성능 최적화 권장사항이 구현되었는지 여부에 따라 다릅니다.

다음 질문에 답변하려면 애플리케이션에서 Place Autocomplete 예상 검색어를 선택하기 전에 사용자가 평균적으로 입력하는 문자 수를 분석하세요.

사용자가 평균 네 개 이하의 요청에서 Place Autocomplete 예상 검색어를 선택하나요?

지원됨

세션 토큰 없이 프로그래매틱 방식으로 Place Autocomplete를 구현하고 선택한 장소 예상 검색어에 대해 Geocoding API 호출
Geocoding API는 주소 및 위도/경도 좌표를 요청당 0.005달러에 제공합니다. Place Autocomplete - Per Request를 4회 요청하는 데는 0.01132달러의 비용이 들기 때문에 선택된 장소 예상 검색어에 대한 4회 요청 및 Geocoding API 호출의 총 비용은 0.01632달러로 세션당 자동 완성 가격 0.017달러보다 작습니다.1

성능 권장사항을 사용하여 사용자가 훨씬 적은 수의 문자로 원하는 예상 검색어를 가져올 수 있도록 도와주세요.

No

세션 기반 Place Autocomplete를 장소 세부정보와 함께 사용
사용자가 Place Autocomplete 예상 검색어를 선택하기 전에 요청할 것으로 예상되는 평균 요청 수가 세션당 가격을 초과하므로 Place Autocomplete 구현 시 Place Autocomplete 요청 및 관련 장소 세부정보 요청 둘 다에 총 비용이 세션당 0.017달러인 세션 토큰을 사용해야 합니다.1

위젯 구현
세션 관리는 JavaScript, Android 또는 iOS에 자동으로 내장됩니다. 여기에는 선택된 예상 검색어에 대한 Place Autocomplete 요청 및 장소 세부정보 요청이 모두 포함됩니다. 기본 데이터 필드만 요청하도록 하려면 fields 매개변수를 지정해야 합니다.

프로그래매틱 구현
Place Autocomplete 요청에 세션 토큰을 사용합니다. 선택된 예상 검색어에 대해 장소 세부정보를 요청할 때 다음 매개변수를 포함합니다.

  1. Place Autocomplete 응답의 장소 ID
  2. Place Autocomplete 요청에 사용되는 세션 토큰
  3. 주소 및 도형과 같은 기본 데이터 필드를 지정하는 fields 매개변수

Place Autocomplete 요청 지연 고려
사용자가 처음 3~4자를 입력할 때까지 Place Autocomplete 요청을 지연하는 것과 같은 전략을 채택하여 애플리케이션에서 요청하는 횟수를 줄일 수 있습니다. 예를 들어 사용자가 세 번째 문자를 입력한 에 각 문자에 대해 Place Autocomplete 요청을 하면 사용자가 일곱 개의 문자를 입력한 다음 하나의 Geocoding API 요청을 한 예상 검색어를 선택하는 경우 총 비용이 0.01632달러(4*자동 완성 요청당 0.00283달러 + Geocoding 0.005달러)입니다.1

요청을 지연하면 평균 프로그래매틱 요청 수가 네 개 미만이 될 수 있는 경우 Geocoding API를 사용한 고성능 Place Autocomplete 구현을 위한 안내를 따르세요. 키를 입력할 때마다 예상 검색어가 표시될 것이라고 예상하는 사용자는 요청 지연을 지연 시간으로 인식할 수 있습니다.

성능 권장사항을 사용하여 사용자가 더 적은 수의 문자로 원하는 예상 검색어를 가져올 수 있도록 도와주세요.


  1. 여기에 표시된 비용은 미국 달러입니다. 전체 가격 정보는 Google Maps Platform 결제 페이지를 참고하세요.

성능 권장사항

다음 가이드라인에서는 Place Autocomplete 성능을 최적화하는 방법을 설명합니다.

  • Place Autocomplete 구현에 국가별 제한사항, 위치 상세 검색, (프로그래매틱 구현의 경우) 언어 환경설정을 추가합니다. 위젯은 사용자의 브라우저 또는 휴대기기에서 언어 환경설정을 선택하므로 언어 환경설정이 필요하지 않습니다.
  • Place Autocomplete에 지도와 함께 제공된 경우 지도 표시 영역별로 위치를 상세 검색할 수 있습니다.
  • 예상 검색어 중 원하는 결과 주소가 없어 사용자가 자동 완성 예상 검색어 중 하나를 선택하지 않는 경우 원래 사용자 입력을 재사용하여 더 관련성 높은 결과를 얻을 수 있습니다.
    • 사용자가 주소 정보만 입력할 것으로 예상되는 경우 Geocoding API 호출 시 원래 사용자 입력을 재사용합니다.
    • 사용자가 이름 또는 주소로 특정 장소에 대한 쿼리를 입력할 것으로 예상되는 경우 Find Place 요청을 사용합니다. 특정 지역에서만 결과가 예상되는 경우 위치 상세 검색을 사용합니다.
    다음과 같은 경우에는 Geocoding API로 대체하는 것이 가장 좋습니다.
    • 세부 주소의 Place Autocomplete 지원이 불완전한 국가(예: 체코, 에스토니아, 리투아니아)에서 사용자가 세부 주소를 입력하는 경우. 예를 들어 체코 주소인 'Stroupeсnického 3191/17, Praha'를 바탕으로 Place Autocomplete에서 부분 예측이 이루어집니다.
    • 사용자가 뉴욕시의 '23-30 29th St, Queens' 또는 하와이 카우아이섬의 '47-380 Kamehameha Hwy, Kaneohe'처럼 도로 구간 접두사가 있는 주소를 입력하는 경우

위치 상세 검색

location 매개변수와 radius 매개변수를 전달하여 특정 지역에 편중된 결과를 제공합니다. 이 매개변수를 사용하면 Place Autocomplete 서비스에서 정의된 지역 내의 검색 결과를 우선적으로 표시합니다. 정의된 영역을 벗어난 결과가 계속 표시될 수도 있습니다. components 매개변수를 사용하면 지정된 국가 내의 장소만 표시되도록 결과를 필터링할 수 있습니다.

팁: 시설 결과는 일반적으로 검색 영역이 넓을 때 결과에 표시될 만큼 순위가 높지 않습니다. 시설을 시설/지오코드 결과에 혼합하여 표시하려면 반경을 더 작게 지정하면 됩니다. 또는 types=establishment를 사용하여 검색 결과를 시설로만 제한할 수 있습니다.

위치 제한

locationrestriction 매개변수를 전달하여 결과를 지정된 영역으로 제한합니다.

strictbounds 매개변수를 추가하여 locationradius 매개변수로 정의된 지역으로 결과를 제한할 수도 있습니다. 이렇게 하면 Place Autocomplete 서비스에서 지역 내의 결과 반환합니다.