Skip to content

Commit cbf5d9d

Browse files
committed
Allow setting of maximum tile limit (#53)
1 parent 0269937 commit cbf5d9d

8 files changed

Lines changed: 14 additions & 19 deletions

File tree

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ NUXT_PUBLIC_PLANET_API_KEY=your_planet_api_key
5858
NUXT_PUBLIC_STADIA_API_KEY=your_stadia_api_key
5959
NUXT_PUBLIC_THUNDERFOREST_API_KEY=your_thunderforest_api_key
6060

61+
NUXT_PUBLIC_MAX_TILES=100000
62+
6163
# ==========================================
6264
# Azure Storage Message Queue configuration
6365
# ==========================================

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ For production environments like Azure, input the environmental variables via th
3333

3434
**Mapbox, Planet, Stadia, and Thunderforest API keys and access tokens:** Provide API keys and access tokens to be used across the application for authenticating with map assets. If not provided, the respective map styles will not show in the generate map view.
3535

36+
**Maximum number of tiles:** Provide the maximum number of tiles that can be requested. Default is 100,000. It is recommended to use a sane default that will ensure that your users will not exceed any API free tier limits. (For example, Mapbox currently has a limit of 200,000 tile requests for the [Mapbox Static API](https://www.mapbox.com/pricing#static-tiles-api).)
37+
3638
**Message Queue:** Provide your message queue variables to publish your map request to a storage queue service, where it can be picked up by a [mapgl-tile-renderer](http://github.com/conservationMetrics/mapgl-tile-renderer/) task worker. For Azure, you need a queue name, a storage account name, and a storage account key.
3739

3840
**Offline map storage:** Provide a URI where the offline maps can be downloaded, as well as a path pointing to a volume mount directory for mapgl-tile-renderer to store the files.

components/GenerateMap/MapSidebar.vue

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ const props = defineProps<{
2222
mapLoadError: boolean;
2323
}>();
2424
25+
const maxTiles = useRuntimeConfig().public.maxTiles as number;
26+
2527
const { t } = useI18n();
2628
2729
onMounted(() => {
@@ -135,7 +137,7 @@ const canSubmitMapboxCustom = computed(() => {
135137
136138
/** Computes whether the submit button should be disabled. */
137139
const isSubmitDisabled = computed(() => {
138-
return estimatedTiles.value > 275000 || !canSubmitMapboxCustom.value;
140+
return estimatedTiles.value > maxTiles || !canSubmitMapboxCustom.value;
139141
});
140142
141143
const emit = defineEmits([
@@ -451,20 +453,12 @@ watch(
451453
{{ t("estimatedNumberOfTiles") }}:
452454
{{ estimatedTiles.toLocaleString() }}
453455
</p>
454-
<p
455-
v-if="estimatedTiles > 100000 && estimatedTiles < 275000"
456-
class="text-red-600 mt-2"
457-
>
456+
<p v-if="estimatedTiles > maxTiles" class="text-red-600 mt-2">
458457
<span class="font-bold">{{ t("Warning") }}:</span>
459-
{{ t("over100000Tiles") }}
458+
{{ t("overMaxTilesWarning", { maxTiles }) }}
460459
</p>
461460
</div>
462461

463-
<div v-if="estimatedTiles > 275000" class="text-red-600 mt-2">
464-
<span class="font-bold">{{ t("Warning") }}:</span>
465-
{{ t("over275000Tiles") }}
466-
</div>
467-
468462
<button
469463
type="submit"
470464
:disabled="isSubmitDisabled"

i18n/locales/en.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@
3838
"numberOfTiles": "Number of Tiles",
3939
"offlineMapBoundingBox": "Offline Map Bounding Box",
4040
"offlineMapRequestSubmitted": "Offline map request successfully submitted",
41-
"over100000Tiles": "You are requesting over 100,000 tiles. Note that this will generate a very large offline map file. Please also make sure you will not exceed your tile quota for the map style API, or run into unexpected costs.",
42-
"over275000Tiles": "You are requesting over 275,000 tiles. This exceeds the permitted number of tiles. Please reduce the bounding box or zoom level.",
41+
"overMaxTilesWarning": "You are requesting over {maxTiles} tiles. This exceeds the permitted number of tiles. Please reduce the bounding box or zoom level.",
4342
"password": "Password",
4443
"passwordIncorrect": "The password you entered is incorrect",
4544
"pending": "Pending",

i18n/locales/es.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@
3838
"numberOfTiles": "Número de tiles",
3939
"offlineMapBoundingBox": "Caja delimitadora del mapa offline",
4040
"offlineMapRequestSubmitted": "Solicitud de mapa offline enviada con éxito",
41-
"over100000Tiles": "Estás solicitando más de 100,000 tiles. Ten en cuenta que esto generará un archivo de mapa offline muy grande. Asegúrate también de no exceder tu cuota de tiles para la API de estilo de mapa, o incurrir en costos inesperados.",
42-
"over275000Tiles": "Estás solicitando más de 275,000 tiles. Esto excede el número permitido de tiles. Por favor, reduce la caja delimitadora o el nivel de zoom.",
41+
"overMaxTilesWarning": "Estás solicitando más de {maxTiles} tiles. Esto excede el número permitido de tiles. Por favor, reduce la caja delimitadora o el nivel de zoom.",
4342
"password": "Contraseña",
4443
"passwordIncorrect": "La contraseña que ingresaste es incorrecta",
4544
"pending": "Pendiente",

i18n/locales/nl.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@
3838
"numberOfTiles": "Aantal tegels",
3939
"offlineMapBoundingBox": "Begrenzingskader van offline kaart",
4040
"offlineMapRequestSubmitted": "Offline kaartverzoek succesvol ingediend",
41-
"over100000Tiles": "U vraagt meer dan 100.000 tegels aan. Houd er rekening mee dat dit een zeer groot offline kaartbestand zal genereren. Zorg er ook voor dat u uw tegelquotum voor de kaartstijl-API niet overschrijdt, of onverwachte kosten maakt.",
42-
"over275000Tiles": "U vraagt meer dan 275.000 tegels aan. Dit overschrijdt het toegestane aantal tegels. Verminder het begrenzingskader of zoomniveau.",
41+
"overMaxTilesWarning": "U vraagt meer dan {maxTiles} tegels aan. Dit overschrijdt het toegestane aantal tegels. Verminder het begrenzingskader of zoomniveau.",
4342
"password": "Wachtwoord",
4443
"passwordIncorrect": "Het door u ingevoerde wachtwoord is onjuist",
4544
"pending": "In behandeling",

i18n/locales/pt.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@
3838
"numberOfTiles": "Número de tiles",
3939
"offlineMapBoundingBox": "Caixa delimitadora do mapa offline",
4040
"offlineMapRequestSubmitted": "Pedido de mapa offline enviado com sucesso",
41-
"over100000Tiles": "Você está solicitando mais de 100.000 tiles. Observe que isso gerará um arquivo de mapa offline muito grande. Certifique-se também de não exceder sua cota de tiles para a API de estilo de mapa, ou incorrer em custos inesperados.",
42-
"over275000Tiles": "Você está solicitando mais de 275.000 tiles. Isso excede o número permitido de tiles. Por favor, reduza a caixa delimitadora ou o nível de zoom.",
41+
"overMaxTilesWarning": "Você está solicitando mais de {maxTiles} tiles. Isso excede o número permitido de tiles. Por favor, reduza a caixa delimitadora ou o nível de zoom.",
4342
"password": "Senha",
4443
"passwordIncorrect": "A senha que você digitou está incorreta",
4544
"pending": "Pendente",

nuxt.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ export default defineNuxtConfig({
8989
mapZoom: "0",
9090
mapLatitude: "15",
9191
mapLongitude: "40",
92+
maxTiles: 100000,
9293
offlineMapsPath: "",
9394
offlineMapsUri: "",
9495
planetApiKey: "",

0 commit comments

Comments
 (0)