Skip to content

Commit 6bfdac6

Browse files
author
David Cavazos
authored
feat: add descriptions for imagery quality (#12)
* feat: add descriptions for imagery quality * add more descriptions * update packages * npm run format
1 parent 3900260 commit 6bfdac6

File tree

8 files changed

+599
-554
lines changed

8 files changed

+599
-554
lines changed

package-lock.json

Lines changed: 536 additions & 519 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,42 +15,42 @@
1515
"test:unit": "vitest run --coverage"
1616
},
1717
"dependencies": {
18-
"dotenv": "^16.3.1"
18+
"dotenv": "^16.4.5"
1919
},
2020
"devDependencies": {
21-
"@fontsource/fira-mono": "^5.0.8",
22-
"@googlemaps/js-api-loader": "^1.16.2",
23-
"@material/web": "^1.1.1",
24-
"@playwright/test": "^1.41.0",
25-
"@sveltejs/adapter-auto": "^3.1.0",
26-
"@sveltejs/adapter-node": "^3.0.1",
27-
"@sveltejs/kit": "^2.3.5",
28-
"@sveltejs/vite-plugin-svelte": "^3.0.1",
21+
"@fontsource/fira-mono": "^5.0.12",
22+
"@googlemaps/js-api-loader": "^1.16.6",
23+
"@material/web": "^1.4.0",
24+
"@playwright/test": "^1.42.1",
25+
"@sveltejs/adapter-auto": "^3.2.0",
26+
"@sveltejs/adapter-node": "^3.0.3",
27+
"@sveltejs/kit": "^2.5.4",
28+
"@sveltejs/vite-plugin-svelte": "^3.0.2",
2929
"@types/cookie": "^0.6.0",
30-
"@types/google.maps": "^3.54.10",
30+
"@types/google.maps": "^3.55.5",
3131
"@types/google.visualization": "^0.0.73",
3232
"@types/proj4": "^2.5.5",
33-
"@typescript-eslint/eslint-plugin": "^6.19.0",
34-
"@typescript-eslint/parser": "^6.19.0",
35-
"@vitest/coverage-v8": "^1.2.1",
36-
"autoprefixer": "^10.4.17",
37-
"eslint": "^8.56.0",
33+
"@typescript-eslint/eslint-plugin": "^6.21.0",
34+
"@typescript-eslint/parser": "^6.21.0",
35+
"@vitest/coverage-v8": "^1.4.0",
36+
"autoprefixer": "^10.4.19",
37+
"eslint": "^8.57.0",
3838
"eslint-config-prettier": "^9.1.0",
3939
"eslint-plugin-svelte": "^2.35.1",
40-
"geotiff": "^2.1.1",
41-
"geotiff-geokeys-to-proj4": "^2024.1.14",
40+
"geotiff": "^2.1.3",
41+
"geotiff-geokeys-to-proj4": "^2024.3.9",
4242
"google-charts": "^2.0.0",
43-
"postcss": "^8.4.33",
44-
"prettier": "^3.2.4",
45-
"prettier-plugin-svelte": "^3.1.2",
46-
"proj4": "^2.10.0",
47-
"svelte": "^4.2.9",
48-
"svelte-check": "^3.6.3",
49-
"tailwindcss": "^3.4.1",
43+
"postcss": "^8.4.38",
44+
"prettier": "^3.2.5",
45+
"prettier-plugin-svelte": "^3.2.2",
46+
"proj4": "^2.11.0",
47+
"svelte": "^4.2.12",
48+
"svelte-check": "^3.6.8",
49+
"tailwindcss": "^3.4.3",
5050
"tslib": "^2.6.2",
51-
"typescript": "^5.3.3",
52-
"vite": "^5.0.11",
53-
"vitest": "^1.2.1"
51+
"typescript": "^5.4.3",
52+
"vite": "^5.2.6",
53+
"vitest": "^1.2.2"
5454
},
5555
"type": "module"
5656
}

src/routes/+page.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
2020
import * as GMAPILoader from '@googlemaps/js-api-loader';
2121
const { Loader } = GMAPILoader;
22+
2223
import { onMount } from 'svelte';
2324
2425
import SearchBar from './components/SearchBar.svelte';

src/routes/layer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
you may not use this file except in compliance with the License.
66
You may obtain a copy of the License at
77
8-
https://www.apache.org/licenses/LICENSE-2.0
8+
https://www.apache.org/licenses/LICENSE-2.0
99
1010
Unless required by applicable law or agreed to in writing, software
1111
distributed under the License is distributed on an "AS IS" BASIS,

src/routes/sections/DataLayersSection.svelte

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
let apiResponseDialog: MdDialog;
7878
let layerId: LayerId | 'none' = 'monthlyFlux';
7979
let layer: Layer | undefined;
80+
let imageryQuality: 'HIGH' | 'MEDIUM' | 'LOW';
8081
8182
let playAnimation = true;
8283
let tick = 0;
@@ -121,6 +122,8 @@
121122
return;
122123
}
123124
125+
imageryQuality = dataLayersResponse.imageryQuality;
126+
124127
try {
125128
layer = await getLayer(layerId, dataLayersResponse, googleMapsApiKey);
126129
} catch (e) {
@@ -225,7 +228,10 @@
225228
<Dropdown
226229
bind:value={layerId}
227230
options={dataLayerOptions}
228-
onChange={async () => showDataLayer(true)}
231+
onChange={async () => {
232+
layer = undefined;
233+
showDataLayer();
234+
}}
229235
/>
230236

231237
{#if layerId == 'none'}
@@ -237,6 +243,19 @@
237243
<Calendar bind:month bind:day onChange={async () => showDataLayer()} />
238244
{/if}
239245

246+
<span class="outline-text label-medium">
247+
{#if imageryQuality == 'HIGH'}
248+
<p><b>Low altitude aerial imagery</b> available.</p>
249+
<p>Imagery and DSM data were processed at <b>10 cm/pixel</b>.</p>
250+
{:else if imageryQuality == 'MEDIUM'}
251+
<p><b>AI augmented aerial imagery</b> available.</p>
252+
<p>Imagery and DSM data were processed at <b>25 cm/pixel</b>.</p>
253+
{:else if imageryQuality == 'LOW'}
254+
<p><b>AI augmented aerial or satellite imagery</b> available.</p>
255+
<p>Imagery and DSM data were processed at <b>50 cm/pixel</b>.</p>
256+
{/if}
257+
</span>
258+
240259
<InputBool bind:value={showPanels} label="Solar panels" />
241260
<InputBool bind:value={showRoofOnly} label="Roof only" onChange={() => showDataLayer()} />
242261

src/routes/solar.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
you may not use this file except in compliance with the License.
66
You may obtain a copy of the License at
77
8-
https://www.apache.org/licenses/LICENSE-2.0
8+
https://www.apache.org/licenses/LICENSE-2.0
99
1010
Unless required by applicable law or agreed to in writing, software
1111
distributed under the License is distributed on an "AS IS" BASIS,
@@ -133,7 +133,7 @@ export type LayerId = 'mask' | 'dsm' | 'rgb' | 'annualFlux' | 'monthlyFlux' | 'h
133133
// [START solar_api_building_insights]
134134
/**
135135
* Fetches the building insights information from the Solar API.
136-
* https://developers.google.com/maps/documentation/solar/requests#make-building
136+
* https://developers.google.com/maps/documentation/solar/building-insights
137137
*
138138
* @param {LatLng} location Point of interest as latitude longitude.
139139
* @param {string} apiKey Google Cloud API key.
@@ -149,6 +149,7 @@ export async function findClosestBuilding(
149149
};
150150
console.log('GET buildingInsights\n', args);
151151
const params = new URLSearchParams({ ...args, key: apiKey });
152+
// https://developers.google.com/maps/documentation/solar/reference/rest/v1/buildingInsights/findClosest
152153
return fetch(`https://solar.googleapis.com/v1/buildingInsights:findClosest?${params}`).then(
153154
async (response) => {
154155
const content = await response.json();
@@ -166,7 +167,7 @@ export async function findClosestBuilding(
166167
// [START solar_api_data_layers]
167168
/**
168169
* Fetches the data layers information from the Solar API.
169-
* https://developers.google.com/maps/documentation/solar/requests#make-data
170+
* https://developers.google.com/maps/documentation/solar/data-layers
170171
*
171172
* @param {LatLng} location Point of interest as latitude longitude.
172173
* @param {number} radiusMeters Radius of the data layer size in meters.
@@ -182,9 +183,16 @@ export async function getDataLayerUrls(
182183
'location.latitude': location.latitude.toFixed(5),
183184
'location.longitude': location.longitude.toFixed(5),
184185
radius_meters: radiusMeters.toString(),
186+
// The Solar API always returns the highest quality imagery available.
187+
// By default the API asks for HIGH quality, which means that HIGH quality isn't available,
188+
// but there is an existing MEDIUM or LOW quality, it won't return anything.
189+
// Here we ask for *at least* LOW quality, but if there's a higher quality available,
190+
// the Solar API will return us the highest quality available.
191+
required_quality: 'LOW',
185192
};
186193
console.log('GET dataLayers\n', args);
187194
const params = new URLSearchParams({ ...args, key: apiKey });
195+
// https://developers.google.com/maps/documentation/solar/reference/rest/v1/dataLayers/get
188196
return fetch(`https://solar.googleapis.com/v1/dataLayers:get?${params}`).then(
189197
async (response) => {
190198
const content = await response.json();

svelte.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
you may not use this file except in compliance with the License.
66
You may obtain a copy of the License at
77
8-
https://www.apache.org/licenses/LICENSE-2.0
8+
https://www.apache.org/licenses/LICENSE-2.0
99
1010
Unless required by applicable law or agreed to in writing, software
1111
distributed under the License is distributed on an "AS IS" BASIS,

tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"skipLibCheck": true,
1010
"sourceMap": true,
1111
"strict": true,
12-
"types": ["google.visualization"],
13-
},
12+
"types": ["google.visualization"]
13+
}
1414
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
1515
//
1616
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes

0 commit comments

Comments
 (0)