Class v1.SolarClient (0.1.0)

Service definition for the Solar API. v1

Package

@googlemaps/solar

Constructors

(constructor)(opts, gaxInstance)

constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);

Construct an instance of SolarClient.

Parameters
Name Description
opts ClientOptions
gaxInstance typeof gax | typeof fallback

: loaded instance of google-gax. Useful if you need to avoid loading the default gRPC version and want to use the fallback HTTP implementation. Load only fallback version and pass it to the constructor: ``` const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC const client = new SolarClient({fallback: true}, gax); ```

Properties

apiEndpoint

get apiEndpoint(): string;

The DNS address for this API service.

apiEndpoint

static get apiEndpoint(): string;

The DNS address for this API service - same as servicePath.

auth

auth: gax.GoogleAuth;

descriptors

descriptors: Descriptors;

innerApiCalls

innerApiCalls: {
        [name: string]: Function;
    };

port

static get port(): number;

The port for this API service.

scopes

static get scopes(): string[];

The scopes needed to make gRPC calls for every method defined in this service.

servicePath

static get servicePath(): string;

The DNS address for this API service.

solarStub

solarStub?: Promise<{
        [name: string]: Function;
    }>;

universeDomain

get universeDomain(): string;

warn

warn: (code: string, message: string, warnType?: string) => void;

Methods

close()

close(): Promise<void>;

Terminate the gRPC channel and close the client.

The client will no longer be usable and all future behavior is undefined.

Returns
Type Description
Promise<void>

{Promise} A promise that resolves when the client is closed.

findClosestBuildingInsights(request, options)

findClosestBuildingInsights(request?: protos.google.maps.solar.v1.IFindClosestBuildingInsightsRequest, options?: CallOptions): Promise<[
        protos.google.maps.solar.v1.IBuildingInsights,
        (protos.google.maps.solar.v1.IFindClosestBuildingInsightsRequest | undefined),
        {} | undefined
    ]>;

Locates the closest building to a query point. Returns an error with code NOT_FOUND if there are no buildings within approximately 50m of the query point.

Parameters
Name Description
request IFindClosestBuildingInsightsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.maps.solar.v1.IBuildingInsights, (protos.google.maps.solar.v1.IFindClosestBuildingInsightsRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing BuildingInsights. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The longitude and latitude from which the API looks for the
   *  nearest known building.
   */
  // const location = {}
  /**
   *  Optional. The minimum quality level allowed in the results. No result with
   *  lower quality than this will be returned. Not specifying this is
   *  equivalent to restricting to HIGH quality only.
   */
  // const requiredQuality = {}
  /**
   *  Optional. Whether to require exact quality of the imagery.
   *  If set to false, the `required_quality` field is interpreted as the minimum
   *  required quality, such that HIGH quality imagery may be returned when
   *  `required_quality` is set to MEDIUM.  If set to true, `required_quality`
   *  is interpreted as the exact required quality and only `MEDIUM` quality
   *  imagery is returned if `required_quality` is set to `MEDIUM`.
   */
  // const exactQualityRequired = true

  // Imports the Solar library
  const {SolarClient} = require('@googlemaps/solar').v1;

  // Instantiates a client
  const solarClient = new SolarClient();

  async function callFindClosestBuildingInsights() {
    // Construct request
    const request = {
      location,
    };

    // Run request
    const response = await solarClient.findClosestBuildingInsights(request);
    console.log(response);
  }

  callFindClosestBuildingInsights();

findClosestBuildingInsights(request, options, callback)

findClosestBuildingInsights(request: protos.google.maps.solar.v1.IFindClosestBuildingInsightsRequest, options: CallOptions, callback: Callback<protos.google.maps.solar.v1.IBuildingInsights, protos.google.maps.solar.v1.IFindClosestBuildingInsightsRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IFindClosestBuildingInsightsRequest
options CallOptions
callback Callback<protos.google.maps.solar.v1.IBuildingInsights, protos.google.maps.solar.v1.IFindClosestBuildingInsightsRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

findClosestBuildingInsights(request, callback)

findClosestBuildingInsights(request: protos.google.maps.solar.v1.IFindClosestBuildingInsightsRequest, callback: Callback<protos.google.maps.solar.v1.IBuildingInsights, protos.google.maps.solar.v1.IFindClosestBuildingInsightsRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IFindClosestBuildingInsightsRequest
callback Callback<protos.google.maps.solar.v1.IBuildingInsights, protos.google.maps.solar.v1.IFindClosestBuildingInsightsRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getDataLayers(request, options)

getDataLayers(request?: protos.google.maps.solar.v1.IGetDataLayersRequest, options?: CallOptions): Promise<[
        protos.google.maps.solar.v1.IDataLayers,
        protos.google.maps.solar.v1.IGetDataLayersRequest | undefined,
        {} | undefined
    ]>;

Gets solar information for a region surrounding a location. Returns an error with code NOT_FOUND if the location is outside the coverage area.

Parameters
Name Description
request IGetDataLayersRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.maps.solar.v1.IDataLayers, protos.google.maps.solar.v1.IGetDataLayersRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing DataLayers. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The longitude and latitude for the center of the region to get
   *  data for.
   */
  // const location = {}
  /**
   *  Required. The radius, in meters, defining the region surrounding that
   *  centre point for which data should be returned. The limitations
   *  on this value are:
   *  * Any value up to 100m can always be specified.
   *  * Values over 100m can be specified, as long as
   *    `radius_meters` <= `pixel_size_meters="" *="" 1000`.="" *="" *="" however,="" for="" values="" over="" 175m,="" the="" `datalayerview`="" in="" the="" *="" request="" must="" not="" include="" monthly="" flux="" or="" hourly="" shade.="" */="" const="" radiusmeters="1234" *="" *="" optional.="" the="" desired="" subset="" of="" the="" data="" to="" return.="" */="" const="" view="{}" *="" *="" optional.="" the="" minimum="" quality="" level="" allowed="" in="" the="" results.="" no="" result="" with="" *="" lower="" quality="" than="" this="" will="" be="" returned.="" not="" specifying="" this="" is="" *="" equivalent="" to="" restricting="" to="" high="" quality="" only.="" */="" const="" requiredquality="{}" *="" *="" optional.="" the="" minimum="" scale,="" in="" meters="" per="" pixel,="" of="" the="" data="" to="" return.="" *="" values="" of="" 0.1="" (the="" default,="" if="" this="" field="" is="" not="" set="" explicitly),="" *="" 0.25,="" 0.5,="" and="" 1.0="" are="" supported.="" imagery="" components="" whose="" normal="" *="" resolution="" is="" less="" than="" `pixel_size_meters`="" will="" be="" returned="" at="" *="" the="" resolution="" specified="" by="" `pixel_size_meters`;="" imagery="" *="" components="" whose="" normal="" resolution="" is="" equal="" to="" or="" greater="" than="" *="" `pixel_size_meters`="" will="" be="" returned="" at="" that="" normal="" resolution.="" */="" const="" pixelsizemeters="1234" *="" *="" optional.="" whether="" to="" require="" exact="" quality="" of="" the="" imagery.="" *="" if="" set="" to="" false,="" the="" `required_quality`="" field="" is="" interpreted="" as="" the="" minimum="" *="" required="" quality,="" such="" that="" high="" quality="" imagery="" may="" be="" returned="" when="" *="" `required_quality`="" is="" set="" to="" medium.="" if="" set="" to="" true,="" `required_quality`="" *="" is="" interpreted="" as="" the="" exact="" required="" quality="" and="" only="" `medium`="" quality="" *="" imagery="" is="" returned="" if="" `required_quality`="" is="" set="" to="" `medium`.="" */="" const="" exactqualityrequired="true" imports="" the="" solar="" library="" const="" {solarclient}="require('@googlemaps/solar').v1;" instantiates="" a="" client="" const="" solarclient="new" solarclient();="" async="" function="" callgetdatalayers()="" {="" construct="" request="" const="" request="{" location,="" radiusmeters,="" };="" run="" request="" const="" response="await" solarclient.getdatalayers(request);="" console.log(response);="" }="" callgetdatalayers();="">

getDataLayers(request, options, callback)

getDataLayers(request: protos.google.maps.solar.v1.IGetDataLayersRequest, options: CallOptions, callback: Callback<protos.google.maps.solar.v1.IDataLayers, protos.google.maps.solar.v1.IGetDataLayersRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetDataLayersRequest
options CallOptions
callback Callback<protos.google.maps.solar.v1.IDataLayers, protos.google.maps.solar.v1.IGetDataLayersRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getDataLayers(request, callback)

getDataLayers(request: protos.google.maps.solar.v1.IGetDataLayersRequest, callback: Callback<protos.google.maps.solar.v1.IDataLayers, protos.google.maps.solar.v1.IGetDataLayersRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetDataLayersRequest
callback Callback<protos.google.maps.solar.v1.IDataLayers, protos.google.maps.solar.v1.IGetDataLayersRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getGeoTiff(request, options)

getGeoTiff(request?: protos.google.maps.solar.v1.IGetGeoTiffRequest, options?: CallOptions): Promise<[
        protos.google.api.IHttpBody,
        protos.google.maps.solar.v1.IGetGeoTiffRequest | undefined,
        {} | undefined
    ]>;

Returns an image by its ID.

Parameters
Name Description
request IGetGeoTiffRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.api.IHttpBody, protos.google.maps.solar.v1.IGetGeoTiffRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing HttpBody. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The ID of the asset being requested.
   */
  // const id = 'abc123'

  // Imports the Solar library
  const {SolarClient} = require('@googlemaps/solar').v1;

  // Instantiates a client
  const solarClient = new SolarClient();

  async function callGetGeoTiff() {
    // Construct request
    const request = {
      id,
    };

    // Run request
    const response = await solarClient.getGeoTiff(request);
    console.log(response);
  }

  callGetGeoTiff();

getGeoTiff(request, options, callback)

getGeoTiff(request: protos.google.maps.solar.v1.IGetGeoTiffRequest, options: CallOptions, callback: Callback<protos.google.api.IHttpBody, protos.google.maps.solar.v1.IGetGeoTiffRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetGeoTiffRequest
options CallOptions
callback Callback<protos.google.api.IHttpBody, protos.google.maps.solar.v1.IGetGeoTiffRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getGeoTiff(request, callback)

getGeoTiff(request: protos.google.maps.solar.v1.IGetGeoTiffRequest, callback: Callback<protos.google.api.IHttpBody, protos.google.maps.solar.v1.IGetGeoTiffRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetGeoTiffRequest
callback Callback<protos.google.api.IHttpBody, protos.google.maps.solar.v1.IGetGeoTiffRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getProjectId()

getProjectId(): Promise<string>;
Returns
Type Description
Promise<string>

getProjectId(callback)

getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter
Name Description
callback Callback<string, undefined, undefined>
Returns
Type Description
void

initialize()

initialize(): Promise<{
        [name: string]: Function;
    }>;

Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.

You can await on this method if you want to make sure the client is initialized.

Returns
Type Description
Promise<{ [name: string]: Function; }>

{Promise} A promise that resolves to an authenticated service stub.