Google Maps Platform에서 Solar API로 이전

Google Earth Engine Solar API에서 Google Maps Platform Solar API로 전환하는 방법은 다음과 같습니다.

  1. 클라우드 프로젝트에서 Google Maps Platform Solar API를 사용 설정합니다.
  2. 새 키를 만들고 GMP Solar API로 제한합니다.
  3. 아래의 단계별 안내에 따라 코드를 업데이트하세요.

나란히 비교

Solar API (신규) 해가 있는 집 Earth Engine Solar API (지원 중단됨) EE 아이콘
출시 상태 출시 완료 파일럿 (지원 중단됨)
액세스
메커니즘 Solar API를 사용 설정하고 Google Maps Platform 섹션을 통해 API를 관리하는 방법으로 Cloud 콘솔을 통한 Google Cloud 계정 Earth Engine Solar API를 사용 설정하여 Cloud 콘솔을 통한 Google Cloud 계정
누가 공개 액세스 제어
수준 자체 프로비저닝 Cloud 프로젝트 수동 액세스
인증 API 키 및 OAuth API 키
가격 책정
전략 Pay-as-you-go 100% 할인
계층 쿼리 1, 000개당(규모에 따라 가격 인하)
엔드포인트 다른 엔드포인트당 가격
Cloud
모니터링 'Google Maps Platform'의 Cloud Monitoring Cloud Monitoring - 'API 및 서비스'
할당량 QPM (분당 쿼리) 및 QPH (시간당 쿼리) 연간
로깅 Cloud Logging (선택사항) Cloud Logging (선택사항)
청구 Cloud Billing 계정 -
지원 SLO/SLA가 포함된 Google Maps Platform 완벽 지원 제한됨, 이메일 사용
API
호스트 이름 https://solar.googleapis.com/v1/ (REST) https://earthenginesolar.googleapis.com/v1/ (REST)
방법
  • buildingInsights:findClosest
  • dataLayers:get
  • buildings:findClosest
  • solar.get
응답 파일럿과 비교하여 변경사항 없음
solarInfo 반경 100m 이하 반경 100m 이하
범위
영역 전 세계 전 세계
데이터 품질 HIGH/MEDIUM HIGH/MEDIUM
건물 유형 주소에 매핑되며 Solar API 이미지 범위 내에 있는 건물 주소에 매핑되며 Solar API 이미지 범위 내에 있는 건물
서비스 약관
TOS Google Maps Platform 약관 Google Earth Engine 약관

단계별 안내

Google Cloud 프로젝트 설정하기

Google Cloud 프로젝트 설정에 대한 안내

특정 역할만 Cloud 프로젝트를 만들 수 있습니다. 프로젝트를 만들 수 없으면 조직의 관리자에게 문의하세요.

기존 Cloud 프로젝트를 사용할 수도 있습니다. 자세한 내용은 Google Maps Platform 시작하기를 참고하세요.

결제 계정 설정

여기의 안내: 결제 계정 관리 방법

기존 Cloud 프로젝트를 기존 결제 계정과 함께 사용할 수 있습니다.

API 키 가져오기 또는 OAuth 토큰 사용

Google Cloud 프로젝트를 설정한 후 API 키 사용에 설명된 대로 Solar API를 사용하려면 API 키를 만들고 보호해야 합니다. 또는 OAuth 사용에 설명된 대로 OAuth 토큰을 만들 수 있습니다.

Solar API 사용

  • 새 엔드포인트에 GET 요청을 합니다. https://solar.googleapis.com
  • 일부 API 메서드 이름이 변경되었습니다.
    • buildings:findClosestbuildingInsights:findClosest
    • solarinfo:getdataLayers:get

빠른 체험판: 브라우저에 URL을 로드하기 전에 이전 단계에서 저장된 API 키를 사용하고 아래 쿼리 예시의 YOUR_API_KEY를 대체합니다.

https://solar.googleapis.com/v1/dataLayers:get?location.latitude=37.2746464&location.longitude=-121.7530949&radius_meters=10&key=YOUR_API_KEY

원래 미리보기 출시에 대한 응답

2023년 5월 9일에 출시된 원래 미리보기 출시의 경우 응답의 URL은 다음과 같습니다.

https://earthengine.googleapis.com/v1alpha/projects/sunroof-api/thumbnails/THUMBNAIL_ID:getPixels

다음 스니펫은 응답의 예입니다.

{
  "imageryDate": {
    "year": 2015,
    "month": 8,
    "day": 8
  },
  "imageryProcessedDate": {
    "year": 2021,
    "month": 2,
    "day": 15
  },
  "dsmUrl": "https://earthengine.googleapis.com/v1alpha/projects/geo-solar-api/thumbnails/fbde33e9cd16d5fd10d19a19dc580bc1-8614f599c5c264553f821cd034d5cf32:getPixels",
  "rgbUrl": "https://earthengine.googleapis.com/v1alpha/projects/geo-solar-api/thumbnails/91ed3551f2d0abee20af35e07bd0c927-c96c59e80cf1fc1dc86cf59fc8ec86ba:getPixels",
  "maskUrl": "https://earthengine.googleapis.com/v1alpha/projects/geo-solar-api/thumbnails/e4051553dba6870c03d855ae82c30b7e-7cc8ae6ce7c73f219e3c1924e5c17fc6:getPixels",
  "annualFluxUrl": "https://earthengine.googleapis.com/v1alpha/projects/geo-solar-api/thumbnails/9b0f87f49d778a65c9e27ff936e6dbba-b90be2fe80d25abd4c9e8c4dc809f763:getPixels",
  "monthlyFluxUrl": "https://earthengine.googleapis.com/v1alpha/projects/geo-solar-api/thumbnails/90e7cca77402f14809e349937f0a0be8-94fafeb4ef42d72f1b3c0652a1cb5518:getPixels",
  "hourlyShadeUrls": [
    "https://earthengine.googleapis.com/v1alpha/projects/geo-solar-api/thumbnails/dcd276e4782aef4ff1b230b781736d37-e193b231ce57a03449afc3e21cf6783b:getPixels",
    ...
  ]
  }

응답에 URL을 요청하려면 요청에 전체 URL을 포함합니다.

이 요청 및 응답의 전체 사양은 참조 문서에서 확인할 수 있습니다.

두 응답 형식을 모두 지원하는 앱 작성

이제 원래 미리보기와 현재 응답 형식을 모두 처리하는 앱을 작성할 수 있습니다.

실제 URL 자체를 제외하고 두 응답의 주요 차이점은 응답 형식에서 URL에 액세스하는 요청에 API 키를 전달해야 한다는 점입니다. API 키를 생략하면 요청이 실패합니다.

예를 들어 다음 코드를 앱에 추가하여 URL을 검사하고 각 버전을 올바르게 처리할 수 있습니다.

JavaScript

/**
* Function to examine a response URL and to append the API key to the
* URL if it is in the new format.
*/
function prepareGetGeoTiffUrl(geoTiffUrl, apiKey) {
  if (geoTiffUrl.match("solar.googleapis.com")) {
    let url = new URL(geoTiffUrl);
    url.searchParams.set('apiKey', apiKey);
    return url.toString();
  }
  return geoTiffUrl;
}

Python

# Functions to examine a response URL and to append the API key to the
# URL if it is in the new format.

def add_api_key_to_url(base_url: str, api_key: str) -> str:
  '''Formats URL that currently lacks an API key to use the one provided.'''
  return base_url + "&key=" +api_key;

def prepare_geo_tiff_url(base_url: str, api_key: str) -> str:
  '''Prepares URL from GetDataLayers depending on API being called.
    If the geoTIFF url from GetDataLayers is for the solar API GetGeoTiff
      endpoint, append the API key. Otherwise return the URL as is.
  '''
  if re.search("solar.googleapis.com", geo_tiff_url):
    return add_api_key_to_url(geo_tiff_url, api_key)
  return geo_tiff_url

Java


/** Adds API key to a URL. */
private String addApiKeyToUrl(String geoTiffUrl, String apiKey) {
  return geoTiffUrl + "&key=" + apiKey;
}

/**
* Function to examine a response URL and to append the API key to the
* URL if it is in the new format.
*/
private String prepareGetGeoTiffUrl(String geoTiffUrl, String apiKey) {
  Pattern pattern = Pattern.compile("solar.googleapis.com");
  Matcher matcher = pattern.matcher(geoTiffUrl);
  if (matcher.find()) {
    return addApiKeyToUrl(geoTiffUrl, apiKey);
  } else {
    return geoTiffUrl;
  }
}

모니터링

프로젝트 수준 결제 계정 수준

Cloud Monitoring Cloud Billing

알아두면 좋은 팁

  • 할당량: 확장할 수 있는 사용량 (연간 사용량보다는 사라짐)
    • 현재 할당량: QPM으로 변경됩니다.
    • 권장사항: 클라이언트 측 할당량 설정 및 알림 전송
  • 가격 책정:
    • Pay-as-you-go
    • 404 NOT_FOUND 응답: 위치가 서비스 범위 내에 있지 않은 경우 요금이 청구되지 않지만 할당량에 포함됩니다.
  • 일반 사용 약관: Google Maps Platform 서비스 약관