Compare commits

..

No commits in common. "11c8c73319740520eb142359e310874a1cbf2c86" and "28ad68cf4640fc339b89f4af9c4760e9b9b33f6e" have entirely different histories.

11 changed files with 23 additions and 21 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 tiles from this database to construct a query using PostGIS functions to generate a single DEM raster of Singapore and import this into QGIS. 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.
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 on how to do this can be found on the [PostGIS](https://postgis.net/documentation/getting_started/) website. 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/).
## 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 polygon. 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. 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 can visualise these tiles in QGIS: We 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,7 +7,6 @@ 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,7 +6,6 @@ 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,16 +4,12 @@ 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: "This analysis uses OpenStreetMaps data to chart the yearly growth of bitcoin-accepting businesses worldwide." summary: "Growth of bitcoin businesses based on OSM data"
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.
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. Data is obtained from Openstreetmaps and is updated roughly 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,7 +5,6 @@ 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
tags: ["Bitcoin", "Stats"] chart: "/js/miner-rewards.js"
--- ---
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,7 +5,6 @@ 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,4 +2,9 @@
<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,7 +32,12 @@ 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,
@ -49,7 +54,7 @@ function updateChart() {
fontSize: 12 * fontScale, fontSize: 12 * fontScale,
color: textColor, color: textColor,
formatter(value, index) { formatter(value, index) {
return nFormatter(value, 2); return nFormatter(value, 0);
}, },
}, },
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 < 1; checkbox.checked = index < 5; // Check the top 5 rows by default
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: 16 * fontScale, itemSize: 8 * fontScale,
showTitle: true, showTitle: true,
top: "-1%", top: "-1%",
right: "20%", right: "20%",