Skip to content

Commit

Permalink
add geoparquet link to download
Browse files Browse the repository at this point in the history
  • Loading branch information
Josmorsot committed Sep 13, 2023
1 parent 9518ec6 commit 3be1003
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,17 @@
</router-link>
</p>
</li>
<li
class="u-mb--32 u-mb--12--tablet"
v-if="hasGeoparquetAvailable"
>
<h4 class="text is-small is-txtSoftGrey u-mb--10">
GeoParquet
</h4>
<p class="text is-caption">
<a class="underline" :href="geoparquetUrl" target="_blank">Download</a>
</p>
</li>
</ul>
</div>
</div>
Expand All @@ -112,13 +123,20 @@ import { temporalAggregationName } from 'new-dashboard/utils/catalog/temporal-ag
import { geometryTypeName } from 'new-dashboard/utils/catalog/geometry-type-name';
import { updateFrequencyName } from 'new-dashboard/utils/catalog/update-frequency-name';
import { sendCustomDimensions } from 'new-dashboard/utils/catalog/custom-dimensions-ga';
import { checkGeoparquetBucket } from 'new-dashboard/utils/catalog/geoparquet';
import CatalogMapPreview from 'new-dashboard/components/Catalog/CatalogMapPreview';
export default {
name: 'CatalogDatasetSummary',
components: {
CatalogMapPreview
},
data () {
return {
hasGeoparquetAvailable: false,
geoparquetUrl: undefined
};
},
watch: {
dataset: {
handler (value) {
Expand Down Expand Up @@ -169,10 +187,16 @@ export default {
id: this.$route.params.entity_id,
type: this.$route.params.entity_type
});
},
async checkIfGeoparquetBucketExists () {
const { ok, url } = await checkGeoparquetBucket(this.$route.params.entity_id);
this.hasGeoparquetAvailable = ok;
this.geoparquetUrl = url;
}
},
mounted () {
this.fetchKeyVariables();
this.checkIfGeoparquetBucketExists();
}
};
</script>
Expand Down
10 changes: 10 additions & 0 deletions lib/assets/javascripts/new-dashboard/utils/catalog/geoparquet.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export async function checkGeoparquetBucket (dataset) {
dataset = 'cdb_zcta5_fdb278bc';
try {
const url = `https://storage.googleapis.com/geoparquet/carto/${dataset}.parquet`;
const response = await fetch(url, { method: 'HEAD' });
return { ok: response.ok, url };
} catch (e) {
return { ok: false };
}
}

0 comments on commit 3be1003

Please sign in to comment.