Skip to content

Solar

Sample solar exposure at caller-chosen points. Accessed via snaptrude.analysis.solar.

Unlike the heatmap studies (which raster the model's own surfaces), this samples solar exposure at points you supply — an instant (sun visible? / irradiance now) or aggregated over a date range (shaded fraction / cumulative irradiance). Positions are world plan-space coordinates, the same frame as plugin geometry reads; the backend echoes them verbatim. Raw numbers only: it renders no heatmap, mutates no geometry, and writes no save commands.

Pro plan + GPU host

sampleGrid is Pro-gated and write-gated (mirrors analysis.illuminance.compute). The computation runs on the GPU host; when it is unavailable the call fails with OPERATION_FAILED and details.reason === "GPU_UNAVAILABLE".

At a glance

MethodWhat it doesMutates?
sampleGrid(args)Sample per-point solar exposure (instant or range)

Types

PluginSolarSamplePoint

PropertyTypeDescription
idstringCaller-chosen id, echoed back verbatim
position[number, number, number]World plan-space [x, y, z]
normal[number, number, number]?Surface normal for plane-of-array; omit = horizontal

PluginSolarSampleGridArgs

Provide exactly one timing mode: dateTime (instant) XOR startDate+endDate (range).

PropertyTypeDescription
pointsPluginSolarSamplePoint[]Points to sample
dateTimestring?Instant mode: local ISO 8601 with offset
startDatestring?Range mode: inclusive start "YYYY-MM-DD"
endDatestring?Range mode: inclusive end "YYYY-MM-DD"
includeHourlyArtifactboolean?Attach a downloadable per-hour series

PluginSolarSampleResult

One sampled point's result. Irradiance fields are in the result's units and omitted when the backend did not compute them.

PropertyTypeDescription
idstringThe point's caller-chosen id
directSunVisiblebooleanInstant mode: sun disc visible from the point
shadeFractionnumber0..1; range mode: fraction of sun-up hours shaded
directIrradiancenumber?Direct component, in the result's units
diffuseIrradiancenumber?Diffuse component, in the result's units
totalIrradiancenumber?Total (direct + diffuse), in the result's units

PluginSolarSampleGridResult

PropertyTypeDescription
status"running" | "complete" | "cancelled" | "failed"Run status
mode"instant" | "range"Timing mode
coordinateSystem"world-plan-space"Echo of the input frame
modelRevisionstringGeometry revision sampled against (staleness key)
inputHashstringHash of points+dates+geometry (staleness key)
units"W/m2" | "kWh/m2""W/m2" (instant) or "kWh/m2" (range)
sunUpHoursnumberSun-up hours over the sampled window
weatherPluginWeatherSourceMeta | nullResolved weather file, or null
weatherQualitystring[]Deduped quality flags in the consumed rows
resultsPluginSolarSampleResult[]This page of per-point results
hourlyArtifact{ url, format, expiresAt } | nullPer-hour download, or null
nextCursorstring | nullNext page cursor; null = last page

Functions

sampleGrid(args)

Sample solar exposure at a set of points. Provide exactly one timing mode: dateTime (a single instant → mode: "instant", results in W/m²), or startDate + endDate (a range → mode: "range", results in kWh/m²). Each point's optional normal gives plane-of-array irradiance.

  • Parameters:
    • args: PluginSolarSampleGridArgs — the points, exactly one timing mode, and an optional includeHourlyArtifact.
  • Returns: PluginSolarSampleGridResult — the run status, mode/units, provenance, this page of results, an optional hourlyArtifact, and nextCursor.
  • Throws: When the workspace is not on a Pro plan, when plugin writes are disabled, when the scene has no analysable geometry, or when the GPU host is unavailable (OPERATION_FAILED, details.reason === "GPU_UNAVAILABLE").
ts
const grid = await snaptrude.analysis.solar.sampleGrid({
  points: [
    { id: "a", position: [0, 3, 0] },
    { id: "b", position: [5, 3, 0], normal: [0, 0, 1] }
  ],
  dateTime: "2026-06-21T12:00:00+05:30"
});
for (const r of grid.results) {
  console.log(r.id, r.directSunVisible, r.totalIrradiance, grid.units);
}