장소 사진 (신규)을 사용하면 고품질 사진 콘텐츠를 애플리케이션에 추가할 수 있습니다. 장소 사진을 사용하면 장소 데이터베이스에 저장된 수백만 장의 사진에 액세스할 수 있습니다. Place Photos는 비트맵 이미지의 URI를 반환합니다. 비트맵 이미지의 최대 크기는 4800x4800픽셀입니다.
장소 사진 요청
장소의 이미지를 가져오려면 다음 단계를 따르세요.
Place Details (New)를 사용하여 fetchPlace()를 통해 Place 객체를 가져옵니다.
응답 Place 객체에 포함할 필드 목록에 Place.Field PHOTO_METADATAS 필드를 포함해야 합니다.
반환할 이미지의 최대 높이와 너비를 픽셀 단위로 지정합니다. 이미지가 지정된 값보다 작은 경우 원래 이미지가 반환됩니다. 이미지가 두 측정기준 중 하나에서 더 큰 경우 원래 가로세로 비율로 제한된 두 측정기준 중 더 작은 측정기준에 맞게 조정됩니다. 최대 높이와 최대 너비 속성은 모두 1~4800 사이의 정수를 허용합니다. 최대 높이, 최대 너비 또는 둘 다를 지정해야 합니다.
최대 높이 매개변수를 설정하려면 FetchResolvedPhotoUriRequest 객체를 빌드할 때 setMaxHeight() 메서드를 호출합니다.
최대 너비 매개변수를 설정하려면 FetchResolvedPhotoUriRequest 객체를 빌드할 때 setMaxWidth() 메서드를 호출합니다.
장소 사진 예시
다음 예에서는 장소 사진 URI를 가져오는 방법을 보여줍니다.
// Define a Place ID.finalStringplaceId="INSERT_PLACE_ID_HERE";// Specify fields. Requests for photos must always have the PHOTO_METADATAS field.finalList<Place.Field>fields=Collections.singletonList(Place.Field.PHOTO_METADATAS);// Get a Place object (this example uses fetchPlace(), but you can also use findCurrentPlace())finalFetchPlaceRequestplaceRequest=FetchPlaceRequest.newInstance(placeId,fields);placesClient.fetchPlace(placeRequest).addOnSuccessListener((response)->{finalPlaceplace=response.getPlace();// Get the photo metadata.finalList<PhotoMetadata>metadata=place.getPhotoMetadatas();if(metadata==null||metadata.isEmpty()){Log.w(TAG,"No photo metadata.");return;}finalPhotoMetadataphotoMetadata=metadata.get(0);// Get the attribution text and author attributions.finalStringattributions=photoMetadata.getAttributions();finalAuthorAttributionsauthorAttributions=photoMetadata.getAuthorAttributions();// Create a FetchResolvedPhotoUriRequest.finalFetchResolvedPhotoUriRequestphotoRequest=FetchResolvedPhotoUriRequest.builder(photoMetadata).setMaxWidth(500).setMaxHeight(300).build();// Request the photo URIplacesClient.fetchResolvedPhotoUri(photoRequest).addOnSuccessListener((fetchResolvedPhotoUriResponse)->{Uriuri=fetchResolvedPhotoUriResponse.getUri();RequestOptionsrequestOptions=newRequestOptions().override(Target.SIZE_ORIGINAL);Glide.with(this).load(uri).apply(requestOptions).into(imageView);}).addOnFailureListener((exception)->{if(exceptioninstanceofApiException){finalApiExceptionapiException=(ApiException)exception;Log.e(TAG,"Place not found: "+exception.getMessage());finalintstatusCode=apiException.getStatusCode();// TODO: Handle error with given status code.}});});
기여 분석
대부분의 경우 장소 사진은 저작자 표시 없이 사용할 수 있거나 필수 저작권 표시가 이미지의 일부로 포함되어 있습니다. 하지만 PhotoMetadata 유형의 사진 메타데이터 객체에는 다음 두 가지 유형의 추가 저작자 표시 중 하나가 포함될 수 있습니다.
[null,null,["최종 업데이트: 2025-08-30(UTC)"],[[["\u003cp\u003ePlace Photos (New) allows you to access and display millions of photos from the Google Places database in your application.\u003c/p\u003e\n"],["\u003cp\u003eTo retrieve a place photo, you must first fetch a \u003ccode\u003ePlace\u003c/code\u003e object using Place Details (New) with the \u003ccode\u003ePHOTO_METADATAS\u003c/code\u003e field, then use this metadata to request the photo URI via the Places SDK.\u003c/p\u003e\n"],["\u003cp\u003ePhoto requests require specifying either a maximum width, maximum height, or both, for the returned image, with the maximum resolution being 4800x4800 pixels.\u003c/p\u003e\n"],["\u003cp\u003eWhile most Place Photos can be used without attribution, some may require displaying attributions obtained from the \u003ccode\u003ePhotoMetadata\u003c/code\u003e object alongside the image.\u003c/p\u003e\n"]]],[],null,["# Place Photos (New)\n\nSelect platform: [Android](/maps/documentation/places/android-sdk/place-photos \"View this page for the Android platform docs.\") [iOS](/maps/documentation/places/ios-sdk/place-photos \"View this page for the iOS platform docs.\") [Web Service](/maps/documentation/places/web-service/place-photos \"View this page for the Web Service platform docs.\")\n\n\u003cbr /\u003e\n\n**European Economic Area (EEA) developers** If your billing address is in the European Economic Area, effective on 8 July 2025, the [Google Maps Platform EEA Terms of Service](https://cloud.google.com/terms/maps-platform/eea) will apply to your use of the Services. Functionality varies by region. [Learn more](/maps/comms/eea/faq).\n\nPlace Photos (New) lets you add high quality photographic content to your\napplication. Place Photos gives you access to the millions of photos stored in\nthe Places database. Place Photos returns a URI to a bitmap image. The bitmap\nimage has a maximum size of 4800 by 4800 pixels.\n| **Note:** Place Photos (New) is available in Places SDK for Android version 3.4.0 and later. For more information, see [Choose your SDK\n| version](/maps/documentation/places/android-sdk/choose-sdk). For more information about using the Kotlin APIs added in version 4.0.0, see the [Reference\n| Overview](/maps/documentation/places/android-sdk/reference).\n\nPlace Photos requests\n---------------------\n\nTo retrieve an image for a place:\n\n1. Use [Place Details (New)](/maps/documentation/places/android-sdk/details-places) to fetch a `Place` object using [`fetchPlace()`](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/net/PlacesClient#fetchPlace(com.google.android.libraries.places.api.net.FetchPlaceRequest)). Be sure to include the `Place.Field PHOTO_METADATAS` field in the list of fields to include in the response `Place` object.\n2. In the [`OnSuccessListener`](https://developer.android.com/reference/com/google/android/play/core/tasks/OnSuccessListener) for your [`FetchPlaceResponse`](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/net/FetchPlaceResponse), call [`Place.getPhotoMetadas()`](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/model/Place#getPhotoMetadatas()) to get the photo metadata object of type [`PhotoMetadata`](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/model/PhotoMetadata) from the response `Place` object.\n3. Create a [`FetchResolvedPhotoUriRequest`](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/net/FetchResolvedPhotoUriRequest.Builder) object to make the request and pass the photo metadata object, as well values for maximum height, maximum width, or both.\n4. Use [`PlacesClient.fetchResolvedPhotoUri()`](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/net/PlacesClient#fetchResolvedPhotoUri(com.google.android.libraries.places.api.net.FetchResolvedPhotoUriRequest)) to request the photo URI.\n5. Add an `OnSuccessListener` and get the photo URI from the [`FetchResolvedPhotoUriResponse`](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/net/FetchResolvedPhotoUriResponse) object.\n\n| **Note:** For more information on initializing `PlacesClient`, see [Initialize the Places API client](/maps/documentation/places/android-sdk/config#connect-client).\n| You can use a [CancellationToken](/android/reference/com/google/android/gms/tasks/CancellationToken)\n| to attempt to cancel a request to any of the request classes (for example,\n| `FetchPlaceRequest`). Cancellation is done on a best-effort basis.\n| Once a cancellation request is issued, no response will be returned.\n| **Issuing a cancellation token does NOT guarantee that a particular request\n| will be cancelled, and you may still be charged for the request even if no\n| response is returned**.\n\nRequired parameters\n-------------------\n\nThe required parameters for\n[`FetchResolvedPhotoUriRequest`](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/net/FetchResolvedPhotoUriRequest.Builder)\nare:\n\n-\n\n ### Photo metadata\n\n The metadata object of the photo to return.\n-\n\n ### Maximum height or maximum width\n\n\n Specifies the maximum height and width, in pixels, of the image to return. If the image is smaller than the values specified, the original image will be returned. If the image is larger in either dimension, it will be scaled to match the smaller of the two dimensions, restricted to its original aspect ratio. Both the maximum height and maximum width properties accept an integer between 1 and 4800. You must specify maximum height, maximum width, or both.\n - To set the maximum height parameter, call the [setMaxHeight()](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/net/FetchResolvedPhotoUriRequest.Builder#public-abstract-fetchresolvedphotourirequest.builder-setmaxheight-integer-maxheight) method when building the `FetchResolvedPhotoUriRequest` object.\n - To set the maximum width parameter, call the [setMaxWidth()](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/net/FetchResolvedPhotoUriRequest.Builder#public-abstract-fetchresolvedphotourirequest.builder-setmaxwidth-integer-maxwidth) method when building the `FetchResolvedPhotoUriRequest` object.\n\nPlace Photos examples\n---------------------\n\nThe following example demonstrates getting a place photo URI. \n\n```java\n// Define a Place ID.\nfinal String placeId = \"INSERT_PLACE_ID_HERE\";\n\n// Specify fields. Requests for photos must always have the PHOTO_METADATAS field.\nfinal List\u003cPlace.Field\u003e fields = Collections.singletonList(Place.Field.PHOTO_METADATAS);\n\n// Get a Place object (this example uses fetchPlace(), but you can also use findCurrentPlace())\nfinal FetchPlaceRequest placeRequest = FetchPlaceRequest.newInstance(placeId, fields);\n\nplacesClient.fetchPlace(placeRequest).addOnSuccessListener((response) -\u003e {\n final Place place = response.getPlace();\n\n // Get the photo metadata.\n final List\u003cPhotoMetadata\u003e metadata = place.getPhotoMetadatas();\n if (metadata == null || metadata.isEmpty()) {\n Log.w(TAG, \"No photo metadata.\");\n return;\n }\n final PhotoMetadata photoMetadata = metadata.get(0);\n\n // Get the attribution text and author attributions.\n final String attributions = photoMetadata.getAttributions();\n final AuthorAttributions authorAttributions = photoMetadata.getAuthorAttributions();\n\n // Create a FetchResolvedPhotoUriRequest.\n final FetchResolvedPhotoUriRequest photoRequest = FetchResolvedPhotoUriRequest.builder(photoMetadata)\n .setMaxWidth(500)\n .setMaxHeight(300)\n .build();\n\n // Request the photo URI\n placesClient.fetchResolvedPhotoUri(photoRequest).addOnSuccessListener((fetchResolvedPhotoUriResponse) -\u003e {\n Uri uri = fetchResolvedPhotoUriResponse.getUri();\n RequestOptions requestOptions = new RequestOptions().override(Target.SIZE_ORIGINAL);\n Glide.with(this).load(uri).apply(requestOptions).into(imageView);\n }).addOnFailureListener((exception) -\u003e {\n if (exception instanceof ApiException) {\n final ApiException apiException = (ApiException) exception;\n Log.e(TAG, \"Place not found: \" + exception.getMessage());\n final int statusCode = apiException.getStatusCode();\n // TODO: Handle error with given status code.\n }\n });\n});\n```\n\nAttributions\n------------\n\nIn most cases, place photos can be used without attribution, or will have\nthe required attribution included as part of the image. However, the photo metadata object, of type\n[`PhotoMetadata`](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/model/PhotoMetadata),\ncan contain either of two types of additional attributions:\n\n- **Attributions** , an attribution string accessed by [`PhotoMetadata.getAttributions()`](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/model/PhotoMetadata#public-abstract-string-getattributions).\n- **AuthorAttributions** , an [`AuthorAttributions`](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/model/AuthorAttributions) object accessed by [`PhotoMetadata.getAuthorAttributions()`](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/model/PhotoMetadata#public-abstract-authorattributions-getauthorattributions).\n\nIf the returned `PhotoMetadata` object includes either type of attribution, you must\ninclude the attribution in your application wherever you display the image. For more information,\nsee [Displaying Attributions](/maps/documentation/places/android-sdk/attributions#photos)."]]