Compare commits

...

3 Commits

Author SHA1 Message Date
Sam 11c8c73319 Modify js charts 2024-08-09 00:07:23 +01:00
Sam bbada45e84 Remove redundant scripts from baseof 2024-08-09 00:07:00 +01:00
Sam 36beefd0dd Update content 2024-08-09 00:06:48 +01:00
11 changed files with 21 additions and 23 deletions

View File

@ -14,7 +14,7 @@ In this article, we walk through the process of obtaining and downloading raster
We split these rasters into tiles and import them into a local Postgres database using PostGIS. We split these rasters into tiles and import them into a local Postgres database using PostGIS.
We then use this database and construct a query using PostGIS functions to generate a single DEM raster of Singapore and import this into QGIS. We then use tiles from this database to construct a query using PostGIS functions to generate a single DEM raster of Singapore and import this into QGIS.
The final image looks like this: The final image looks like this:
@ -26,7 +26,7 @@ It's possible to download the entire SRTM (Shuttle Radar Topography Mission) sat
The SRTM is a near-global dataset of elevation data with a resolution of 1-arc-second (30m). More information is available from [USGS](https://www.usgs.gov/centers/eros/science/usgs-eros-archive-digital-elevation-shuttle-radar-topography-mission-srtm?qt-science_center_objects=0#qt-science_center_objects). The SRTM is a near-global dataset of elevation data with a resolution of 1-arc-second (30m). More information is available from [USGS](https://www.usgs.gov/centers/eros/science/usgs-eros-archive-digital-elevation-shuttle-radar-topography-mission-srtm?qt-science_center_objects=0#qt-science_center_objects).
In this guide we will go through downloading the data, inserting it into a Postgres database with PostGIS, then querying the final result to create a DEM for any country or region. In this guide we will go through downloading the data, inserting it into a Postgres database with PostGIS, then querying the final result to create a DEM for any country or region.
This guide assumes you are using Linux (this may also apply to other Unix like systems such as MacOS) and have a Postgres database with the PostGIS extension installed. More information [here](https://postgis.net/documentation/getting_started/). This guide assumes you are using Linux (this may also apply to other Unix like systems such as MacOS) and have a Postgres database with the PostGIS extension installed. More information on how to do this can be found on the [PostGIS](https://postgis.net/documentation/getting_started/) website.
## Download data ## Download data
@ -104,7 +104,7 @@ I already have countries vector data in my Postgres database that I extracted fr
To create our table, we'll use the following SQL. I'll break down each section step-by-step. To create our table, we'll use the following SQL. I'll break down each section step-by-step.
First we'll use the `st_intersects` command to select all of the raster tiles that intersect with the Singapore. Note, we'll need to create a table, spatial index then apply constraints for this to work in QGIS. First we'll use the `st_intersects` command to select all of the raster tiles that intersect with the Singapore polygon. Note, we'll need to create a table, spatial index then apply constraints for this to work in QGIS.
{{< highlight sql >}} {{< highlight sql >}}
-- drop existing table and create a new table -- drop existing table and create a new table
@ -139,7 +139,7 @@ select count(*) from dem.singapore_srtm
Here we have 153 of our 128x128 tiles. Here we have 153 of our 128x128 tiles.
We visualise these tiles in QGIS: We can visualise these tiles in QGIS:
{{< figure src="/pics/blog/batch-import-postgis-rasters/singapore-intersects.webp" width="600">}} {{< figure src="/pics/blog/batch-import-postgis-rasters/singapore-intersects.webp" width="600">}}
Note, you can use the `st_convexhull` command to generate an outline of the raster tiles as seen in the previous figure: Note, you can use the `st_convexhull` command to generate an outline of the raster tiles as seen in the previous figure:

View File

@ -7,6 +7,7 @@ header_image: "/pics/blog/install-artix/artix-logo.webp"
draft: False draft: False
summary: "This guide will run through the process of installing Artix Linux with runit as the init system on an encrypted disk partition." summary: "This guide will run through the process of installing Artix Linux with runit as the init system on an encrypted disk partition."
toc: true toc: true
tags: ["Linux", "Arch"]
--- ---
This guide will run through the process of installing Artix Linux, which is a This guide will run through the process of installing Artix Linux, which is a

View File

@ -6,6 +6,7 @@ author:
header_image: "/pics/charts/feerate-percentile.webp" header_image: "/pics/charts/feerate-percentile.webp"
summary: "Bar chart showing historical median daily feerate percentiles for the Bitcoin protocol." summary: "Bar chart showing historical median daily feerate percentiles for the Bitcoin protocol."
chart: "/js/feerate_percentile.js" chart: "/js/feerate_percentile.js"
tags: ["Bitcoin", "Stats"]
--- ---
This chart shows historical median daily feerate percentiles for the Bitcoin This chart shows historical median daily feerate percentiles for the Bitcoin

View File

@ -4,12 +4,16 @@ date: 2024-04-04T09:16:33+01:00
author: author:
name: "Sam Chance" name: "Sam Chance"
header_image: "/pics/charts/growth.webp" header_image: "/pics/charts/growth.webp"
summary: "Growth of bitcoin businesses based on OSM data" summary: "This analysis uses OpenStreetMaps data to chart the yearly growth of bitcoin-accepting businesses worldwide."
tags: ["Bitcoin", "Stats", "OpenStreetMaps"]
--- ---
The following table shows bitcoin business growth around the world for the selected period in the dropdown. The chart displays yearly cumulative number of bitcoin businesses for the countries selected in the table.
Data is obtained from Openstreetmaps and is updated roughly every 2 hours. The table below illustrates growth of businesses worldwide that accept bitcoin as payment for products or services. The accompanying chart displays the yearly cumulative number of bitcoin-accepting businesses for the countries selected in the table. The data is sourced from OpenStreetMaps and is updated approximately every 2 hours.
<br/>
You can select the growth period of interest from the drop-down, which updates the values in the table. The table shows the ***Previous*** value, which was the number of businesses *n* days ago specified in the drop-down. The ***Current*** value is the number of businesses as of the latest update. The table also shows the ***Absolute Difference***, and the ***Percent Difference*** between this period.
The chart always reflects the countries selected in the table. There is a zoom feature on the chart to focus in on a period of interest.
<br/> <br/>
Select growth period: {{< dropdown-filter id=cumulative_period_type select="365 day,28 day,7 day,1 day" >}} Select growth period: {{< dropdown-filter id=cumulative_period_type select="365 day,28 day,7 day,1 day" >}}
{{< chart src="/js/bitcoin-business-growth-chart.js" >}} {{< chart src="/js/bitcoin-business-growth-chart.js" >}}

View File

@ -5,6 +5,7 @@ author:
name: "Sam Chance" name: "Sam Chance"
header_image: "/pics/charts/hashrate.webp" header_image: "/pics/charts/hashrate.webp"
summary: "Timeseries chart showing the Bitcoin network hashrate and difficulty." summary: "Timeseries chart showing the Bitcoin network hashrate and difficulty."
tags: ["Bitcoin", "Stats", "Hashrate"]
--- ---
The estimated hashrate and difficulty of the Bitcoin network, accompanied by the 28-day moving average. The estimated hashrate and difficulty of the Bitcoin network, accompanied by the 28-day moving average.

View File

@ -6,7 +6,7 @@ author:
summary: "Miner rewards" summary: "Miner rewards"
header_image: "/pics/charts/rewards.webp" header_image: "/pics/charts/rewards.webp"
draft: false draft: false
chart: "/js/miner-rewards.js" tags: ["Bitcoin", "Stats"]
--- ---
Total daily aggregated miner income denominated in USD for that day. Total daily aggregated miner income denominated in USD for that day.

View File

@ -5,6 +5,7 @@ author:
name: "Sam Chance" name: "Sam Chance"
header_image: "/pics/charts/price.webp" header_image: "/pics/charts/price.webp"
summary: "Daily bitcoin price. Data is obtained from CoinGecko using their public API." summary: "Daily bitcoin price. Data is obtained from CoinGecko using their public API."
tags: ["Bitcoin", "Stats"]
--- ---
Daily bitcoin price. Data is obtained from CoinGecko using their Daily bitcoin price. Data is obtained from CoinGecko using their

View File

@ -2,9 +2,4 @@
<head> <head>
{{ partial "head.html" . }} {{ partial "head.html" . }}
</head> </head>
<script
type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"
></script>
<script src="https://cdn.jsdelivr.net/npm/echarts@5.5.1/dist/echarts.min.js"></script>
{{ template "partials/body.html" . }} {{ template "partials/body.html" . }}

View File

@ -32,12 +32,7 @@ function updateChart() {
option = { option = {
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
grid: grid, grid: grid,
tooltip: { tooltip: tooltip,
backgroundColor: tooltipBgColor,
order: "seriesDesc",
textStyle: textStyleMain,
trigger: "axis",
},
toolbox: toolboxParams, toolbox: toolboxParams,
xAxis: { xAxis: {
axisTick: axisTick, axisTick: axisTick,
@ -54,7 +49,7 @@ function updateChart() {
fontSize: 12 * fontScale, fontSize: 12 * fontScale,
color: textColor, color: textColor,
formatter(value, index) { formatter(value, index) {
return nFormatter(value, 0); return nFormatter(value, 2);
}, },
}, },
axisLine: axisLine, axisLine: axisLine,

View File

@ -51,7 +51,7 @@ function createTable(data) {
const tr = document.createElement("tr"); const tr = document.createElement("tr");
const checkbox = document.createElement("input"); const checkbox = document.createElement("input");
checkbox.type = "checkbox"; checkbox.type = "checkbox";
checkbox.checked = index < 5; // Check the top 5 rows by default checkbox.checked = index < 1;
checkbox.addEventListener("change", function () { checkbox.addEventListener("change", function () {
if (this.checked) { if (this.checked) {
checkedBoxes.push(row["country_name"]); checkedBoxes.push(row["country_name"]);

View File

@ -19,7 +19,7 @@ const tooltip = {
}; };
const toolboxParams = { const toolboxParams = {
itemSize: 8 * fontScale, itemSize: 16 * fontScale,
showTitle: true, showTitle: true,
top: "-1%", top: "-1%",
right: "20%", right: "20%",