The Solar API uses place data to determine building type and identifies
buildings based on satellite imagery. This page describes how to determine which
building's solar information is returned in a
[`buildingInsights`](https://developers.google.com/maps/documentation/solar/reference/rest/v1/buildingInsights.md.txt)
request.

## Building types

The Solar API supports buildings of type
[`premise`](https://developers.google.com/maps/documentation/places/web-service/place-types.md.txt). This type
indicates a named location, usually a building or collection of buildings with a
common name.

Other types, such as
[`subpremise`](https://developers.google.com/maps/documentation/places/web-service/place-types.md.txt#table-b) or
compounds --- for example, detached buildings located on a single property, unless
registered as a [`premise`](https://developers.google.com/maps/documentation/places/web-service/place-types.md.txt) ---
are **not** supported.

## Building roofs

The Solar API identifies optimal rooftop solar panel placement based on
satellite imagery. Residential buildings, particularly inclined or pitched
roofs, are identified with a high degree of accuracy, while buildings with flat
roofs (for example, apartment or commercial buildings) may vary in accuracy.

If the
[`buildingInsights`](https://developers.google.com/maps/documentation/solar/building-insights.md.txt#example_response_object) response does not include the field `solarPanelConfigs`, the building was processed correctly, but we were unable to put panels on the roof. This may happen if the roof is too small to place panels or too shaded for panels to generate significant energy.

> [!TIP]
> **Tip:** Based on other selection approaches, including manual user selection or a custom programmatical selection, you can use the Solar API [`dataLayers`](https://developers.google.com/maps/documentation/solar/reference/rest/v1/dataLayers.md.txt) endpoint to create your own solar potential calculations and panel placement.

## Searching from an address

1. You can convert an address to latitude and longitude coordinates using the
   [Geocoding API](https://developers.google.com/maps/documentation/geocoding/requests-geocoding#Types) or
   [Place Autocomplete API](https://developers.google.com/maps/documentation/places/web-service/autocomplete).

   Use the `place_id` to refer to the matched place.
2. Use the place latitude and longitude coordinates in your Solar API
   [`buildingInsights`](https://developers.google.com/maps/documentation/solar/reference/rest/v1/buildingInsights.md.txt)
   request.

   - If the Solar API finds a matching building, check that the `place_id` in the `buildingInsights` response matches the `place_id` from the Geocoding API or the Place Autocomplete API.
   - To limit results to places with type `premise`, add a place type filter to Geocoding API or Places API responses.

     ```json
     {
     "name": "buildings/ChIJh0CMPQW7j4ARLrRiVvmg6Vs",
     "center": {
     "latitude": 37.4449739,
     "longitude": -122.13914659999998
     },...
     }
     ```

> [!NOTE]
> **Note:** Sometimes the place IDs will not match, which means the searched (lat, lng) does not resolve to the same address or building. Even if the [Geocoding
> API](https://developers.google.com/maps/documentation/geocoding/overview) response is of granularity [`ROOFTOP`](https://developers.google.com/maps/documentation/geocoding/requests-geocoding#results), the `place_id` may have a type other than `premise`.

You can use the [open source sample
app](https://mapsplatform.google.com/demos/solar/) or make a
[`buildingInsights`](https://developers.google.com/maps/documentation/solar/building-insights.md.txt) request to
check the `place_id` for buildings covered by the Solar API.

## Selecting a location on a map

You can also offer a complementary experience by enabling users to select the
building on the map using the [Maps JavaScript
API](https://developers.google.com/maps/documentation/javascript/overview). Extract the building's latitude
and longitude from the [mouse
event](https://developers.google.com/maps/documentation/javascript/examples/event-click-latlng), then pass in
those coordinates in a
[`buildingInsights`](https://developers.google.com/maps/documentation/solar/building-insights.md.txt) request.


![interactive map to point location.](https://developers.google.com/static/maps/documentation/solar/images/dynamic-map.png)